Get WhatsApp Campaign Analytics by ID with OAuth 2.0

Prev Next

This request returns statistics for a single campaign by ID. Date range is optional; if omitted, the full lifetime of the campaign is returned.

If the campaign does not exist or belongs to a different partner, a 400 response is returned.

Endpoint and Headers

POST https://gw.api.insidethekube.com/api/wa/v2/statistics/campaign

Headers

Header

Sample Value

Description

Authorization

Bearer {oauth2-token}

This key is required to authorize your request. Refer to Generate an OAuth 2.0 Token for WhatsApp Campaign Analytics API to generate your OAuth 2.0 token.

Body parameters

Column

Description

Data Type

Required

campaign_id

The Insider campaign ID. Must be greater than 0.

Integer

Yes

start_time

Start of the date range as a 10-digit Unix timestamp. Default value is 2018-01-01.

Integer

No

end_time

End of the date range as a 10-digit Unix timestamp. Default value is the current time.

Integer

No

Sample Request

curl --location 'https://whatsapp.useinsider.com/v1/statistics/campaign' \    
    --header 'Content-Type: application/json' \    
    --header 'x-ins-auth-key: INS.**************************************' \    
    --data '{    
      "campaign_id": 12345    
    }'  

Sample Response

{    
      "sent": 1200,    
      "delivered": 1150,    
      "open": 400,    
      "click": 120,    
      "conversion": 30,    
      "revenue": 0,    
      "drop": 25,    
      "targeted": 1225,    
      "unsubscribe": 2,    
      "undelivered": 50,    
      "deliveryPending": 0,    
      "dropDetails": {    
        "frequencyCapped": 5,    
        "duplicates": 3,    
        "invalidPhoneNumbers": 8,    
        "tierLimitation": 0,    
        "templateFailures": 2,    
        "pausedTemplates": 0,    
        "recipientRelatedErrors": 4,    
        "metaTemporaryErrors": 2,    
        "accountIntegrationErrors": 0,    
        "internalErrors": 1,    
        "rateLimits": 0,    
        "policyFailures": 0    
      },    
      "undeliveredDetails": {    
        "recipientRelatedErrors": 20,    
        "accountVerificationErrors": 2,    
        "mediaErrors": 0,    
        "heldMessages": 8,    
        "metaExperiment": 0,    
        "metaErrors": 10,    
        "invalidMessages": 5,    
        "metaRecipientLimitsErrors": 5,    
        "deliveryReportMissing": 0    
      }    
    }    

For the conversational campaigns, the response additionally contains:

{    
      "responses": [    
        {    
          "cardId": 1,    
          "buttonName": "Yes, I'm interested",    
          "sent": 1200,    
          "delivered": 1150,    
          "open": 400,    
          "click": 120,    
          "conversion": 30,    
          "revenue": 0,    
          "isNoReplyMessage": false    
        }    
      ],    
      "responseSummary": {    
        "sent": 1200,    
        "open": 400,    
        "click": 120,    
        "conversion": 30,    
        "buttonClick": 95    
      }    
    }  

200 OK

This status indicates that the request has been completed successfully.

    {    
      "data": {    
        "statistics": {    
          "sent": 42,    
          "delivered": 41,    
          "read": 30    
        }    
      }    
    } 

Error Responses

400 Failed to parse request (3001)

       
    {    
      "message": "failed to parse request",    
      "errorCode": "3001",    
      "errors": "json: cannot unmarshal ..."    
    } 

400 Validation Failed (3002)

   {    
      "message": "validation failed",    
      "errorCode": "3002",    
      "errors": "campaign_id is required and must be greater than 0"    
    }    

Other common validation messages:

  • start_time must be a 10-digit unix timestamp

  • end_time must be a 10-digit unix timestamp

  • end_time must be greater than start_time

400 Campaign Not Found Or Not Owned By Partner (3004)

This status indicates that the campaign could not be found in the upstream statistics service, or it does not belong to the authenticated partner.

    {    
      "message": "campaign not found or does not belong to this partner",    
      "errorCode": "3004"    
    }   

403 WhatsApp Product Is Not Active (3007)

   {    
      "message": "WhatsApp product is not active",    
      "errorCode": "3007"    
    }  

422 Unprocessable Entity

This status is forwarded when downstream validation fails.

For example, the campaign exists, but is not a valid WhatsApp campaign builder.

    {    
      "message": "The given data was invalid.",    
      "errors": {    
        "campaignFilters.builderId": [    
          "The campaign ID must be a valid WhatsApp campaign."    
        ]    
      }    
    }  

429 Rate Limited (2021)

    {    
      "message": "rate limited",    
      "error": {    
        "message": "rate limited",    
        "code": 2021    
      }    
    }   

Limitations

  • All functions must be executed with an HTTPS POST request.

  • The X-INS-AUTH-KEY should be provided as the authorization key on the request header. If the key is incorrect, the operation will not be executed, and an authorization error will be returned in the response.

  • This API provides data for a 1-year range.

  • You can send 100 requests per second with the same API Key.

The default limit shown here is a standard baseline. If your use case requires higher capacity, feel free to reach out to the Insider One team — we can adjust it to fit your needs.