Skip to content

Inbound Message

POST
/your-webhook-url

Contacta.mx sends a POST request to your configured webhook URL when an inbound WhatsApp message is received on any of your agents.

This is not an endpoint you call — configure your webhook URL in the portal and implement it on your server to receive messages.

The inner payload.type_message field tells you what kind of content was received. The payload.payload object structure varies accordingly — see the schema for details.

Payload delivered to your webhook URL when an inbound WhatsApp message is received.

The outer type is always inbound. The inner payload.type_message indicates the type of content the user sent (text, image, audio, etc.).

object
type
required
string
Allowed values: inbound
inbound
payload
required
object
app
required

WhatsApp Business phone number of the receiving agent (E.164 without +)

string
5215589427963
type
required
string
Allowed values: message
message
msisdn
required

Sender’s phone number (E.164 without +)

string
5215581234567
added_on
required

Timestamp when the message was received by the platform

string format: date-time
2023-12-04 22:19:24
type_message
required

Content type of the received message

string
Allowed values: text image audio video file location sticker contacts
image
charge

Cost charged for receiving this message

number format: float
0.5
payload
required

Message details — structure varies based on type_message

object
id
required

Unique message ID assigned by the platform

string
E8977F4F1E3060F18ADBFE0E6D2DF6C4
source
required

Sender’s phone number (E.164 without +)

string
5215581234567
type
required

Content type (mirrors type_message)

string
image
sender
required
object
phone
string
5215581234567
name

Sender’s WhatsApp display name

string
John Doe
country_code
integer
52
dial_code
string
5581989356
payload
required

Inner content payload — fields depend on type_message:

  • text: text (string)
  • image / video / sticker: url, caption, contentType, urlExpiry
  • audio / file: url, contentType, urlExpiry
  • location: longitude, latitude, name, address
object
text

Message text (present when type_message is text)

string
Hola, quiero más información
url

Temporary URL to the received media file

string format: uri
https://storage.onechat.mx/8141621060/2502100f-a62d-4e72-8137-ab1a22a1fa79.jpeg
caption

Caption sent with the media (may be empty)

string
contentType

MIME type of the media file

string
image/jpeg
urlExpiry

Unix timestamp when the media URL expires

integer
1701857964
longitude

Longitude (present when type_message is location)

number format: float
-99.1332
latitude

Latitude (present when type_message is location)

number format: float
19.4326
name

Location name (present when type_message is location)

string
Ciudad de México
address

Location address (present when type_message is location)

string
CDMX, Mexico
Example
{
"type": "inbound",
"payload": {
"app": "5215589427963",
"type": "message",
"msisdn": "5215581234567",
"added_on": "2023-12-04 22:19:24",
"type_message": "image",
"charge": 0.5,
"payload": {
"id": "E8977F4F1E3060F18ADBFE0E6D2DF6C4",
"source": "5215581234567",
"type": "image",
"sender": {
"phone": "5215581234567",
"name": "5215581234567",
"country_code": 52,
"dial_code": "5581989356"
},
"payload": {
"caption": "",
"url": "https://storage.onechat.mx/8141621060/2502100f-a62d-4e72-8137-ab1a22a1fa79.jpeg",
"contentType": "image/jpeg",
"urlExpiry": 1701857964
}
}
}
}

Your server must return HTTP 200 to acknowledge receipt. Any other status code may trigger a retry.

Useful for guiding users to view code examples in different developer languages.

developer@developer:~#
curl -X POST "https://api.example.com/your-webhook-url" \
-H "Accept: application/json" \
-H "Connection: keep-alive" \
-H "Content-Type: application/json" \
-d '{"type":"inbound","payload":{"app":"5215589427963","type":"message","msisdn":"5215581234567","added_on":"2023-12-04 22:19:24","type_message":"image","charge":0.5,"payload":{"id":"E8977F4F1E3060F18ADBFE0E6D2DF6C4","source":"5215581234567","type":"image","sender":{"phone":"5215581234567","name":"John Doe","country_code":52,"dial_code":"5581989356"},"payload":{"text":"Hola, quiero más información","url":"https://storage.onechat.mx/8141621060/2502100f-a62d-4e72-8137-ab1a22a1fa79.jpeg","caption":"","contentType":"image/jpeg","urlExpiry":1701857964,"longitude":-99.1332,"latitude":19.4326,"name":"Ciudad de México","address":"CDMX, Mexico"}}}}'