Send an email

SDK platic.messages.sendEmail()

Send an email from Gmail, Outlook or a mailbox on your domain connected to Platica. Omit conversationId to start a thread or send it to reply to an existing one. Each thread is a conversation. See Email through the API.

Example

await platic.messages.sendEmail({
  channelId: "em-sales@acme.com",
  to: "ana@example.com",
  subject: "Your quote",
  text: "Hi Ana, here is your quote.",
});

With your assistant, the tool is send_email.

Query parameters

ParameterTypeDescriptionRequired
workspacestringLook for the channel only in that workspace. Without it, every workspace of the credential is searched. A workspace the credential does not cover answers 400—

Request body

{
  "channelId": "em-sales@acme.com",
  "to": "ana@example.com",
  "subject": "Your quote",
  "text": "Hi Ana, here is your quote.",
  "attachments": [
    { "url": "https://acme.com/quote.pdf", "filename": "quote.pdf" }
  ],
  "agentId": "tVKljCHCNiebQdasHeit",
  "client": { "name": "Ana" }
}
FieldTypeRequiredDescription
channelIdstring✓The sending mailbox, such as em-sales@acme.com. It comes from list channels
tostring✓¹The contact's email or their id. Only to start a thread
subjectstring✓¹Subject. Sent as is, without "Re:". Only to start a thread
textstring✓²The email as plain text
htmlstring✓²The email as HTML
attachmentsarray—Up to 10 attachments { "url", "filename" }. url is https:// and, for now, must be a file stored in Platica; filename is optional
conversationIdstring—The id of the conversation you are replying to. Without it, a new thread is started
agentIdstring—The agent that answers when the contact replies. Without it, the conversation has no agent. Only to start a thread
clientobject—Contact data to create or complete them, as in send a message
delaynumber—Delay in milliseconds (3,000 – 86,400,000)
scheduleTimestring—Send date and time (ISO 8601), up to 30 days later. Cannot be combined with delay

¹ Required to start a thread. Ignored when replying. ² Send text, html or both. If you send one, Platica builds the other.

Start or reply

Start a thread: omit conversationId and send to and subject. If the contact does not exist, it is created with the data in client. A new conversation always opens, even if the contact has others.

With agentId, the conversation is automatic: the agent handles the contact's reply. Without it, the conversation is supervised and your team handles it.

Reply (with conversationId): the email goes in the same thread, with its subject. to, subject and agentId are ignored: the recipient, the subject and the agent are those of the conversation.

{
  "channelId": "em-sales@acme.com",
  "conversationId": "Hk3pQ9wLx2QmZ7bN1cVd",
  "text": "Sure, I'll send it as a PDF."
}

If the same request to start a thread arrives twice in under a minute, Platica sends a single email and both responses carry the same conversation.

Response

{
  "status": "success",
  "data": {
    "messageId": "apiMessage_123xyz",
    "kind": "email",
    "status": "sent",
    "timestamp": "2026-11-17T18:00:00.000Z",
    "conversationId": "Hk3pQ9wLx2QmZ7bN1cVd",
    "clientId": "274fc73cb7d84a17955914fdc1a1f9d0",
    "threadStarted": true,
    "scheduled": false
  }
}
FieldTypeDescription
data.conversationIdstring | nullThe id of the thread's conversation. Use it to reply and in get a conversation
data.kindstringAlways email
data.statusstringsent, or delayed / scheduled when it was scheduled
data.timestampstringWhen the API accepted the request, in ISO 8601
data.messageIdstringMessage ID. If it is scheduled, use it to read, reschedule or cancel it
data.clientIdstring | nullContact ID
data.threadStartedbooleantrue if it started a thread, false if it replied
data.scheduledbooleantrue if it was sent with delay or scheduleTime

With delay or scheduleTime, you receive 202, as in send a message. status is delayed or scheduled. data includes executeAt and, depending on the option used, delayMs or scheduledTime.

A scheduled reply returns conversationId. When scheduling a new thread, conversationId and clientId are null: the conversation is created when the email is sent.

Errors

Statusdetails.codeWhen it happens
400INVALID_REQUESTA field is missing or not valid: channelId, to or subject (when starting a thread), text or html (send at least one), an attachment, or delay together with scheduleTime. details.issues says which field
400INVALID_SCHEDULEdelay is out of range, or scheduleTime is not valid, is in the past or is more than 30 days ahead. details.issues points at delay or scheduleTime
400INVALID_REQUESTYou sent a ?workspace= that the credential does not cover. details.available lists the ones you can use
400EMAIL_CHANNEL_REQUIREDchannelId is not an email mailbox of the workspace
400INVALID_RECIPIENTto is neither a valid email nor a contact id
401UNAUTHENTICATEDThe credential is missing or invalid
402PAYMENT_REQUIREDThe workspace reached its credit limit
403FORBIDDENThe credential does not have the module, or the user does not have access to the workspace
404EMAIL_CONVERSATION_NOT_FOUNDconversationId is not a thread of that mailbox (wrong id, wrong channel or ambiguous). details.conversationId repeats it
404WORKSPACE_NOT_FOUNDThe credential does not carry any workspace
409EMAIL_CHANNEL_UNAVAILABLEThe mailbox is paused or its domain is not verified. details.channelId says which. Check its health in list channels
409AGENT_UNAVAILABLEThe agent in agentId does not exist or is not active
409CONTACT_UNAVAILABLEThe contact is blocked, invalid or missing
409MULTIPLE_CONTACTS_MATCHMore than one contact has that email. Send the contact id in to. details.clientIds lists them
409AMBIGUOUS_CHANNELThe channel exists in several workspaces. Add ?workspace=. details.workspaces lists them
409EMAIL_RECIPIENT_SUPPRESSEDThe recipient is on the suppression list
413PAYLOAD_TOO_LARGEThe scheduled send is too large
422EMAIL_REJECTEDAmazon SES refused the email, for example an unverified recipient in a sandbox
502EMAIL_SEND_FAILEDThe mailbox provider could not send the email. The conversation was already created
502UPSTREAM_ERRORThe send could not be scheduled, or the messaging service failed

If a field is missing or has another type, the response is 400 INVALID_REQUEST and details.issues says which.

The general error format is in Errors.

Notes

  • No copy (cc) or blind copy (bcc).
  • Up to 10 attachments per email.
  • There are no email campaigns: to write to several contacts, make one request per contact.