Simulating Inbound WhatsApp Message
Use the WhatsApp API to simulate an inbound WhatsApp message—also called a mobile-originated (MO) message—and test an interactive campaign 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 Interactive Campaign Process, and the Meta WhatsApp application handle a simulated MO message.
- Create and configure an interactive campaign.
- 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 interactive campaign.
- If a matching process exists, the campaign 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 a Trivia campaign that uses the PLAY keyword on the WhatsApp delivery channel. Send a simulated MO message containing PLAY to start the campaign. The campaign sends its first Trivia 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": "+100000002",
"to": "+100000001",
"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 4 days ago
