Template Comparison API

Use this API to compare templates

📘

Note

  1. The API needs sufficient messages (1000) in the given time frame to work.
  2. The difference between the start and end timestamps should be exactly 604800(7 days), 2592000(30 days), 5184000(60 days), 7776000(90 days).

Request Parameters

KeyDescriptionConstraints
AuthorizationAccess Token for the applicationShould be a valid Partner App Access Token
appIdAppId of the app for which the embed link needs to be generated.Should be a valid appId associated with the account.
gsTemplateId IdID of the WhatsApp Message Template to target.Should be a valid template ID
template_idsArray of template Ids to compare.The array should contain exactly one valid template id.
start_timestampStart timestart time is in seconds in long form
end_timestampEnd timeend time is in seconds in long form

Sample Request

curl --location --request GET 'https://partner.gupshup.io/partner/app/3c7a7716-e731-45db-9478-f93fb011af7d/template/analytics/88dcc6a4-deb7-4785-9ce5-f8c6fa09b745/compare?templateList=c0222c17-7d49-49c6-ab1c-f0be0796fb77&end=1717113600&start=1709337600' \
--header 'Authorization: {{PARTNER_APP_TOKEN}}'

Sample Response

{
    "data": [
        {
            "metric": "BLOCK_RATE",
            "order_by_relative_metric": [ {{list_of_gs_templateId}} ],
            "type": "RELATIVE"
        },
        {
            "metric": "MESSAGE_SENDS",
            "number_values": [
                {
                    "key": "{{gs_template_id_1}}",
                    "value": {{Number_of_messages_sent}}
                },
                {
                    "key": "{{gs_template_id_2}}",
                    "value": {{Number_of_messages_sent}}
                }
            ],
            "type": "NUMBER_VALUES"
        },
        {
            "metric": "TOP_BLOCK_REASON",
            "string_values": [
                {
                    "key": "{{gs_template_id}}",
                    "value": "{{block_reason}}"
                },
                {
                    "key": "{{gs_template_id}}",
                    "value": "{{block_reason}}"
                }
            ],
            "type": "STRING_VALUES"
        }
    ],
    "status": "success"
}

Status Code

Status CodeResponseComment
Success
200{ "data": \[ { "metric": "BLOCK_RATE", "order_by_relative_metric": [ {{list_of_gs_templateId}} ], "type": "RELATIVE" }, { "metric": "MESSAGE_SENDS", "number_values": [ { "key": "{{gs_template_id_1}}", "value": {{Number_of_messages_sent}} }, { "key": "{{gs_template_id_2}}", "value": {{Number_of_messages_sent}} } ], "type": "NUMBER_VALUES" }, { "metric": "TOP_BLOCK_REASON", "string_values": [ { "key": "{{gs_template_id}}", "value": "{{block_reason}}" }, { "key": "{{gs_template_id}}", "value": "{{block_reason}}" } ], "type": "STRING_VALUES" } ], "status": "success" }The speed_processed may not be the same as the one sent in the request as it depends on the payment gateway
Error
400{ "status": "error", "message": "Authentication Failed" }
400{ "status": "error", "message": "Invalid parameter - Templates not eligible for comparison, Templates must have been sent at least 1,000 times in the specified time frame." }
400{ "status": "error", "message": "(#100) The parameter template_ids is required. - null, null" }
400{ "message": "The difference between start and end times should be the number of seconds in 604800(7 days), 2592000(30 days), 5184000(60 days), 7776000(90 days).", "status": "error" }
400{ "message": "One or more templates in the list is not approved.", "status": "error" }
400{ "message": "The parameter start_timestamp should be less than end_timestamp.", "status": "error" }
400{ "message": "Not Template Owner", "status": "error" }
429{ "status": "error", "message": "Too Many Requests" }When request rate limit exceeds.
Language
Click Try It! to start a request and see the response here!