Simulating inbound WhatsApp message
Simulate an inbound WhatsApp message through the API to test an automation without an end user sending its keyword. For developers validating automation logic during development.
Use the WhatsApp API to simulate an inbound WhatsApp message—also called a mobile-originated (MO) message—and test an automation without requiring an end user to send its keyword.
An inbound message is a message that an end user sends from the WhatsApp application to a phone number associated with your WABA account. For historical reasons, inbound messages are also called mobile-originated (MO) messages. You can simulate this interaction through the WhatsApp API after the end user has messaged the WABA account within the 24-hour session.
The following diagram shows how the WhatsApp API, the Automation Process, and the Meta WhatsApp application handle a simulated MO message.
- Create and configure an automation.
- Send a simulated MO message to the WhatsApp API through the Simulate MO endpoint.
- The API checks whether the simulated MO is associated with a process in an automation.
- If a matching process exists, the automation sends a mobile-terminated (MT) WhatsApp message to the WhatsApp API.
- The API sends the MT message to Meta, which processes the message.
Message Send ConditionsThe message will only be delivered if it contains a WhatsApp message template approved by META or if the end user interacts with the phone number associated with the WABA account within a period less than 24 hours.
Here, interact means that an end user enters characters in the WhatsApp application and sends them to the phone number associated with the WABA account.
For example, create an automation that uses the PLAY keyword on the WhatsApp delivery channel. Send a simulated MO message containing PLAY to start the automation. The automation sends its first question as an MT message, but WhatsApp does not deliver it unless the end user has interacted with the WABA phone number within the previous 24 hours or the message uses a Meta-approved WhatsApp template.
Send the following request body to create a simulated MO message:
HTTP Request : POST /whatsapp/messages/mo
{
"from": "+1000000002",
"to": "+1000000001",
"body": "message text"
}The request body uses the following parameters:
| Parameter | Required | Description |
|---|---|---|
| from | Yes | Determines the sender phone number for your simulate MO message. Numbers are specified in E.164 format → (‘+’ and a country code). |
| to | Yes | Phone number provided during the WABA account setup will be used as the sender of the MT message. It will receive the simulated MO message. Numbers are specified in E.164 format → (‘+’ and a country code). |
| body | Yes | Simulated MO message text. |
A successful request returns the following response body:
{
"meta": {
"timestamp": 1686755395210,
"transactionId": "03fabb4c-4670-47e8-83ef-4b0a5e4c2883",
"explain": "Request accepted"
}
}Updated 3 days ago
