1.0.0
Use Direct Send API to send transactional WhatsApp messages. Each request references a WhatsApp send definition that you create with the WhatsApp - Send Definitions (Connect API). All operations require a Bearer token that has the sfap_api scope.
This table lists the use cases that the API supports.
| Supported Use Case | HTTP Verb | URI |
|---|---|---|
| Send a message to a recipient | POST | /messaging/whatsapp/v1 |
| Send a message to multiple recipients | POST | /messaging/whatsapp/v1/bulk |
WhatsApp has no preview operation. Every request sends a real message, so test with a phone number that you control.
Personalization
Put personalization values under the $content key in attributes. The $content key is case-sensitive. The property names and value types must match the schema of the content that's linked to the send definition. The schema is stored in contentBody["sfdc_cms:schema"] on the published content. Keep JSON types: send a number as a number, not a string. If the content has no variables, pass an empty attributes object.
The API also accepts flat values, such as attributes.firstName. The content schema doesn't describe or validate flat values, and a flat value doesn't fill a $content variable. Use $content for new integrations.
WhatsApp doesn't accept content overrides. The message is the WhatsApp template or session content that's linked to the send definition. The send definition also sets any message purpose and communication subscription, so a send request can't change them.
Response Status
A 200 response means that the request was processed. Check each recipient's status to find out whether the message was accepted for delivery. Malformed requests and requests that are missing required recipient fields return 400 before anything is sent.
A FAIL status includes a reason and a reasonCode, such as INVALID_RECIPIENT, SEND_FAILED, or RETRYABLE_SEND_FAILED. These aren't the only codes. A channel can return other codes.
A SUCCESS status means that the channel accepted the message for delivery. It doesn't confirm that the recipient received it. Use delivery events or reporting to get the final delivery status.
Retries and Idempotency
Use messageId and requestId to make retries safe. Generate unique values, such as UUIDs, before the first attempt. Reuse the same values when you retry the same send, and don't reuse them for a new message. The deduplication window depends on the channel, so a retry can still produce a second message.
Retry 429 and 503 responses with exponential backoff and jitter. Limit the number of attempts. For a bulk 200 response, don't resend the whole batch. Resend only the failed recipients that you want to retry.
Base error handling on the HTTP status code, not the message text, which is general and can change.
Limits
A bulk request can include up to 200 recipients. Split larger sends into batches of 200 or fewer. WhatsApp template approval and conversation-window rules still apply.
API servers
-
https://api.salesforce.com/automation/actions360
Production server
-
https://test.api.salesforce.com/automation/actions360
Test server
Salesforce Marketing Cloud
Let us know so we can improve!