Record a contact event
Records a custom contact event. Identify the contact by exactly one ID, external ID, or email.
POST
Records a custom contact event. Identify the contact by exactly one ID, external ID, or email. A missing email or external ID creates a contact; an unknown contact ID returns 404. An organization-scoped idempotency key replays the original event. Event names use letters, digits, underscores, hyphens, and dots, up to 255 characters; contact. and samva. prefixes are reserved. Properties allow at most 50 keys and 32 KiB of UTF-8 JSON. Events are retained for 90 days.
apiKeyheader
x-api-key<token>idempotency-key?stringLength
1 <= length <= 255application/json- body
contact*||name*stringLength
1 <= length <= 255properties?|nulloccurredAt?string|nullContactEvent
application/json- response
id*stringcontactId*ContactIdMatch
^contact_[0-9a-hjkmnp-tv-z]{16,24}$name*stringsource*stringValue in
"api""samva"properties*occurredAt*stringrecordedAt*stringimport { createClient } from "samva";
const samva = createClient({ apiKey: process.env.SAMVA_API_KEY! });
const result = await samva.events.create({
"contact": {
"id": "example"
},
"name": "example"
});Example Response
{
"id": "string",
"contactId": "string",
"name": "string",
"source": "api",
"properties": {
"property1": "string",
"property2": "string"
},
"occurredAt": "string",
"recordedAt": "string"
}