Enviar indicador de respuesta

En este fragmento de código aprenderá a enviar un indicador de respuesta en un mensaje de WhatsApp utilizando la Messages API.

Ejemplo

A continuación encontrará la descripción de todas las variables utilizadas en cada fragmento de código:

ClaveDescripción
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.

Requisitos previos

Si no tiene una solicitud, puede crear uno. Asegúrese también de configure sus webhooks.

Escriba el código

Añada lo siguiente a 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"
    }
  }'

Ver fuente completa

Ejecute su código

Guarde este archivo en su máquina y ejecútelo:

bash send-replying-indicator.sh