Enviar indicador de resposta

Neste trecho de código, você aprenderá como enviar um indicador de resposta em uma mensagem do WhatsApp usando a Messages API.

Exemplo

Veja a seguir a descrição de todas as variáveis utilizadas em cada trecho de código:

ChaveDescrição
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.

Pré-requisitos

Se você não tiver um aplicativo, acesse criar um. Certifique-se também de acessar configure seus webhooks.

Escreva o código

Adicione o seguinte ao arquivo ` 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 código-fonte completo

Execute seu código

Salve este arquivo no seu computador e execute-o:

bash send-replying-indicator.sh

Pré-requisitos

Se você não tiver um aplicativo, acesse criar um. Certifique-se também de acessar configure seus webhooks.

Install-Package Vonage

Escreva o código

Adicione o seguinte ao arquivo ` 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)));

Ver código-fonte completo