Skip to main content

Get WhatsApp Messages Programmatically

This endpoint will let you get messages that you sent and received on your 2Chat-connected WhatsApp number. Only those messages sent/received after you made the connection to 2Chat will be returned.


These are path parameters that should go in the URL you use to invoke the endpoint.

your-numberThe number you connnected to 2Chat. This parameter is required+595981048477
remote-numberThe number of your customer. This parameter is optional+595981111111

We return the last 100 messages by default. If you would like to obtain older ones, you can add a page_number as query parameter to go through older pages.

Getting all messages

Assuming +595981048477 is the number you connected to 2Chat, to get all messages you can call:

This call will return the last or newest 100 messages you received on that number. If you would like to see older ones, you can start paginating the results:

  • Page 1, from 100 to 200:
  • Page 2, from 200 to 300:
  • Page n: ...

Similarly, if you would like to see messages that +595981111111 sent to your 2Chat-connected WhatsApp number +595981048477, you can do so by calling:

And to see the page 1 of that call, you can also add the pagination parameter to the request:


curl --location --request GET '' \
--header 'X-User-API-Key: your_api_key_here' \
--data-raw ''


The API will return whether it succeded or not to queue the message for sending

"success": true,
"page_number": 0,
"messages": [
"uuid": "MSGaf1fa3a1-0d8d-4aa5-b117-f9425b651485",
"timestamp": 1670454681.0,
"session_key": "",
"message": {
"media": {
"url": "",
"type": "image",
"mime_type": "image/svg+xml"
"remote_phone_number": "+5215512345432",
"channel_phone_number": "+595981048477",
"sent_by": "api"
"uuid": "MSG8c39a0a9-01cf-46c9-ab46-3c0fb0477e99",
"timestamp": 1670378997.0,
"session_key": "",
"message": {
"text": "you can see my replies here"
"remote_phone_number": "+5215512345432",
"channel_phone_number": "+595981048477",
"sent_by": "agent"

uuidThe unique identifier of the message
timestampTimestamp of the message in UTC
session_keyThe chat session key that corresponds to this message
messageThe payload of the message
message.textThe text content of the message, if present 2Chat-hosted media file URL sent or received type of media message MIME type of the message
remote_phone_numberThe WhatsApp phone number of the other end of the conversation
channel_phone_numberThe WhatsApp phone number where the message arrived
sent_byWho sent the message. E.g.: api, agent, user