The Sample Moe Developer Hub

Welcome to the Sample Moe developer hub. You'll find comprehensive guides and documentation to help you start working with Sample Moe as quickly as possible, as well as support if you get stuck. Let's jump right in!

Search results for "{{ search.query }}"

No results found for "{{search.query}}".

API for Daily Campaign Report

Campaign Report for a particular date can be easily downloaded programmatically by a REST API. This feature only provides campaign data for a single date at a time. For downloading data spanning across many days please refer here.

Configure Dashboard Settings

In the settings section of Dashboard, you can find Reports Settings.

  1. Enable the campaign reports.
  2. You can select the report to be sent via email or to be downloaded through REST API.
  3. You can also select the time at which Report should be generated or emailed.

How to make the API Call

API call is a GET request. Url for the API is given below -

https://api.moengage.com/dailyCampaignReportDump/[YOUR-API-ID-HERE]/[FILENAME-HERE]?Signature=<GenerateSignature>
  • Replace [YOUR-API-ID-HERE] with the API-ID found under "APP Settings" of Moengage dashboard
  • Filename should be of format YYYYMMDD.zip
  • Generating the signature is explained below.

For Example, the following link will download the Campaign report of 2nd March 2016.

https://api.moengage.com/dailyCampaignReportDump/MAZWRTYIMMSH5H67C3T9RTHS/20160302.zip?Signature=<GenerateSignature>

Generating Signature for the API Request

To verify the authenticity of the caller and validity of the request, we require a unique signature which 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 along with the API-ID ).

# 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

Sample API

Sample API will look like this -

https://api.moengage.com/dailyCampaignReportDump/MAZWRTYIMMSH5H67C3T9RTHS/20160302.zip?Signature=2aca4dcb53a2ed026a60173b67cebb1f2875a47ac5fe06ca5aa478b93606b532

Response of the API call will automatically download the file for you, in case of failure you will see a JSON Response explaining the reason for failure.

You can test the API with a simple wget -

wget -O test.zip https://api.moengage.com/dailyCampaignReportDump/MAZW5N1IMMSH5H67C3T9KBHA/20160914.zip?Signature=838fe32cf4882860b0109ed371b1bf380ad640292b8178e9af129706ecfd24fe

How it works

After you enable the report settings in the dashboard, our system generates the daily report according to the schedule. Previous days campaign reports are not calculated. Please put a buffer time from the scheduled time, to pull the reports via API. There is no expiry for the reports generated.

API for Daily Campaign Report