Skip to main content

Create New Message

POST 

/api/v1/accounts/:account_id/conversations/:conversation_id/messages

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.azchat.com/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"
}]
}
}
}

Request​

Responses​

Success