1MSG

Get Template Analytics

GET
/templateAnalytics

Template analytics are reported with daily granularity. Data is returned in UTC by default, or in the WABA timezone when use_waba_timezone=true.

Limitations:

  • Button click analytics are available only for MARKETING or UTILITY templates.
  • Maximum 10 template_ids per request.

If template analytics is disabled for the channel, the API returns an error: Template analytics is disabled for this channel.

Authorization

JWT token
querytoken<token>

Query Parameters

start*string

Start time for the date range. Unix timestamp or YYYY-MM-DD. If using use_waba_timezone=true, use YYYY-MM-DD.

end*string

End time for the date range. Unix timestamp or YYYY-MM-DD. If using use_waba_timezone=true, use YYYY-MM-DD.

granularity*"DAILY"

Analytics granularity. Only DAILY is supported.

Value in"DAILY"
template_ids*array<string>

Array of template IDs to retrieve analytics for. Maximum 10.

metric_types?array<>

Types of metrics to retrieve. If omitted, all metric types are returned.

product_type?string

Filter metrics by product type. If omitted, only Cloud API metrics are returned.

Value in"CLOUD_API""MARKETING_MESSAGES_LITE_API"
use_waba_timezone?boolean

Show metrics in the WABA timezone. If true, start and end must be YYYY-MM-DD.

Response Body

Server response example

application/json
  1. response
data?array<>
paging?
curl -X GET 'https://api.1msg.io/123/templateAnalytics?start=2024-01-01&end=2024-01-07&granularity=DAILY&template_ids=1156697826259690&template_ids=1309207764213383&metric_types=SENT&metric_types=DELIVERED&metric_types=READ&product_type=CLOUD_API&use_waba_timezone=true'
{  "data": [    {      "granularity": "DAILY",      "product_type": "CLOUD_API",      "waba_timezone": "America/Los_Angeles",      "data_points": [        {          "template_id": "1156697826259690",          "start": 1759708800,          "end": 1759795200,          "sent": 3,          "delivered": 3,          "read": 3,          "replied": 0,          "clicked": [            {              "type": "url_button",              "button_content": "Buy Now",              "count": 3            }          ],          "cost": [            {              "type": "amount_spent",              "value": 0.26            }          ]        }      ]    }  ],  "paging": {    "cursors": {      "before": "MAZDZD",      "after": "MjQZD"    }  }}