送信RCSメッセージを取り消す

このコード・スニペットでは、RCSを送信する方法を学ぶ。 file メッセージAPIを使用する。

各コード・スニペットで使用されているすべての変数の説明を以下に示します:

キー説明
VONAGE_APPLICATION_ID

The Vonage Application ID.

VONAGE_PRIVATE_KEY_PATH

Private key path.

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.

GEOSPECIFIC_VONAGE_API_HOST

The hostname for the Geo-specific API endpoint. One of api-eu.nexmo.com, api-us.nexmo.com, api-ap.nexmo.com.

JWT

Used to authenticate your request. See Authentication for more information, including how to generate a JWT.

MESSAGE_UUID

The UUID of the specific message.

注: ベースURIは、取り消されるメッセージの地域固有でなければならない。

Prerequisites

If you do not have an application you can create one. Make sure you also configure your webhooks.

Write the code

Add the following to revoke-message.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": "revoked"}'

View full source

Run your code

Save this file to your machine and run it:

bash revoke-message.sh

試してみる

コードを実行すると、送信メッセージを取り消すリクエストが行われる。