Send Replying Indicator

In this code snippet you learn how to send replying indicator in WhatsApp message using the Messages API.

Example

Find the description for all variables used in each code snippet below:

KeyDescription
JWT

Used to authenticate your request. See Authentication for more information, including how to generate a JWT.

GEOSPECIFIC_MESSAGES_API_URL

The URL for the Geo-specific Messages API endpoint. One of https://api-eu.nexmo.com/v1/messages, https://api-us.nexmo.com/v1/messages, https://api-ap.nexmo.com/v1/messages.

MESSAGES_MESSAGE_ID

The UUID of the specific message to mark as read.

Prerequisites

If you do not have an application you can create one. Make sure you also configure your webhooks.

Write the code

Add the following to send-replying-indicator.sh:

curl -X PATCH "${GEOSPECIFIC_MESSAGES_API_URL}/${MESSAGES_MESSAGE_ID}" \
  -H "Authorization: Bearer "$JWT\
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -d $'{
    "status": "read",
    "replying_indicator": {
      "show": true,
      "type": "text"
    }
  }'

View full source

Run your code

Save this file to your machine and run it:

bash send-replying-indicator.sh