Push API
This API creates and sends a push notification campaign. You can use this API to create campaigns (targeting all users or a group of users) to send notifications, target a single user using a unique user attribute, and personalize payload for each user.
This endpoint accepts three request headers: X-MOE-APPKEY (your Workspace ID), X-MOE-PushAPI-Signature (the authorization signature), and X-MOE-Query-Type (the target audience, corresponding to the targetAudience field in the request body).
Rate Limit
The rate limit is 10,000 requests per minute.
Headers
This is the Workspace ID of your MoEngage account that must be passed with the request. You can find it in the MoEngage dashboard at Settings > Account > APIs > Workspace ID (earlier app id). MoEngage recommends that you test API integration in the Test Environment. The App ID for TEST ACCOUNT is suffixed with _DEBUG.
This field denotes the signature that is required to verify whether the client is authorized to make the API call. It is generated from a hash of the campaign name, app ID, and API key, using the SHA 256 method.
- On the left navigation menu in the MoEngage dashboard, go to Settings > Account > APIs.
- Copy the following details:
- app_id: Under Workspace ID (earlier app_id), click the copy icon to copy the app-id.
- api_key: In the API keys section, click the copy icon in the Push tile to copy the API key.
- campaign_name: Ensure the campaign name matches the one used in the request body.
Generate Authentication Signature
Python code to generate the signature for your test account, use the app_id that is appropriate for your account.
Python 3.XX:
Python 2.XX:
Send this signature value in the X-MOE-PushAPI-Signature request header.
This field mirrors the targetAudience field in the request body, but uses lowercase values. For example, when targetAudience is "User", send X-MOE-Query-Type: user.
all users, user, custom segment Body
The complete configuration for the push campaign.
This field denotes the campaign name. The campaign name should be unique for All Users and Custom Segment campaigns. Note:
- API automatically creates a campaign with the given name. You need not create a campaign from the dashboard to use the name.
- For User type targetAudience API requests, reuse this campaign name for requests that should be clubbed in the same campaign.
5This field denotes the platform devices that are targeted by your campaign. The Push API allows you to target users on Android, iOS, and Web platforms. You can target one or more platforms. If you want to send Web (Chrome) push notifications through the API, you should choose Web as the platform.
ANDROID, IOS, WEB This field denotes the target segment for the campaign. Supported values are:
- All Users: Pass this value to target all users of your App/Website.
- Custom Segment: Pass this value to target pre-created user segments. Custom segments can be created using the MoEngage dashboard or custom segment API. Note that the custom segment name should exactly match the name of the target segment.
- User: Pass this value to target a user with an attribute. It will target a maximum of 100 users of the associated targetUserAttributes definition.
All Users, Custom Segment, User This field helps decide when the campaign should be sent.
ASAP
Schedule Later
Recurring Campaigns
Used to add more context to campaigns. Context can be descriptive names or campaign themes such as onboarding, retention, country, and all users. Tags can also be used to filter campaigns or identify the behaviors of users who received these campaigns. The list of tags should be passed in this field.
For example,
The value of this key is used to indicate the intention of an API request. The default value is push.
Required if targetAudience is 'Custom Segment'.
This object contains the target user attribute details. Note:
- This value is required when the targetAudience value is User.
- For API requests where the target audience is a specific user, if a campaign with the given name already exists, existing campaign data corresponding to the given name will be used to send notifications.
- Any edits in other parts of campaign data except payload within the API request parameters will be ignored.
- If any changes are required in the campaign data, change the campaign name in the API request to create a new campaign.
This object contains the conversion goals details. This field denotes the event attribute filters. It contains the following elements:
- name: Event attribute name. This is mandatory.
- filter: Event attribute filter operator. This is mandatory.
- value: Event attribute filter value.
- type: Event attribute data type. This is mandatory.
Single Conversion Goal
Multiple Conversion Goals
Without Event Attribute Filter
With String Event Attribute Filter
With "is" operator:
With "is not" operator:
With "contains" operator:
With "does not contain" operator:
With "starts with" operator:
With "does not start with" operator:
With "ends with" operator:
With "does not end with" operator:
With "in the following" operator:
With "not in the following" operator:
With "exists" operator:
With "does not exist" operator:
With Numeric/Double Event Attribute Filter
With "is equal to" operator:
With "is not equal to" operator:
With "is between" operator:
With "is not between" operator:
With "is greater than" operator:
With "is less than" operator:
With "exists" operator:
With "does not exist" operator:
5This object contains information about advanced settings. For more information, refer to Advanced Settings.
Response
Request received. The status in the response body indicates whether it was successfully processed or failed. Possible failures include:
- Invalid Request Type
- Invalid appId / appId not present
- Campaign Name too short (must be >= 5 chars) / Campaign name missing
- Request limit exceeded
- Signature missing or not verified
- Duplicate campaign name
- Key not of Type List or Value not allowed
- Error parsing parameters
Response fields:
status:SuccessorFail, indicating whether the campaign was accepted.requestId: The request ID you sent, echoed back (empty on failure).responseId: A unique ID MoEngage generates for this response.cid: The campaign ID (present on success only).Error_Message: A human-readable failure reason (present on failure only).
This response envelope (status, requestId, responseId, cid) predates MoEngage's newer API conventions (for example, the {response_id, type, data} shape used by the Analytics Custom Dashboards API) and is kept as-is for backward compatibility with v2.