To start sending messages you must have a Conversation API app. The app holds information about the channel credentials and registered webhooks to which the API delivers callbacks such as message delivery receipts and contact messages. If you don't already have an app please follow the instructions in the getting started guide available in the Sinch Dashboard to create one.
You can send a message from a Conversation app to a contact associated with that app. If the recipient is not associated with an existing contact, a new contact will be created.
The message is added to the active conversation with the contact if a conversation already exists. If no active conversation exists a new one is started automatically.
You can find all of your IDs and authentication credentials on the Sinch Customer Dashboard.
The unique ID of the project. You can find this on the Sinch Dashboard.
This is the request body for sending a message. app_id, recipient, and message are all required fields.
Identifies the recipient. If Dispatch Mode is used, you must use the identified_by field.
Field containing a Card Message
Overwrites the default callback url for delivery receipts for this message. Note that you may define a secret_for_overridden_callback_urls at the app level; this secret will be used to sign the contents of delivery receipts when the default callback URL is overridden by this property. The REST URL should be of the form: http://host[:port]/path
Explicitly define the channels and order in which they are tried when sending the message. All channels provided in this field must be configured in the corresponding Conversation API app, or the request will be rejected. Which channels the API will try and their priority is defined by:
channel_priority_orderif available.recipient.identified_by.channel_identitiesif available.- When recipient is a
contact_id:- if a conversation with the contact exists: the active channel of the conversation is tried first.
- the existing channels for the contact are ordered by contact channel preferences if given. When retrieving contact information, this order is provided in the
channel_priorityfield. - lastly the existing channels for the contact are ordered by the app priority.
Channel-specific properties. The key in the map must point to a valid channel property key as defined by the enum ChannelPropertyKeys. The maximum allowed property value length is 1024 characters.
Metadata that should be associated with the message. Returned in the metadata field of a Message Delivery Receipt. Up to 1024 characters long.
Metadata that will be associated with the conversation in CONVERSATION mode and with the specified recipient identities in DISPATCH mode. This metadata will be propagated on MO callbacks associated with the respective conversation or user identity. Up to 2048 characters long. Note that the MO callback will always use the last metadata available. Important notes:
- If you send a message with the
conversation_metadatafield populated, and then send another message without populating theconversation_metadatafield, the original metadata will continue be propagated on the related MO callbacks. - If you send a message with the
conversation_metadatafield populated, and then send another message with a different value forconversation_metadatain the same conversation, the latest metadata value overwrites the existing one. So, future MO callbacks will include the new metadata. - The
conversation_metadataonly accepts json objects. - If you send a message in
DISPATCHmode while the retention period of the app is set to 0 (note that this value is set to 0 by default), theconversation_metadatafield will not be retained.
Currently only returned in the message_metadata field of an Inbound Message callback.
Select the priority type for the message
| Enum Value | Description |
|---|---|
| NORMAL_PRIORITY | The normal priority queue. |
| HIGH_PRIORITY | The high priority queue. |
The timeout allotted for sending the message, expressed in seconds. Passed to channels which support it and emulated by the Conversation API for channels without ttl support but with message retract/unsend functionality. Channel failover will not be performed for messages with an expired TTL. The format is an integer with the suffix s (for seconds). Valid integer range is 3 to 315,576,000,000 (inclusive). Example values include 10s (10 seconds) and 86400s (24 hours).
Overrides the app's Processing Mode. Default value is DEFAULT.
| Enum Value | Description |
|---|---|
| DEFAULT | The request will inherit the app's configured processing mode. |
| DISPATCH_ONLY | Forces the request to be processed in dispatch mode (without storing contacts and conversations), regardless of the app's configured processing mode. Please note that user replies will still be processed in the app's default processing mode and that the |
An arbitrary identifier that will be propagated to callbacks related to this message, including MO messages from the recipient. The correlation_id is associated with the conversation in CONVERSATION mode and with the specified recipient identities in DISPATCH mode. The MO callbacks will always include the last correlation_id available, (which is similar to how the conversation_metadata property functions). Up to 128 characters long. Important note: If you send a message in DISPATCH mode while the retention period of the app is set to 0 (note that this value is set to 0 by default), the correlation_id field will not be retained.
Update strategy for the conversation_metadata field. Only supported in CONVERSATION processing mode.
| Enum Value | Description |
|---|---|
| REPLACE | The default strategy. Replaces the whole |
| MERGE_PATCH | Patches the |
This field classifies the message content for use with Sinch's consent management functionality. Note that this field is currently only used with Sinch's consent management functionality, and is not referenced elsewhere by the Conversation API.
| Enum Value | Description |
|---|---|
| CONTENT_UNKNOWN | The default content type, when the content is not clearly defined, can be any type of content. |
| CONTENT_MARKETING | Type that indicates that the content is related to Marketing, like marketing campaign messages. |
| CONTENT_NOTIFICATION | Type that indicates that the content is related to Notifications, like charges and alerts. |
- https://us.conversation.api.sinch.comhttps://us.conversation.api.sinch.com/v1/projects/{project_id}/messages:send
curl -i -X POST \
-u '<username>:<password>' \
'https://us.conversation.api.sinch.com/v1/projects/{project_id}/messages:send' \
-H 'Content-Type: application/json' \
-d '{
"app_id": "{APP_ID}",
"recipient": {
"identified_by": {
"channel_identities": [
{
"channel": "{CHANNEL}",
"identity": "{IDENTITY}"
}
]
}
},
"message": {
"text_message": {
"text": "This is a text message."
}
}
}'A successful response. More information is available in delivery report callbacks.
{ "accepted_time": "2019-08-24T14:15:22Z", "message_id": "string" }