Revoke an Outbound RCS Message

In this code snippet you learn how to send a RCS file message using the Messages API.

Example

Find the description for all variables used in each code snippet below:

KeyDescription
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.

NOTE: The base URI must be geo-specific to the message being revoked.

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'/'$MESSAGE_UUID \
     -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

Try it out

When you run the code a request is made to revoke the outbound message.