Enable Template Analytics

In this code snippet you learn how to Enable Template Analytics using the Messages API.

Example

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

KeyDescription
VONAGE_API_KEY

Your Vonage API key (see it on your dashboard).

VONAGE_API_SECRET

Your Vonage API secret (also available on your dashboard).

CHANNEL_MANAGER_WABA_ID

The waba_id of the WhatsApp Business Account (WABA) for which to retrieve the template analytics data.

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 enable-template-analytics.sh:

curl -X "PATCH" "https://api.nexmo.com/v1/channel-manager/whatsapp/wabas/"${CHANNEL_MANAGER_WABA_ID}"/enable_insights" \
  -u "${VONAGE_API_KEY}:${VONAGE_API_SECRET}"

View full source

Run your code

Save this file to your machine and run it:

bash enable-template-analytics.sh

Try it out

When you run the code a request is made to enable template insights.