Obtener análisis de plantillas

Utilice este endpoint para recuperar el análisis de plantillas de una determinada WhatsApp Business Account (WABA). Describe el número de veces que se ha enviado, entregado y leído una plantilla, y el número de veces que se ha hecho clic en los botones URL o de respuesta rápida de la plantilla.

Los análisis de clics en botones sólo están disponibles para las plantillas clasificadas como MARKETING o UTILITY. Los datos se devuelven con una granularidad diaria en la zona horaria UTC con una retrospectiva de hasta 90 días.

Ejemplo

A continuación encontrará la descripción de todas las variables utilizadas en cada fragmento de código:

ClaveDescripción
CHANNEL_MANAGER_WABA_ID

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

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_WHATSAPP_ANALYTICS_START

The start date and time in ISO-8601 format for the analytics data to be retrieved from, in the format YYYY-MM-DD.

CHANNEL_MANAGER_WHATSAPP_ANALYTICS_END

The end date and time in ISO-8601 format for the analytics data to be retrieved to, in the format YYYY-MM-DD. The maximum difference between the start and end dates is 90 days.

CHANNEL_MANAGER_WHATSAPP_ANALYTICS_TEMPLATE_IDS

An array of the template_ids of the template(s) to retrieve analytics for.

Requisitos previos

Si no tiene una solicitud, puede crear uno. Asegúrese también de configure sus webhooks.

Escriba el código

Añada lo siguiente a get-template-analytics.sh:

curl -G https://api.nexmo.com/v1/channel-manager/whatsapp/wabas/"${CHANNEL_MANAGER_WABA_ID}"/template-analytics \
  -u "${VONAGE_API_KEY}:${VONAGE_API_SECRET}" \
  -H 'Accept: application/json' \
  --data-urlencode start=$CHANNEL_MANAGER_WHATSAPP_ANALYTICS_START \
  --data-urlencode end=$CHANNEL_MANAGER_WHATSAPP_ANALYTICS_END \
  --data-urlencode template_ids=$CHANNEL_MANAGER_WHATSAPP_ANALYTICS_TEMPLATE_IDS

Ver fuente completa

Ejecute su código

Guarde este archivo en su máquina y ejecútelo:

bash get-template-analytics.sh