Send Conversation Messages Actions
This object is available in API version 59.0 and later.
On invocation, this action inserts and enqueues a message for handling the request and sending out the messages async. The request record can be used to track the progress.
Typical use cases include:
- Confirmation of a purchase or booking
- Shipping or delivery updates
- Password reset requests
- Account verification messages
- Payment reminders
- Abandoned cart reminders
Messages are sent immediately as long as the following conditions are met. If these conditions aren't met, messages can be queued for sending, resulting in a slight delay.
- The invocation of the Send Conversation Messages action includes 5 or fewer messages. If it includes more, the additional messages are queued.
- No more than 200 invocations of the Send Conversation Messages action are in progress. If this limit is reached, additional requests are queued and sent when the number of in-progress requests falls below 200. For queued requests, the messaging session owner for automated messages is the Platform Integration User. Otherwise, it's the user triggering the action.
- The conversation platform has capacity available to send the message. Messages in active conversations are always prioritized over automated outbound messages.
Supported REST HTTP Methods
URI: /services/data/v59.0/actions/standard/sendConversationMessages
Formats: JSON, XML
HTTP Methods: GET, HEAD, POST
Authentication: Authorization: Bearer token
Inputs
| Input | Type | Description |
|---|---|---|
| allowedSessionStatus | string | Limits the time when the message can be sent. Use Any to send the message whether the messaging user is engaged in a session or not. Use NonActive to send the message unless the user is in an Active session (the message is sent after the status changes). Use Closed to send the message only after the session is closed. |
| channelConsentType | string | How to apply consent preferences when determining which messaging users receive the message. Use MessagingEndUser to apply messaging users' consent settings for a channel (most common approach). Use CommunicationSubscription to send only to users who opted into a particular subscription (requires communicationSubscriptionId; visible only if you have a unified channel that supports marketing interactions). Use Custom to apply custom consent preferences when isEnforceMessagingChannelConsent is false. |
| communicationSubscriptionId | string | Available if channelConsentType is set to CommunicationSubscription. The subscription that controls which messaging users the message is sent to. The subscription must be tied to the channel where the message is sent, and the message is sent only to users who opted in to the subscription. |
| isEnforceMessagingChannelConsent | boolean | Indicates whether messaging consent must be verified after messages are queued for sending. |
| messageDefinitionName | string | The API name of a ConversationMessageDefinition (messaging component) record that's used to render the messages. |
| messagingDefinitionInputParameters | list | Optional. A collection of Apex richmessaging__MessageDefinitionInputParameter records that contain messaging component details to use when rendering messages. |
| messagingEndUserIds | list | A collection of up to 100 messaging end user record IDs to use as recipients of the messages. To send more than 100 messages, divide your end user recipients into batches of 100 or fewer and repeat the action invocation for each batch. |
| requestType | string | Specifies the type of the request. Valid value: SendNotificationMessages. |
Outputs
| Output | Type | Description |
|---|---|---|
| requestId | string | The ID of the ConvMessageSendActionRequest record created by the request that's used to track the message progress. |
| messageIdentifiers | list | A collection of generated message UUIDs with one entry for each recipient specified in messagingUserIds. |
Usage
Sample Input
The following sample input attempts to create a ConvMessageSendRequest record using a Messaging Component (messageDefinitionName), the request for the type of component being sent (requestType), the consent preferences (isEnforceMessagingChannelConsent), the consent type (channelConsentType), when the message can be sent (allowedSessionStatus), and the message recipients (messagingEndUserIds). Additionally, the request contains a list of custom parameters (messagingDefinitionInputParameters). These parameters are mapped to parameters configured in the messaging component, which can be optional. Applicable data types for parameters are textValue, recordIdValue, dateValue, dateTimeValue, numberValue, and booleanValue.
1{
2 "inputs": [{
3 "messageDefinitionName":"Notification",
4 "requestType":"SendNotificationMessages",
5 "isEnforceMessagingChannelConsent":true,
6 "channelConsentType":"MessagingEndUser",
7 "allowedSessionStatus":"Any",
8 "messagingEndUserIds":"0PARM000000Lc3I,0PARM000000MZ3p",
9 "messagingDefinitionInputParameters":[{"name":"custom_parameter_name","textValue":"custom parameter value"}]
10 }]
11}Sample Output
The following sample output illustrates a response after a successful request.
1[
2 {
3 "actionName":"sendConversationMessages",
4 "errors":null,
5 "isSuccess":true,
6 "outputValues":{
7 "messageIdentifiers":"c581098c-5db6-4ed8-915f-c9aaa016c671,d8e1990e-5d67-414c-9713-180107d7d1bb",
8"requestId":"1srM000000000p"
9 }
10 }
11]For more information about this action, see Flow Core Actions: Send Conversation Messages and Send Automated Messages in Enhanced Messaging Channels in Salesforce Help.