Updated on November 24, 2026
To reply to a specific message with the WhatsApp Business API, you send a regular message to POST /<PHONE_NUMBER_ID>/messages and add a context object with the message_id (the wamid) of the message you want to quote. The customer sees your reply with the original message in a bubble on top, just like when someone taps “Reply” in the app. The quote does not show if the original message was deleted or moved to long-term storage (usually after 30 days), if you reply with a template, and in some cases for KaiOS users.
What a contextual reply is
Meta calls this feature a contextual reply. According to the contextual replies documentation, sending a message as a contextual reply makes it clearer to the user which message you are answering, because the previous one is quoted in a bubble.
It solves a common problem in conversations on the official WhatsApp API: the customer sends three questions in a row, the bot or agent answers the second one first, and the thread gets confusing. With context, each answer points to the right question.
There is no separate endpoint. A contextual reply is a regular session message with one extra field. Everything you already do when sending messages through the API still applies.
The payload: context.message_id
A text reply quoting a customer message:
curl -X POST "https://graph.facebook.com/v27.0/PHONE_NUMBER_ID/messages" \
-H "Authorization: Bearer $WHATSAPP_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"messaging_product": "whatsapp",
"recipient_type": "individual",
"to": "5584999999999",
"context": {
"message_id": "wamid.HBgLNTU4NDk5OTk5OTk5OTkVAgASGBQzQTdCNTg5RjY1MEMyRjlGMjRGNgA="
},
"type": "text",
"text": {
"body": "About the exchange: you can bring the item to any of our stores by Friday."
}
}'
Field rules:
contextsits at the root of the JSON, next totoandtype, not insidetext.context.message_idis required whenever you usecontext. It is thewamidof the quoted message.- The rest of the payload stays the same. You can swap
type: "text"for another session message type; Meta itself mentions replies with audio, image and video.
The API response is the same as for any send: a messages object with the wamid of your new message. Store that ID: you will use it to track delivery and read statuses.
Want to try it while you read? Create a Vectalk account and send your first message through the official API. Create free account →
Where the right message_id comes from
The wamid in context.message_id is the id of the message you want to quote. There are two cases:
- Quoting the customer’s message. Use the
idthat arrived in themessageswebhook when they wrote (entry[0].changes[0].value.messages[0].id). - Quoting one of your own messages. Use the
wamidthe API returned when you sent it. This helps when picking a topic back up, such as “about the quote I sent above”.
The most common mistake is saving only the text and losing the ID. Store the wamid of every inbound and outbound message. Without it, you can’t quote, mark as read or react later:
| Column | Example | Purpose |
|---|---|---|
wamid | wamid.HBgL... | Quote, mark as read, react |
contact | 5584999999999 or user_id | Know whose conversation it is |
direction | in / out | Split received and sent messages |
type | text, image, button… | Decide how to display and answer |
context_id | wamid.HBgL... or empty | Build the reply tree |
received_at | 2026-11-24T10:15:00-03:00 | Compute the message age |
A message_id that doesn’t exist or is malformed makes Meta return an invalid parameter error (code 131009). The article on errors 131008 and 131009 shows how to troubleshoot it.
When the quote does not show
The documentation lists the cases in which the message is delivered, but without the quote bubble:
| Situation | What happens |
|---|---|
| Original message deleted | No quote bubble |
| Original message in long-term storage | No bubble. Meta says this typically happens after 30 days, unless local storage is enabled |
| Reply sent as a template | No bubble |
| Audio, image or video reply to a KaiOS user | No bubble |
| Push-to-talk reply to a KaiOS user | No bubble |
And one sending restriction: a reaction cannot be sent as a contextual reply. A reaction already points to a message through its own reaction.message_id field, as explained in the guide on typing indicators, reactions and quoted replies.
Three practical consequences:
- Old messages. If the customer comes back weeks later and you want to quote something from last month, assume the bubble may not show. Write the reply so it makes sense on its own (“About order 4821, from Oct 10…”).
- Templates. Outside the 24-hour window, only templates are allowed, and templates don’t show quotes. If the context matters, put the reference in the template text itself, in a variable.
- Media. When you reply with a file, such as a receipt, a photo or an audio message, quoting works on most devices but not on KaiOS. Again, the caption should explain itself.
How to read context in the webhooks you receive
On the receiving side, the context object also appears in some messages webhooks. The current webhook reference documents these cases:
| Case | Where it appears | Fields |
|---|---|---|
| Customer taps a quick-reply button in a template | type: "button" message | context.from (business display phone number) and context.id (wamid of the message that had the button) |
| Customer picks a list row or an interactive reply button | type: "interactive" message | context.from and context.id, same meaning |
| Customer uses a product’s “Message business” button | type: "text" message | context.from, context.id and context.referred_product (catalog_id and product_retailer_id) |
| Forwarded message | Text, image and other messages | context.forwarded: true (forwarded up to 5 times) or context.frequently_forwarded: true (more than 5 times) |
Example of a quick-reply button tap:
{
"from": "5584999999999",
"id": "wamid.HBgLNTU4NDk5OTk5OTk5OTkVAgASGBQzQUFERjg0NDEzNDdFODU3MUMxMAA=",
"timestamp": "1764000000",
"context": {
"from": "558430000000",
"id": "wamid.HBgLNTU4NDk5OTk5OTk5OTkVAgASGBQzQUNCNjk5RDUwNUZGMUZEM0VBRAA="
},
"type": "button",
"button": {
"payload": "CONFIRM_ORDER_4821",
"text": "Confirm"
}
}
context.id is what ties the tap to the right message. If you sent ten confirmation templates to the same customer on the same day, it tells you which one was confirmed.
One caveat: the current reference does not describe the shape of context when the customer simply quotes an earlier message with “Reply” in the app. So treat context as optional on every message type and don’t build business rules that depend on it being present. More shapes are in the guide to webhook payloads by message type.
Another recent detail: Meta warns that wa_id and from may be omitted for users who have a username. In that case, identify the person by user_id and from_user_id. See WhatsApp usernames and BSUID.
Node.js example: read context and reply with a quote
The code below takes the webhook, extracts context when present and replies quoting the customer’s message. It uses the native fetch from Node.js 18 or later.
const GRAPH = 'https://graph.facebook.com/v27.0';
const PHONE_ID = process.env.PHONE_NUMBER_ID;
const TOKEN = process.env.WHATSAPP_TOKEN;
const THIRTY_DAYS = 30 * 24 * 60 * 60;
function readMessage(body) {
const value = body?.entry?.[0]?.changes?.[0]?.value;
const msg = value?.messages?.[0];
if (!msg) return null;
const ctx = msg.context || {};
return {
wamid: msg.id,
contact: msg.from, // may be missing for username users
userId: msg.from_user_id || null,
type: msg.type,
timestamp: Number(msg.timestamp),
repliesTo: ctx.id || null,
product: ctx.referred_product || null,
forwarded: Boolean(ctx.forwarded || ctx.frequently_forwarded),
};
}
async function replyQuoting(to, quotedWamid, quotedTimestamp, text) {
const payload = {
messaging_product: 'whatsapp',
recipient_type: 'individual',
to,
type: 'text',
text: { body: text },
};
// The quote usually won't show for messages older than 30 days.
const age = Date.now() / 1000 - quotedTimestamp;
if (quotedWamid && age < THIRTY_DAYS) {
payload.context = { message_id: quotedWamid };
}
const r = await fetch(`${GRAPH}/${PHONE_ID}/messages`, {
method: 'POST',
headers: { Authorization: `Bearer ${TOKEN}`, 'Content-Type': 'application/json' },
body: JSON.stringify(payload),
});
const data = await r.json();
if (!r.ok) throw new Error(JSON.stringify(data.error));
return data.messages[0].id;
}
// Inside the webhook handler, after returning 200 to Meta
async function handle(body) {
const m = readMessage(body);
if (!m || !m.contact) return;
if (m.product) {
await replyQuoting(m.contact, m.wamid, m.timestamp,
`We got your question about product ${m.product.product_retailer_id}.`);
return;
}
await replyQuoting(m.contact, m.wamid, m.timestamp, 'Got it! Checking now.');
}
Notes on the code:
msg.context || {}avoids errors when the field is missing, which is the most common case.- The 30-day check is not mandatory, since Meta accepts the send anyway. It just avoids a reply that depends on a quote the customer probably won’t see.
- The recipient is
from. If it’s missing (username user), the code doesn’t reply;from_user_idis kept inuserIdso you can handle it separately. How to address those users is covered in the BSUID article linked above.
Best practices
- Quote only when it helps. In a one-question, one-answer exchange, the quote is noise. Use it when there are several open questions, out-of-order messages or a topic being picked back up.
- Combine with “read” and “typing”. The natural flow is: mark as read, show the typing indicator and reply with a quote. Details in mark a message as read.
- Human agents. If your system has an agent screen, offer a “reply to this message” button and send the
wamidincontext. It’s the same gesture the agent would make in the app.
How to do it with Vectalk
On Vectalk the payload is the same as the Cloud API. Only the URL and the token change:
curl -X POST https://apis.vectalk.com.br/api/messages \
-H "Authorization: Bearer $VECTALK_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"messaging_product": "whatsapp",
"to": "5584999999999",
"context": { "message_id": "wamid.HBgLNTU4NDk5OTk5OTk5OTkVAgASGBQzQTdCNTg5RjY1MEMyRjlGMjRGNgA=" },
"type": "text",
"text": { "body": "About the exchange: you can bring the item to any of our stores by Friday." }
}'
The Send text page in the docs describes the context object with message_id. The webhooks you receive are the ones in Meta’s documentation, so context arrives in the same format shown above. Each delivered message is deducted from your account’s prepaid balance, with no card registered with Meta. To get started, create your account at apps.vectalk.com.br/register.
Frequently asked questions
Does a quoted reply cost more?
No. context is just a field in the message. Billing follows the category: a text reply inside the customer service window is a service message. Since October 1, 2026, each number has an allowance of 1,000 service messages per month, and billing starts at the 1,001st (BRL 0.0350 per message to Brazilian numbers).
Can I quote a message in a template?
The send is accepted, but Meta documents that the quote bubble does not show when the reply is a template. Put the reference in the text instead, for example in a variable with the order number.
Why didn’t the customer see the quote?
The documented reasons are: original message deleted, original message moved to long-term storage (usually after 30 days), reply sent as a template, or an audio, image or video reply to someone on KaiOS. Also check that the wamid belongs to the same conversation.
Can I react with an emoji while quoting the message?
No. A reaction cannot be sent as a contextual reply. It uses type: "reaction" with the message_id inside the reaction object.
How do I know which message the customer answered when tapping a button?
From context.id in the button or interactive webhook. It carries the wamid of the message that contained the tapped button.
Official sources checked on November 24, 2026: Contextual replies, Mark messages as read, Webhook messages: text, Webhook messages: button, Webhook messages: interactive, Webhook messages: reaction, Vectalk: Send text.
Put your business on the official WhatsApp
Create your account, connect your number to the official API (you can keep the app with coexistence) and start serving customers and sending messages.
