Skip to main content

Events

Events are actions you send to WhatsApp that are not messages: for example, marking a message as read or blocking a user. They are sent to a separate endpoint and use their own request structure.

Eventevent.typeUse it to…
Mark as readMarkAsReadShow the user that you have read their message.
Typing indicatorTypingShow the user that you are preparing a reply.
BlockBlockBlock a user.
UnblockUnBlockUnblock a previously blocked user.
Meta conversionsSee Event typesReport conversions from Click-to-WhatsApp ads to Meta.

Sending an event​

Send events with a POST request to:

https://gw.messaging.cm.com/v1.0/event

Request structure​

Request structure
{
"authentication": {
"productToken": "YOUR_PRODUCT_TOKEN"
},
"channel": "WhatsApp",
"from": {
"number": "00316098765432"
},
"to": {
"number": "00316012345678"
},
"event": {
"type": "EventTypeHere",
"custom": {
"key": "value"
}
}
}
FieldRequiredDescription
authentication.productTokenYesYour product token.
channelYesWhatsApp
from.numberYesYour WhatsApp Business number.
to.numberYesThe user's phone number or Business-scoped User ID.
event.typeYesThe event type.
event.customDependsEvent-specific attributes. See each event below.

Mark as read​

Marks a message from the user as read. The user sees blue ticks on their message.

FieldRequiredDescription
event.typeYesMarkAsRead
event.custom.message_idYesThe reference of the inbound message, as received on your MO webhook.
Mark as read
{
"authentication": {
"productToken": "YOUR_PRODUCT_TOKEN"
},
"channel": "WhatsApp",
"from": {
"number": "00316098765432"
},
"to": {
"number": "00316012345678"
},
"event": {
"type": "MarkAsRead",
"custom": {
"message_id": "wamid.HBgLMzQ2ODUxMjA0NzMVAgASGBYzRUIwOTE5OURCMjdDQ0RCNjM3OTBEAA=="
}
}
}

An inbound message marked as read


Typing indicator​

Shows the user that you are preparing a reply to their message. Sending this event also marks the message as read.

The indicator disappears when you send your reply, or after 25 seconds, whichever comes first.

FieldRequiredDescription
event.typeYesTyping
event.custom.message_idYesThe reference of the inbound message you are replying to.
event.custom.typing_indicatorYestext
Only use when you will reply

Send the typing indicator only when you are actually preparing a reply, and send the reply shortly afterwards. Showing the indicator without replying confuses and frustrates users.

Typing indicator
{
"authentication": {
"productToken": "YOUR_PRODUCT_TOKEN"
},
"channel": "WhatsApp",
"from": {
"number": "00316098765432"
},
"to": {
"number": "00316012345678"
},
"event": {
"type": "Typing",
"custom": {
"message_id": "wamid.HBgLMzQ2ODUxMjA0NzMVAgASGBYzRUIwOTE5OURCMjdDQ0RCNjM3OTBEAA==",
"typing_indicator": "text"
}
}
}

Typing indicator in the chat list and below the business name

Typing indicator in the chat window


Block​

Blocks a user. Once blocked:

  • The user cannot contact your business or see that you are online.
  • Your business cannot message the user. Attempts to do so fail.
Limitation

You can only block users who have messaged your business in the last 24 hours.

FieldRequiredDescription
event.typeYesBlock
to.numberYesPhone number or Business-scoped User ID of the user to block.
Phone number
{
"authentication": {
"productToken": "YOUR_PRODUCT_TOKEN"
},
"channel": "WhatsApp",
"from": {
"number": "00316098765432"
},
"to": {
"number": "00316012345678"
},
"event": {
"type": "Block"
}
}
BSUID
{
"authentication": {
"productToken": "YOUR_PRODUCT_TOKEN"
},
"channel": "WhatsApp",
"from": {
"number": "00316098765432"
},
"to": {
"number": "NL.123456789458"
},
"event": {
"type": "Block"
}
}

A blocked user trying to send a message


Unblock​

Unblocks a previously blocked user. Once unblocked, the user can contact your business again and you can message them again.

FieldRequiredDescription
event.typeYesUnBlock
to.numberYesPhone number or Business-scoped User ID of the user to unblock.
Phone number
{
"authentication": {
"productToken": "YOUR_PRODUCT_TOKEN"
},
"channel": "WhatsApp",
"from": {
"number": "00316098765432"
},
"to": {
"number": "00316012345678"
},
"event": {
"type": "UnBlock"
}
}
BSUID
{
"authentication": {
"productToken": "YOUR_PRODUCT_TOKEN"
},
"channel": "WhatsApp",
"from": {
"number": "00316098765432"
},
"to": {
"number": "NL.123456789458"
},
"event": {
"type": "UnBlock"
}
}

An unblocked user sending a message


Meta conversions​

Conversion events tell Meta which users who came from your Click-to-WhatsApp ads went on to convert, for example by making a purchase. Meta uses them to measure and optimise your ad campaigns.

Availability

Meta conversion events are only available to businesses based outside the United Kingdom, the European Union and Japan.

How it works​

  1. A user clicks your ad and starts a WhatsApp conversation.
  2. The first inbound message contains a referral object with a click ID in ctwa_clid. See Ad referrals.
  3. Store the click ID with the conversation.
  4. When the user converts, send a conversion event with the click ID in event.custom.ctwa_id.

Event types​

event.typeRequires currency and value
PurchaseYes
OrderCreatedYes
OrderShippedYes
LeadSubmittedNo
QualifiedLeadNo
InitiateCheckoutNo
AddToCartNo
ViewContentNo
OrderDeliveredNo
OrderCanceledNo
OrderReturnedNo
CartAbandonedNo
RatingProvidedNo
ReviewProvidedNo

Fields​

FieldRequiredDescription
event.typeYesOne of the event types.
event.custom.ctwa_idYesThe click ID from referral.ctwa_clid of the user's first inbound message.
event.custom.currencyConditionalISO 4217 currency code, for example EUR. Required for Purchase, OrderCreated and OrderShipped.
event.custom.valueConditionalTotal order amount as a string, for example "12.60". Required for Purchase, OrderCreated and OrderShipped.
ViewContent
{
"authentication": {
"productToken": "YOUR_PRODUCT_TOKEN"
},
"channel": "WhatsApp",
"from": {
"number": "00316098765432"
},
"to": {
"number": "00316012345678"
},
"event": {
"type": "ViewContent",
"custom": {
"ctwa_id": "AfezXXXXlzjkdgEtWs6Coke3jFaNpq7eUgd4H76BmKbOZFw31hIHf-7JEPkRjs_kUVIF0CMzfBkVux_XXX2ZzVPPja_GuHXXXXi9Nt0l3r5d4BZPwNQJpAiQNJ2E32nOcVDA"
}
}
}
Purchase
{
"authentication": {
"productToken": "YOUR_PRODUCT_TOKEN"
},
"channel": "WhatsApp",
"from": {
"number": "00316098765432"
},
"to": {
"number": "00316012345678"
},
"event": {
"type": "Purchase",
"custom": {
"ctwa_id": "AfezXXXXlzjkdgEtWs6Coke3jFaNpq7eUgd4H76BmKbOZFw31hIHf-7JEPkRjs_kUVIF0CMzfBkVux_XXX2ZzVPPja_GuHXXXXi9Nt0l3r5d4BZPwNQJpAiQNJ2E32nOcVDA",
"currency": "USD",
"value": "12.60"
}
}
}