curl --request POST \
--url https://api.social-api.ai/v1/inbox/conversations/{id}/messages \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"account_id": "acc_abc123",
"attachment_url": "https://cdn.example.com/photo.jpg",
"attachments": [
{
"caption": "The damaged panel",
"source": "550e8400-e29b-41d4-a716-446655440000",
"source_type": "media_id",
"type": "image",
"voice": true
}
],
"buttons": [
{
"payload": "VIEW_ORDER",
"title": "View order",
"type": "url",
"url": "https://shop.example.com/orders/1"
}
],
"cards": [
{
"buttons": [
{
"payload": "VIEW_ORDER",
"title": "View order",
"type": "url",
"url": "https://shop.example.com/orders/1"
}
],
"image_url": "https://cdn.example.com/p.jpg",
"subtitle": "Short description",
"title": "Product name"
}
],
"list_button": "View options",
"list_sections": [
{
"rows": [
{
"description": "3 posts waiting",
"id": "menu:review_drafts",
"title": "Review drafts"
}
],
"title": "This week"
}
],
"message_tag": "HUMAN_AGENT",
"quick_replies": [
{
"payload": "TRACK_ORDER",
"title": "Track my order"
}
],
"reply_to_message_id": "m_1234567890",
"text": "Thanks for your message!"
}
'const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
account_id: 'acc_abc123',
attachment_url: 'https://cdn.example.com/photo.jpg',
attachments: [
{
caption: 'The damaged panel',
source: '550e8400-e29b-41d4-a716-446655440000',
source_type: 'media_id',
type: 'image',
voice: true
}
],
buttons: [
{
payload: 'VIEW_ORDER',
title: 'View order',
type: 'url',
url: 'https://shop.example.com/orders/1'
}
],
cards: [
{
buttons: [
{
payload: 'VIEW_ORDER',
title: 'View order',
type: 'url',
url: 'https://shop.example.com/orders/1'
}
],
image_url: 'https://cdn.example.com/p.jpg',
subtitle: 'Short description',
title: 'Product name'
}
],
list_button: 'View options',
list_sections: [
{
rows: [
{
description: '3 posts waiting',
id: 'menu:review_drafts',
title: 'Review drafts'
}
],
title: 'This week'
}
],
message_tag: 'HUMAN_AGENT',
quick_replies: [{payload: 'TRACK_ORDER', title: 'Track my order'}],
reply_to_message_id: 'm_1234567890',
text: 'Thanks for your message!'
})
};
fetch('https://api.social-api.ai/v1/inbox/conversations/{id}/messages', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.social-api.ai/v1/inbox/conversations/{id}/messages"
payload = {
"account_id": "acc_abc123",
"attachment_url": "https://cdn.example.com/photo.jpg",
"attachments": [
{
"caption": "The damaged panel",
"source": "550e8400-e29b-41d4-a716-446655440000",
"source_type": "media_id",
"type": "image",
"voice": True
}
],
"buttons": [
{
"payload": "VIEW_ORDER",
"title": "View order",
"type": "url",
"url": "https://shop.example.com/orders/1"
}
],
"cards": [
{
"buttons": [
{
"payload": "VIEW_ORDER",
"title": "View order",
"type": "url",
"url": "https://shop.example.com/orders/1"
}
],
"image_url": "https://cdn.example.com/p.jpg",
"subtitle": "Short description",
"title": "Product name"
}
],
"list_button": "View options",
"list_sections": [
{
"rows": [
{
"description": "3 posts waiting",
"id": "menu:review_drafts",
"title": "Review drafts"
}
],
"title": "This week"
}
],
"message_tag": "HUMAN_AGENT",
"quick_replies": [
{
"payload": "TRACK_ORDER",
"title": "Track my order"
}
],
"reply_to_message_id": "m_1234567890",
"text": "Thanks for your message!"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"message_id": "m_1234567890",
"message_ids": [
"m_1234567890"
],
"success": true
}{
"error": {
"code": "resource.not_found",
"message": "Account not found",
"meta": {}
}
}{
"error": {
"code": "resource.not_found",
"message": "Account not found",
"meta": {}
}
}{
"error": {
"code": "resource.not_found",
"message": "Account not found",
"meta": {}
}
}{
"error": {
"code": "resource.not_found",
"message": "Account not found",
"meta": {}
}
}{
"error": {
"code": "resource.not_found",
"message": "Account not found",
"meta": {}
}
}{
"error": {
"code": "resource.not_found",
"message": "Account not found",
"meta": {}
}
}Send a message in a conversation
Sends an outgoing DM via the connected platform account and records it in the conversation.
curl --request POST \
--url https://api.social-api.ai/v1/inbox/conversations/{id}/messages \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"account_id": "acc_abc123",
"attachment_url": "https://cdn.example.com/photo.jpg",
"attachments": [
{
"caption": "The damaged panel",
"source": "550e8400-e29b-41d4-a716-446655440000",
"source_type": "media_id",
"type": "image",
"voice": true
}
],
"buttons": [
{
"payload": "VIEW_ORDER",
"title": "View order",
"type": "url",
"url": "https://shop.example.com/orders/1"
}
],
"cards": [
{
"buttons": [
{
"payload": "VIEW_ORDER",
"title": "View order",
"type": "url",
"url": "https://shop.example.com/orders/1"
}
],
"image_url": "https://cdn.example.com/p.jpg",
"subtitle": "Short description",
"title": "Product name"
}
],
"list_button": "View options",
"list_sections": [
{
"rows": [
{
"description": "3 posts waiting",
"id": "menu:review_drafts",
"title": "Review drafts"
}
],
"title": "This week"
}
],
"message_tag": "HUMAN_AGENT",
"quick_replies": [
{
"payload": "TRACK_ORDER",
"title": "Track my order"
}
],
"reply_to_message_id": "m_1234567890",
"text": "Thanks for your message!"
}
'const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
account_id: 'acc_abc123',
attachment_url: 'https://cdn.example.com/photo.jpg',
attachments: [
{
caption: 'The damaged panel',
source: '550e8400-e29b-41d4-a716-446655440000',
source_type: 'media_id',
type: 'image',
voice: true
}
],
buttons: [
{
payload: 'VIEW_ORDER',
title: 'View order',
type: 'url',
url: 'https://shop.example.com/orders/1'
}
],
cards: [
{
buttons: [
{
payload: 'VIEW_ORDER',
title: 'View order',
type: 'url',
url: 'https://shop.example.com/orders/1'
}
],
image_url: 'https://cdn.example.com/p.jpg',
subtitle: 'Short description',
title: 'Product name'
}
],
list_button: 'View options',
list_sections: [
{
rows: [
{
description: '3 posts waiting',
id: 'menu:review_drafts',
title: 'Review drafts'
}
],
title: 'This week'
}
],
message_tag: 'HUMAN_AGENT',
quick_replies: [{payload: 'TRACK_ORDER', title: 'Track my order'}],
reply_to_message_id: 'm_1234567890',
text: 'Thanks for your message!'
})
};
fetch('https://api.social-api.ai/v1/inbox/conversations/{id}/messages', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.social-api.ai/v1/inbox/conversations/{id}/messages"
payload = {
"account_id": "acc_abc123",
"attachment_url": "https://cdn.example.com/photo.jpg",
"attachments": [
{
"caption": "The damaged panel",
"source": "550e8400-e29b-41d4-a716-446655440000",
"source_type": "media_id",
"type": "image",
"voice": True
}
],
"buttons": [
{
"payload": "VIEW_ORDER",
"title": "View order",
"type": "url",
"url": "https://shop.example.com/orders/1"
}
],
"cards": [
{
"buttons": [
{
"payload": "VIEW_ORDER",
"title": "View order",
"type": "url",
"url": "https://shop.example.com/orders/1"
}
],
"image_url": "https://cdn.example.com/p.jpg",
"subtitle": "Short description",
"title": "Product name"
}
],
"list_button": "View options",
"list_sections": [
{
"rows": [
{
"description": "3 posts waiting",
"id": "menu:review_drafts",
"title": "Review drafts"
}
],
"title": "This week"
}
],
"message_tag": "HUMAN_AGENT",
"quick_replies": [
{
"payload": "TRACK_ORDER",
"title": "Track my order"
}
],
"reply_to_message_id": "m_1234567890",
"text": "Thanks for your message!"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"message_id": "m_1234567890",
"message_ids": [
"m_1234567890"
],
"success": true
}{
"error": {
"code": "resource.not_found",
"message": "Account not found",
"meta": {}
}
}{
"error": {
"code": "resource.not_found",
"message": "Account not found",
"meta": {}
}
}{
"error": {
"code": "resource.not_found",
"message": "Account not found",
"meta": {}
}
}{
"error": {
"code": "resource.not_found",
"message": "Account not found",
"meta": {}
}
}{
"error": {
"code": "resource.not_found",
"message": "Account not found",
"meta": {}
}
}{
"error": {
"code": "resource.not_found",
"message": "Account not found",
"meta": {}
}
}Authorizations
Prefix your API key with "Bearer ". Example: Authorization: Bearer sapi_key_...
Path Parameters
Conversation ID
Body
Message payload
"acc_abc123"
AttachmentURL is a single-attachment shorthand. Ignored when attachments is non-empty; its type is inferred from the URL extension.
Deprecated: use Attachments instead, which supersedes it and supports one or many items.
"https://cdn.example.com/photo.jpg"
Attachments sends one or more media items, each as its own message bubble.
Show child attributes
Show child attributes
Buttons renders a button template (1-3 buttons); uses text as the bubble body. On WhatsApp every button must be type postback with a unique payload.
Show child attributes
Show child attributes
Cards renders a generic/carousel template (up to 10 cards).
Show child attributes
Show child attributes
ListButton is the label on the button that opens the list. Required with list_sections, max 20 characters.
"View options"
ListSections renders a tappable list behind a single button, for menus wider than the 3 buttons a reply-button message allows (up to 10 rows in total, across up to 10 sections). WhatsApp only; requires text and list_button.
Show child attributes
Show child attributes
MessageTag sends the DM outside the standard 24-hour window. Instagram connected through Instagram Login only, which accepts only HUMAN_AGENT and extends the window to 7 days; any other value returns 400 validation.invalid_message_tag. On Facebook, on Instagram connected through Facebook Login, and on every other platform, the DM is sent untagged and the 24-hour window applies.
"HUMAN_AGENT"
QuickReplies renders up to 13 tappable chips above the keyboard; requires text.
Show child attributes
Show child attributes
ReplyToMessageID makes the first sent bubble a reply to a specific prior message (Meta reply_to.mid). Instagram/Facebook only.
"m_1234567890"
"Thanks for your message!"
Response
Message sent with ID
MessageID is the first sent message's ID; for a multi-attachment send it is only the first of several IDs.
Deprecated: use MessageIDs instead.
"m_1234567890"
MessageIDs holds every sent message's ID, in send order.
["m_1234567890"]
true