Obter análises de preços

Use este endpoint para recuperar análises de preços de um Account específico do WhatsApp Business (WABA). Ele fornece detalhamentos de preços e informações sobre faixas de tarifação para qualquer mensagem entregue dentro de um intervalo de datas especificado.

Você pode solicitar dados analíticos com granularidade de meia hora, diária ou mensal. Todos os carimbos de data e hora são apresentados em UTC.

Exemplo

Veja a seguir a descrição de todas as variáveis utilizadas em cada trecho de código:

ChaveDescrição
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_GRANULARITY

The granularity of the analytics data to be retrieved.

Pré-requisitos

Se você não tiver um aplicativo, acesse criar um. Certifique-se também de acessar configure seus webhooks.

Escreva o código

Adicione o seguinte ao arquivo ` get-pricing-analytics.sh`:

curl -G https://api.nexmo.com/v1/channel-manager/whatsapp/wabas/"${CHANNEL_MANAGER_WABA_ID}"/pricing-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 granularity=$CHANNEL_MANAGER_WHATSAPP_ANALYTICS_GRANULARITY

Ver código-fonte completo

Execute seu código

Salve este arquivo no seu computador e execute-o:

bash get-pricing-analytics.sh