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:
| Chave | Descrição |
|---|---|
JWT | Used to authenticate your request. See |
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. |
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"
}
}'Execute seu código
Salve este arquivo no seu computador e execute-o:
Pré-requisitos
Se você não tiver um aplicativo, acesse criar um. Certifique-se também de acessar configure seus webhooks.
Install-Package VonageEscreva 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)));