Skip to main content

Reply to a Message

Use the POST /message endpoint with the optional reply_to field to send a message as a reply to a previous message. The outgoing message is then threaded to that message in the conversation (the customer sees it quoted, just like replying in WhatsApp).

The reply_to field

FieldRequiredDescription
reply_typeyesKind of object being replied to. Use message to reply to a WhatsApp message.
reply_to_idyesThe Zoko messageId (UUID) of the message being replied to — the id returned by Send Message or Get Message.
note

Use the Zoko messageId (UUID).

Pass the messageId you get back from Send Message (the messageId in the response) or Get Message (the id), and the API threads your reply to that message.

Reply to a message on WhatsApp

curl --location --request POST 'https://chat.zoko.io/v2/message' \
--header 'Content-Type: application/json' \
--header 'apikey: <apikey>' \
--data-raw '{
"channel": "whatsapp",
"recipient": "919876543210",
"type": "text",
"message": "Hi",
"reply_to": {
"reply_type": "message",
"reply_to_id": "068a169a-f1fe-11ea-9b75-42010a67e00f"
}
}'
import requests

url = "https://chat.zoko.io/v2/message"

payload = {
"channel": "whatsapp",
"recipient": "919876543210",
"type": "text",
"message": "Hi",
"reply_to": {
"reply_type": "message",
"reply_to_id": "068a169a-f1fe-11ea-9b75-42010a67e00f"
}
}
headers = {
"Content-Type": "application/json",
"apikey": "<apikey>"
}

response = requests.request("POST", url, json=payload, headers=headers)

print(response.text)
tip

reply_to works with regular message types (text, image, video, document, etc.) — just add the reply_to object to your normal send request. The recipient is still required. Template messages (template / richTemplate / buttonTemplate) do not support reply_to — the reply context is not attached, so they send un-threaded.