WhatsApp· 4 min read

Reply to a specific WhatsApp message and send reactions via API


To quote a message in your reply, add "context": {"message_id": "WAMID"} to any send request, and WhatsApp shows the original in a bubble above your text. To react, send "type": "reaction" with the message_id you are reacting to and the emoji. Users’ reactions to your messages arrive as type: "reaction" webhooks, and a removed reaction arrives without the emoji field. Both features are documented for the WhatsApp Cloud API, Meta’s official API. Reactions are service messages, so they go out only inside the 24-hour customer service window. A quoted reply follows the rules of the message type it carries (send messages, accessed 2026-11-02).

Quote a message with context.message_id

Meta’s Messages API reference defines context.message_id as “The ID of the message to which this message is a reply” (Messages API reference, accessed 2026-11-02). Use the wamid from the inbound message’s webhook. This is Meta’s sample:

curl 'https://graph.facebook.com/v19.0/106540352242922/messages' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer EAAJB...' \
-d '
{
  "messaging_product": "whatsapp",
  "recipient_type": "individual",
  "to": "+16505551234",
  "context": {
    "message_id": "wamid.HBgLMTY0NjcwNDM1OTUVAgASGBQzQTdCNTg5RjY1MEMyRjlGMjRGNgA="
  },
  "type": "text",
  "text": {
    "body": "You're welcome, Pablo!"
  }
}'

The sample calls v19.0. Meta’s other current samples use v26.0, and the context object is the same.

The quote helps when the user sent several questions in a row and your answers arrive out of order. An AI agent that answers each message separately can quote each one, so the user sees which answer goes with which question.

When the quoted bubble does not appear

Meta lists the cases where the quoted bubble does not appear (contextual replies, accessed 2026-11-02):

Case Detail from Meta
The quoted message is gone “deleted or moved to long term storage”; messages “are typically moved to long term storage after 30 days, unless you have enabled local storage”
KaiOS user, media reply You reply with audio, image or video, or push-to-talk, and the user runs KaiOS
Template reply “You reply with a template message.”

A template sent with context shows no quote. Outside the window that is the only kind of message you can send, so quoting old messages after the window closes does not work. Meta also states that “You cannot send a reaction message as a contextual reply.”

Send a reaction

“Reaction messages are emoji reactions that you can apply to a WhatsApp user message you received” (reaction messages, accessed 2026-11-02). The emoji field takes the “Unicode escape sequence of the emoji, or the emoji itself”. Meta’s sample puts the character itself in the body. The version below uses the JSON escape for the same grinning face, which the field also accepts; everything else is Meta’s sample.

curl 'https://graph.facebook.com/v26.0/106540352242922/messages' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer EAAJB...' \
-d '
{
  "messaging_product": "whatsapp",
  "recipient_type": "individual",
  "to": "+16505551234",
  "type": "reaction",
  "reaction": {
    "message_id": "wamid.HBgLMTY0NjcwNDM1OTUVAgASGBQzQUZCMTY0MDc2MUYwNzBDNTY5MAA=",
    "emoji": "\uD83D\uDE00"
  }
}'

The status webhooks differ from a normal message. “When you send a reaction message, WhatsApp triggers only a sent message webhook (status set to sent)”, and “it does not trigger delivered or read message webhooks.” If your status tracker waits for delivered before marking a send complete, reactions stay pending. Close them on sent, or keep them out of that tracker.

A reaction can fail after the API accepted it. Meta lists four causes: the message is older than 30 days, no matching message exists in the thread, the message was deleted, or it is itself a reaction. In each case “the reaction message is not delivered”, “and you receive a messages webhook with error code 131009.” Match that error on the reaction’s wamid, as described in WhatsApp status webhooks.

Meta’s reaction page does not document how to remove a reaction you sent, including whether an empty emoji string does it. Test that on your number before you rely on it.

Receive reactions

Meta sends a reaction webhook when “A WhatsApp user reacts to a previous message sent by a business within the last 30 days” (reaction webhook reference, accessed 2026-11-02). This is the message object from Meta’s example, with the emoji shown as its JSON escape:

{
  "from": "16505551234",
  "id": "wamid.HBgLMTY1MDM4Nzk0MzkVAgASGBQzQUFERjg0NDEzNDdFODU3MUMxMAA=",
  "timestamp": "1749419544",
  "type": "reaction",
  "reaction": {
    "message_id": "wamid.HBgLMTQxMjU1NTA4MjkVAgASGBQzQUNCNjk5RDUwNUZGMUZEM0VBRAA=",
    "emoji": "\uD83D\uDC4D"
  }
}

reaction.message_id is the “WhatsApp message ID of the message the WhatsApp user reacted to”, which is one of your outbound wamids. id is the reaction’s own ID. “When an end user removes a reaction emoji, WhatsApp sends a webhook without the emoji field.”

Store the latest state per user and message, and compare timestamps, because webhooks can arrive in a different order from the events (out-of-order webhooks). This Python function keeps one reaction per user per message:

latest = {}  # (reacted_message_id, user) -> (timestamp, emoji or None)


def apply_reaction(message: dict) -> None:
    if message.get("type") != "reaction":
        return
    reaction = message["reaction"]
    key = (reaction["message_id"], message["from"])
    ts = int(message["timestamp"])
    if key in latest and latest[key][0] > ts:
        return  # an older event arrived late; same-second events: last arrival wins
    latest[key] = (ts, reaction.get("emoji"))  # None: the user removed it

Meta’s page documents adding and removing. It does not say whether a changed emoji arrives as one webhook or as a removal plus an addition. The function handles both, since the latest event wins. In a database, the same rule becomes an upsert on the pair of IDs, as in the conversation storage schema.

Read the context on inbound messages

Inbound messages carry context in several documented cases (text webhook reference, accessed 2026-11-02). A message sent from a “Message business” button on a product has context.from, context.id and referred_product, with catalog_id and product_retailer_id. A forwarded message has "forwarded": true when it was forwarded 5 times or less, and "frequently_forwarded": true above that.

Replies to your interactive messages carry context.id too, set to the business message that held the button. The interactive messages guide shows that payload, and Flow completions work the same way.

One case is missing from Meta’s text webhook page: a user who swipes to reply to one of your text messages. Meta does not document the context shape for it there. Log a real one from your number before your code depends on it.

Z-API Omni team