Get Template Analytics
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.
JWT tokentoken<token>start*stringStart time for the date range. Unix timestamp or YYYY-MM-DD. If using use_waba_timezone=true, use YYYY-MM-DD.
end*stringEnd 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.
"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?stringFilter metrics by product type. If omitted, only Cloud API metrics are returned.
"CLOUD_API""MARKETING_MESSAGES_LITE_API"use_waba_timezone?booleanShow metrics in the WABA timezone. If true, start and end must be YYYY-MM-DD.
Server response example
application/json- 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" } }}