Respond to inbound messages
UpdatedWhen people send you WhatsApp messages, you can use campaigns to handle the incoming messages and trigger responses.
How it works
Customer.io treats inbound messages like events: they can trigger campaignsCampaigns are automated workflows you set up to send people messages and perform other actions when they meet your criteria. and add people to segmentsA segment is a group of people in your workspace. Use segments to trigger campaigns, track membership over time, or fine-tune your audience. There are two types of segments: data-driven and manual. Data-driven segments automatically update when people start or stop matching criteria. Manual segments are static..
Unlike inbound SMS, we don’t parse WhatsApp messages into keywords for you. Instead, you match the contents of the message yourself. For example, you might branch a campaign on the body of the message to route people who reply YES differently from people who reply NO—and you can match your own keywords inside a longer message, too.
Set up an inbound message campaign
When you set up a campaign, click the Trigger.
Select the Inbound message trigger option.
If you have more than one inbound channel enabled, set the Inbound channel to WhatsApp.
The Inbound message event that triggers your campaign doesn’t differentiate between replies to different sender numbers. If you want to handle inbound replies to your different sender numbers independently, add conditions to your trigger based on the
tovalue. (Inbound messages comefromyour audience andtoyour WhatsApp sender number.)
Now you can set up message actions to respond to the inbound message or handle other updates. Remember, we don’t parse WhatsApp messages for keywords, so you need to match the contents of the message yourself. See Branch on the message body for more information.
Using inbound message data
Like other event-triggered campaigns, inbound message variables start with event. For example, you reference the message body with {{event.body}}.
{
"from": "+15551234567",
"to": "+15559876543",
"body": "yes",
"message_id": "wamid.HBgLMTU1NTk4NzY1NDMVAgAR",
"message_type": "text",
"in_reply_to": "01HA3K8Z9QF6N4XW2RBT5YVDPC"
}
| Variable | Description |
|---|---|
body | The body of the inbound message. For button or list replies, this is the title of the option the person selected |
from | The phone number of the person who sent the inbound message |
to | Your WhatsApp sender number that received the message, also the sender number of the message the person replied to |
message_id | WhatsApp’s unique ID for the inbound message |
message_type | The type of message the person sent, like text, image, button, or interactive |
has_media | true when the message includes a media attachment. Omitted when there’s no media |
media | Details of any media attachment, including content_type and media_id. Omitted when there’s no media |
reply_id | The ID of the quick-reply button or interactive list option the person selected. Omitted for other message types |
in_reply_to | The ID of the Customer.io delivery the person replied to, if applicable |
Branch on the message body
Because we don’t automatically parse WhatsApp messages for keywords the same way we do for inbound SMS, you’ll need to look for the keywords you expect in the body of the inbound message yourself. You’ll often want to use a multi-split branch to look for specific text and trigger a follow-up message or action for each branch.
For example, you might ask people to reply YES or NO to confirm an appointment, then branch on the body of their reply. Add an “all others” branch to respond when a reply doesn’t match what you expect—for example, to tell people to try again or to ask them to reply with the correct option.
Match your own keywords
You can look for keywords in the body of an inbound message rather than trying to match the whole message. When you look for keywords—in a multi-split or other branch in your campaign—you’ll use the same wildcard matching operators as segment conditions: *, |, and +.
- A
bodythat contains*cancel*matches any message with “cancel” in it, like “Please cancel my order.” - A
bodythat containsyes|yeah|yepmatches a reply with “yes,” “yeah,” or “yep” in it.
Matching ignores case and trims surrounding spaces, so *cancel* also matches Cancel and CANCEL. You don’t need to account for capitalization.
Filter by sender number or message
If you want to handle inbound messages differently based on the sender number or a specific message, you can add a Filter to your campaign trigger. In your filter, you’ll look for the from value to filter by sender number and the body value to filter by message content.
You cannot wait for subsequent messages in your campaign
In your campaign, you can’t wait for another inbound message or a follow-up event. You have to handle cascading inbound messages with subsequent campaigns.
You can still use the Wait Until action to wait for other conditions, but you can’t currently wait for a separate inbound message to continue through a campaign.
When to limit send rates
If you send a WhatsApp broadcast or newsletter, and you want to respond to inbound messages on the same sender number, you should throttle your broadcast so that your inbound-based responses aren’t delayed.
WhatsApp limits how many messages a sender number can send in a given period. If you send a large broadcast from a number that you expect your audience to reply to, the broadcast can use up that number’s send capacity. If an inbound message comes in while your phone number is busy, the replies you send from inbound messages take longer to go out, which makes your responses feel less timely to the people who messaged you.
Throttling broadcasts and newsletters keeps capacity available on your sender number, so inbound-triggered replies can go out promptly.
You can’t limit campaign send rates this way
