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:
| Clave | Descripció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 |
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"
}
}'Ejecute su código
Guarde este archivo en su máquina y ejecútelo:
Requisitos previos
Si no tiene una solicitud, puede crear uno. Asegúrese también de configure sus webhooks.
Install-Package VonageEscriba el código
Añada lo siguiente a MarkAsReadWithStatusIndicator.cs:
var credentials = Credentials.FromAppIdAndPrivateKeyPath(VONAGE_APPLICATION_ID, VONAGE_PRIVATE_KEY_PATH);
var vonageClient = new VonageClient(credentials);
await vonageClient.MessagesClient.UpdateAsync(WhatsAppUpdateMessageRequest.Build(MESSAGES_MESSAGE_ID, new WhatsAppReplyingIndicator(true)));