Send a new message
Send a new message. Request: POST /v1/mailboxes/{id}/messages. Scope: mailboxes:send.
Starts a new conversation from the mailbox's default endpoint on the channel the body names (email when omitted); a mailbox with no endpoint on that channel is refused (422). A message to a number joins the mailbox's thread with that number when it has one. Records a send action and returns 202 with its current receipt and a Location for action status. An installation, grant, or policy may require approval; otherwise the send is queued. Observe the same action through acceptance and mailbox completion. A policy refusal returns 403 with the recorded receipt.
apiKeyx-api-key<token>id*string^mbx_[0-9a-hjkmnp-tv-z]{16,24}$idempotency-key?stringOptional key that makes a mailbox send idempotent for the calling key or member. Repeating the request with the same key and body returns the original action in its current state. Keep the key after a lost response. Reusing it with different content returns 409. Active actions retain their key; terminal receipts remain replayable for 24 hours.
^[\s\S]{1,255}$application/json- body
channel?|nullto*array<string>1 <= itemscc?array<string>|nullbcc?array<string>|nullreplyTo?array<string>|nullsubject*string1 <= lengthtext?string|nullhtml?string|nullattachments?array<>|nullMailboxSendReceipt
application/json- response
actionId*MailboxActionId^mbxact_[0-9a-hjkmnp-tv-z]{16,24}$draftId*|nullmessageId*|nullthreadId*|nullstate*string"approvalRequired""queued""accepted""completed""notSent""uncertain"acceptedAt*string|nullwaitReason*|nullreviewExpectedAt*string|nullskippedRecipients*array<>executeUntil*string|nullretryAt*string|nullproblem*|nullretryEligible*booleandecision*|nullcreatedAt*stringupdatedAt*stringimport { createClient } from "samva";
const samva = createClient({ apiKey: process.env.SAMVA_API_KEY! });
const result = await samva.mailboxes.sendMessage({
"id": "example",
"to": [
"example"
],
"subject": "example"
});{
"actionId": "string",
"draftId": "string",
"messageId": "string",
"threadId": "string",
"state": "approvalRequired",
"acceptedAt": "string",
"waitReason": "rate",
"reviewExpectedAt": "string",
"skippedRecipients": [
{
"address": "string",
"reason": "bounce",
"topicId": "string"
}
],
"executeUntil": "string",
"retryAt": "string",
"problem": {
"code": "string",
"message": "string",
"error": {
"_tag": "SenderNotReadyError",
"message": "string",
"sender": "string",
"retryAfterSeconds": 0
}
},
"retryEligible": true,
"decision": {
"id": "string",
"reviewRound": 1,
"requirement": "run",
"decider": "rule",
"outcome": "allow",
"reason": "string",
"scopes": [
{
"kind": "organization",
"id": "string"
}
],
"rule": {
"scope": {
"kind": "organization",
"id": "string"
},
"index": 0
},
"guard": "string",
"guardReason": "string",
"resolution": {
"by": "string",
"at": "string",
"as": "approved",
"diff": {
"text": {
"before": "string",
"after": "string"
},
"html": {
"before": "string",
"after": "string"
}
}
}
},
"createdAt": "string",
"updatedAt": "string"
}