Create New Message
curl --request POST \
--url https://app.yampi.ai/api/v1/accounts/{account_id}/conversations/{conversation_id}/messages \
--header 'Content-Type: application/json' \
--header 'api_access_token: <api-key>' \
--data '
{
"content": "Hello, how can I help you?"
}
'const options = {
method: 'POST',
headers: {api_access_token: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({content: 'Hello, how can I help you?'})
};
fetch('https://app.yampi.ai/api/v1/accounts/{account_id}/conversations/{conversation_id}/messages', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://app.yampi.ai/api/v1/accounts/{account_id}/conversations/{conversation_id}/messages"
payload = { "content": "Hello, how can I help you?" }
headers = {
"api_access_token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": 123,
"content": "<string>",
"account_id": 123,
"inbox_id": 123,
"conversation_id": 123,
"message_type": 0,
"created_at": 123,
"updated_at": 123,
"private": true,
"status": "sent",
"source_id": "<string>",
"content_type": "text",
"content_attributes": {},
"sender_type": "contact",
"sender_id": 123,
"external_source_ids": {},
"additional_attributes": {},
"processed_message_content": "<string>",
"sentiment": {},
"conversation": {},
"attachment": {},
"sender": {}
}{
"description": "<string>",
"errors": [
{
"field": "<string>",
"message": "<string>",
"code": "<string>"
}
]
}{
"description": "<string>",
"errors": [
{
"field": "<string>",
"message": "<string>",
"code": "<string>"
}
]
}Messages
Create New Message
Create a new message in the conversation.
Use application/json for text messages and multipart/form-data when the
message includes file attachments.
Multipart attachment request
Send files with the attachments[] form field. curl -F sets the
multipart/form-data content type and boundary automatically.
curl -X POST "https://app.yampi.ai/api/v1/accounts/{account_id}/conversations/{conversation_id}/messages" \
-H "api_access_token: <your-api-token>" \
-F "content=Here is the screenshot" \
-F "message_type=outgoing" \
-F "private=false" \
-F "attachments[]=@/path/to/screenshot.png"
WhatsApp Template Messages
For WhatsApp channels, you can send structured template messages using the template_params field.
Templates must be pre-approved in WhatsApp Business Manager.
Example Templates
Text with Image Header:
{
"content": "Hi your order 121212 is confirmed. Please wait for further updates",
"template_params": {
"name": "order_confirmation",
"category": "MARKETING",
"language": "en",
"processed_params": {
"body": {
"1": "121212"
},
"header": {
"media_url": "https://picsum.photos/200/300",
"media_type": "image"
}
}
}
}
Text with Copy Code Button:
{
"content": "Special offer! Get 30% off your next purchase. Use the code below",
"template_params": {
"name": "discount_coupon",
"category": "MARKETING",
"language": "en",
"processed_params": {
"body": {
"discount_percentage": "30"
},
"buttons": [{
"type": "copy_code",
"parameter": "SAVE20"
}]
}
}
}
POST
/
api
/
v1
/
accounts
/
{account_id}
/
conversations
/
{conversation_id}
/
messages
Create New Message
curl --request POST \
--url https://app.yampi.ai/api/v1/accounts/{account_id}/conversations/{conversation_id}/messages \
--header 'Content-Type: application/json' \
--header 'api_access_token: <api-key>' \
--data '
{
"content": "Hello, how can I help you?"
}
'const options = {
method: 'POST',
headers: {api_access_token: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({content: 'Hello, how can I help you?'})
};
fetch('https://app.yampi.ai/api/v1/accounts/{account_id}/conversations/{conversation_id}/messages', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://app.yampi.ai/api/v1/accounts/{account_id}/conversations/{conversation_id}/messages"
payload = { "content": "Hello, how can I help you?" }
headers = {
"api_access_token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": 123,
"content": "<string>",
"account_id": 123,
"inbox_id": 123,
"conversation_id": 123,
"message_type": 0,
"created_at": 123,
"updated_at": 123,
"private": true,
"status": "sent",
"source_id": "<string>",
"content_type": "text",
"content_attributes": {},
"sender_type": "contact",
"sender_id": 123,
"external_source_ids": {},
"additional_attributes": {},
"processed_message_content": "<string>",
"sentiment": {},
"conversation": {},
"attachment": {},
"sender": {}
}{
"description": "<string>",
"errors": [
{
"field": "<string>",
"message": "<string>",
"code": "<string>"
}
]
}{
"description": "<string>",
"errors": [
{
"field": "<string>",
"message": "<string>",
"code": "<string>"
}
]
}Authorizations
Path Parameters
Body
application/jsonmultipart/form-data
Response
Success