Python API to pull all Campaign Report executed on specified period


#1

Hi Community,

I wanted to run a Python API which can extract all the campaign data i.e. sent, viewed, clicked, converted etc. which are scheduled/executed between a particular period.

I know there is a manual way to pull this data, is there any automated way to perform this.

Any lead on this will be appreciated.

Thanks


#2

Hey @nakulrtm,

You can get the report of all the completed campaigns for a specific campaign using the following payload:

import requests

headers = {
    'X-CleverTap-Account-Id': 'ACCOUNT_ID',
    'X-CleverTap-Passcode': 'PASSCODE',
    'Content-Type': 'application/json',
}

data = '{"from":"20171101","to":"20171225"}'

response = requests.post('https://api.clevertap.com/1/message/report.json', headers=headers, data=data) 

Reference link: https://developer.clevertap.com/docs/get-message-reports-api

Best,
Suvidhi