返信インジケーターの送信
このコードスニペットでは、Messages API を使って WhatsApp メッセージに返信インジケータを送信する方法を説明します。
例
各コード・スニペットで使用されているすべての変数の説明を以下に示します:
| キー | 説明 |
|---|---|
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. |
コードを書く
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"
}
}'コードを実行する
このファイルをあなたのマシンに保存し、実行する:
bash send-replying-indicator.sh
コードを書く
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)));