Send RCS Transactional Messages Through Direct Send API
This Page
All Documentation
Use Direct Send APIs to send transactional RCS messages to one or more phone numbers. Rich content, such as cards, media, and suggestions, comes from the published Salesforce CMS content that’s linked to the send definition. You personalize the message with values that you pass in the request.
RCS has no preview operation. Every request sends a real message, so test with a phone number that you control. To add a test number to your RCS agent, see Set Up RCS Agent in Salesforce Help.
Important
Prerequisites
An access token that has the sfap_api scope. The token’s Run As user must have permission to create send definitions. See Connect to Direct Send APIs.
API version 68.0 or later for the send definition request.
An active RCS Messaging Channel and its record ID. To set up an RCS agent, see Salesforce Help.
Published RCS content in Salesforce CMS, of type sfdc_cms__rcs, and its ContentKey.
An opt-in for each recipient’s phone number. See Consent.
If you already have a send definition ID, skip to step 2.
Step 1: Create an RCS Send Definition
Create the send definition on your org’s My Domain host. The sender is the record ID of an active RCS Messaging Channel. Don’t pass the external RCS agent identifier or the channel’s developer name.
YOUR_RCS_MESSAGING_CHANNEL_ID: The record ID of the RCS Messaging Channel.
YOUR_RCS_CONTENT_KEY: The ContentKey of the published RCS content.
YOUR_SUBSCRIPTION_NAME: The name of the communication subscription. RCS requires one.
The response contains the sendDefinitionId. Save it for the next step.
You can also pass these optional fields.
Field
Description
messagePurpose
PROMOTIONAL or TRANSACTIONAL. Required if you don’t pass managedContentKey, or if the content has no purpose. If the content has a purpose, this value must match it. See Message Purpose.
messageSendTiming
Anytime, NotDuringActiveSession, or NotDuringOpenSession. See Send Timing.
clickTrackingEnabled
Indicates whether link clicks are tracked.
dataSpaceName
The developer name of a data space. If you omit it, the API uses the default data space.
Replace YOUR_SEND_DEFINITION_ID with the ID from step 1. For a test org, use https://test.api.salesforce.com/automation/actions360 as the base URL.
Field
Required
Description
to
Yes
The destination phone number in E.164 format, such as +14155550100.
individualId
Yes
The recipient’s identity, used for processing and correlation.
attributes
Yes
The personalization values. If the content has no variables, pass an empty object. See Personalize the Message.
messageId
No
A unique ID for the message, used for idempotency and tracing. If you omit it, the service generates one.
A 200 response means that the request was processed. Check the recipient’s status, SUCCESS or FAIL, to find out whether the message was accepted for delivery. Acceptance doesn’t confirm delivery. See Handle Responses, Errors, and Retries in Direct Send API.
Step 3: Send to Multiple Recipients
To send one message to many phone numbers, post to the /bulk endpoint. Pass a recipients array and an optional batch-level requestId. 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 attributes size aren’t final yet.
Put personalization values under the $content key in attributes. The property names and value types come from the linked content’s schema, which is stored in contentBody["sfdc_cms:schema"]. The property names and casing must match the schema. Values keep their JSON types, so send a number as a number, not as a string.
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.
All rich content, such as cards, media, and suggestions, comes from the linked CMS content. The send request doesn’t accept rich cards, media, suggestions, or other content overrides. To change how the message looks, change the content in Salesforce CMS.
Consent
RCS checks consent when you send, for transactional and promotional messages. The send looks for an opt-in for the phone number under the send definition’s communication subscription and the RCS channel. A number that has no consent record counts as opted out, and the message is suppressed.
A suppressed message can still return "status": "SUCCESS", because SUCCESS means that the message was accepted for delivery. If a test message doesn’t arrive, check the recipient’s opt-in first.
An opt-out on the phone number overrides a subscription opt-in. The number stays suppressed until the opt-out is reversed.