Skip to main content
The Messages API lets you retrieve message history from a conversation and send new messages programmatically. Use it to build chatbots, send automated follow-ups, or read conversation transcripts.

List messages in a conversation

Retrieve all messages in a conversation, ordered oldest to newest.

Path parameters

string
required
The ID of the conversation.

Query parameters

integer
Page number. Default: 1.
integer
Messages per page. Default: 50. Max: 100.

Example request

Example response

Message fields

string
Unique message ID.
string
incoming (from customer) or outgoing (from agent/bot) or activity (system event).
string
Text content of the message.
object
Who sent the message. Includes type (contact, agent, or bot), id, and name.
array
List of attached files. Each attachment has url, content_type, and file_name.

Send a message

Send a new message in a conversation. The message is delivered through the conversation’s channel.

Path parameters

string
required
The ID of the conversation to send a message in.

Request body

string
Text content of the message. Required unless sending a template message.
string
ID of a WhatsApp Message Template to send. Use for outbound WhatsApp messages to customers who haven’t messaged in the last 24 hours.
object
Key-value pairs for template variable substitution (e.g., {"name": "Budi", "order_id": "12345"}).
boolean
Set to true to send as an internal note (not visible to the customer). Default: false.

Example: send a text message

Example: send a WhatsApp template message

Template messages require a pre-approved WhatsApp Message Template. Create and submit templates for approval in your Meta Business Manager account.