This feature is deprecated. Please refer to the newer version here.
Use the Daily Campaign Report API to download the campaign report for a particular date. The API provides campaign data for a single date at a time.
Enable the report settings in the dashboard, the system generates the daily report according to the schedule. Previous day campaign reports are not calculated. Put a buffer time from the scheduled time, to pull the reports using API. There is no expiry for the reports generated.
For downloading data spanning across many days, refer to All Campaigns Search View and Export Campaign Statistics.
To use the Daily Campaign Report API, do the following:
- Configure the report settings.
- Use the API to generate the report.
Configure Dashboard Settings
In the settings section of Dashboard, you can find Reports Settings.
- Enable the campaign reports.
- Select the report to be sent using email or to be downloaded through REST API.
- Select the time at which the report should be generated or emailed.
Here you can select the REST API method to fetch the daily campaign report by an API instead of receiving it via Email.
Daily Campaign Report API Endpoints
MoEngage supports multiple data centers with different dashboards and API endpoints. When you sign up with MoEngage, you will be assigned a particular data center and the relevant dashboard is displayed. Use the API endpoints associated with the data center.
For more information about your data center, contact firstname.lastname@example.org.
You can find out which data center you are assigned to when you log in to the dashboard. The following table describes the dashboard URL and API endpoint associated with the data center.
Two versions of the dashboard URL and API endpoints are provided by MoEngage.
Data Centers and Endpoints
|Dashboard URL||Daily Campaign Report API Endpoints|
The 'X' in the API Endpoint URL refers to the MoEngage Data Center (DC). MoEngage hosts each customer in a different DC. You can find your DC number (value of X) and replace the value of 'X' in the URL by referring to the DC and API endpoint mapping here.
GET https://api-01.moengage.com/v1 GET https://api-02.moengage.com/v1 GET https://api-03.moengage.com/v1
The API ID displayed as APP Settings on the dashboard.
The file name is in the format YYYYMMDD.zip
Generating Signature for the API Request
To verify the authenticity of the caller and validity of the request, a unique signature is needed to be passed as a GET parameter. The signature is a combination of API-ID, FILENAME, and SECRET-KEY ( SECRET-KEY is provided in APP Settings of MoEngage dashboard with the API-ID ).
The following is the sample API downloads the report for the Campaign report of 2nd March 2016:
Successful API request automatically downloads the report file. Failure of API request results in JSON Response explaining the reason for failure.
Sample wget to test API
You can test the API using a simple wget:
wget -O test.zip https://api.moengage.com/dailyCampaignReportDump/MAZW5N1IMMSH5H67C3T9KBHA/20160914.zip?Signature=838fe32cf4882860b0109ed371b1bf380ad640292b8178e9af129706ecfd24fe
Sample Signature Python
# SAMPLE IMPLEMENTATION IN PYTHON from hashlib import sha256 Api_ID = "YOUR-API-ID" FILENAME = "20160302.zip" SECRET_KEY = "YOUR-SECRET-KEY" Signature_Key = Api_ID + "|" + FILENAME + "|" + SECRET_KEY # Now Signature is hexdigest of sha256 of Signature_Key Signature = sha256(Signature_Key).hexdigest() # Generated Signature is - 2aca4dcb53a2ed026a60173b67cebb1f2875a47ac5fe06ca5aa478b93606b532
Import APIs for Postman
We have made it easy for you to test the APIs.
Click here to export our Data APIs into your Postman collections.