1.0.0
Use Direct Send API to send transactional mobile push notifications. Each request references a Push send definition that you create with the Push - 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 push notification to a device | POST | /messaging/push/v1 |
| Send a push notification to multiple devices | POST | /messaging/push/v1/bulk |
Push has no preview operation. Every request sends a real notification, so test with a device 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.
Push supports per-recipient title and body overrides. Omit either field to render that value from the linked content.
Response Status
A 200 response means that the request was processed. Check each recipient's status to find out whether the notification 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 notification for delivery. It doesn't confirm that the device 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 notification. Push deduplicates requests by tenant, requestId, and messageId for 24 hours. Use new requestId and messageId values for each new notification.
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 2,000 recipients. Split larger sends into batches of 2,000 or fewer. The maximum request size and the maximum size and depth of attributes aren't final yet.
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!