Send a message
An email send whose namespace has no sending setup returns ValidationError: share the sender domain with namespaces, or use a sender owned by that namespace.
An email send whose namespace has no sending setup returns ValidationError: share the sender domain with namespaces, or use a sender owned by that namespace. Sending setup that has stopped after failure returns ValidationError; restart or reconcile the domain's sending setup. Setup still in progress returns ConflictError. Sends a message on the requested channel and returns its receipt (id, status, and why it waits when it does) with a 201 Created status. Requires messages:create or the send permission of the channel it sends on, such as email:send. channel selects the payload variant. Email and WhatsApp sends are available. Repeating an identical request with the same optional Idempotency-Key header returns the original receipt; reusing the key for different content returns a conflict.
apiKeyx-api-key<token>idempotency-key?stringOptional org-scoped key that makes a send idempotent. Repeating a request with the same key and identical payload replays the original 201 response; reusing the key with different content returns 409.
^[\s\S]{1,255}$application/json- body
conversationId?|null|nullmetadata?|nullchannel*"email""email"to*array<|>1 <= itemscc?array<|>|null|nullbcc?array<|>|null|nullfrom?|nullemail*MessageReceipt
application/json- response
id*MessageId^msg_[0-9a-hjkmnp-tv-z]{16,24}$status*string"pending""scheduled""queued""processing""sent""delivered""read""failed""bounced""complained"waitReason*|nullreviewExpectedAt*string|nullskippedRecipients*array<>createdAt*stringimport { createClient } from "samva";
const samva = createClient({ apiKey: process.env.SAMVA_API_KEY! });
const result = await samva.messages.send({
"channel": "email",
"to": [
{
"contactId": "example"
}
],
"email": {
"subject": "Hello",
"text": "Hello from Samva."
}
});{
"id": "string",
"status": "pending",
"waitReason": "rate",
"reviewExpectedAt": "string",
"skippedRecipients": [
{
"address": "string",
"reason": "bounce",
"topicId": "string"
}
],
"createdAt": "string"
}