Developer Docs
POST https://chatloka.net/api/v1/conversations/{conversation}/messages

Button Template

Send a button template with up to 3 buttons. Supports postback, web_url, and phone_number types.

Required scope: conversations:write

How to Use This Endpoint

1. Authentication

Include your API key in the Authorization header:

Authorization: Bearer YOUR_API_KEY

2. Get Your Conversation ID

Use the List Conversations endpoint to find the conversation ID. The response includes data.id which is the conversation ID you need.

3. Reply to a Message (Optional)

To reply/quote a specific message, include reply_to_id in your request body. This is the internal message ID (integer) from the messages list, not the platform's external ID.

{
  "content": "Your reply",
  "reply_to_id": 12345
}

To get message IDs, use the List Messages endpoint β€” each message has an id field.

Body Parameters

Field Type Required Description
channel_type string Required Set to "facebook"
interactive object Required Interactive payload (see below)
reply_to_id integer Optional Internal message ID to reply/quote. Must belong to the same conversation.

Request Body

application/json
{
  "channel_type": "facebook",
  "interactive": {
    "type": "buttons",
    "body": "How can we help you?",
    "buttons": [
      { "type": "postback", "id": "track_order", "title": "Track Order", "payload": "TRACK_ORDER" },
      { "type": "web_url", "title": "Visit Website", "url": "https://example.com" },
      { "type": "phone_number", "title": "Call Us", "phone": "+1234567890" }
    ]
  }
}

Example Request

bash
curl -X POST 'https://chatloka.net/api/v1/conversations/{conversation}/messages' \
  -H 'Authorization: Bearer $API_KEY' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "channel_type": "facebook",
  "interactive": {
    "type": "buttons",
    "body": "How can we help you?",
    "buttons": [
      { "type": "postback", "id": "track_order", "title": "Track Order", "payload": "TRACK_ORDER" },
      { "type": "web_url", "title": "Visit Website", "url": "https://example.com" },
      { "type": "phone_number", "title": "Call Us", "phone": "+1234567890" }
    ]
  }
}'

Response

201 Created
application/json
{
  "success": true,
  "data": {
    "id": 5013,
    "conversation_id": 123,
    "direction": "outbound",
    "type": "interactive",
    "content": "How can we help you?",
    "status": "sent",
    "created_at": "2026-07-14T10:30:00+00:00"
  },
  "message": "Message queued for delivery"
}

Error Responses

401 UNAUTHORIZED
{ "success": false, "error": { "code": "UNAUTHORIZED", "message": "Invalid or revoked API key" } }
403 FORBIDDEN
{ "success": false, "error": { "code": "FORBIDDEN", "message": "You do not have permission to access this resource." } }
404 NOT_FOUND
{ "success": false, "error": { "code": "NOT_FOUND", "message": "The requested resource was not found." } }
422 VALIDATION_ERROR
{ "success": false, "error": { "code": "VALIDATION_ERROR", "message": "The given data was invalid.", "details": { "field": ["The field is required."] } } }
429 RATE_LIMIT_EXCEEDED
{ "success": false, "error": { "code": "RATE_LIMIT_EXCEEDED", "message": "Too many requests. Please slow down.", "retry_after": 60 } }
Start Today

Stop Losing Customers
to Slow Responses

Every minute you wait is revenue walking out the door. Join hundreds of businesses who transformed their customer communication with ChatOn.

50%
Faster Response
24/7
AI Support
40%
Higher Conversion
No credit card required
Setup in 5 minutes
Cancel anytime

βœ“ 30-day money-back guarantee

πŸͺ We use cookies

We use cookies and similar technologies to improve your experience, analyze traffic, and personalize content. By clicking "Accept All", you consent to our use of cookies. Privacy Policy & Cookie Policy.

Cookie Preferences

Choose which cookies you want to allow. Essential cookies are always required for the website to function.

Essential Cookies

Required for the website to function. Cannot be disabled.

Always On

Analytics Cookies

Help us understand how visitors interact with our website by collecting anonymous data.

Marketing Cookies

Used to track visitors across websites to display relevant advertisements.

βœ… Preferences saved!