Skip to main content
POST
/
transaction
/
sendpush
curl --location 'https://pushapi-0X.moengage.com/v2/transaction/sendpush' \
--header 'Content-Type: application/json' \
--data '{
"appId": "{{your Workspace ID}}",
"campaignName": "{{your campaign name}}",
"signature": "{{Signature}}",
"requestType": "push",
"targetPlatform": ["ANDROID"],
"targetAudience": "User",
"targetUserAttributes": {
"attribute": "USER_ATTRIBUTE_USER_EMAIL",
"comparisonParameter": "is",
"attributeValue": "[email protected]"
},
"payload": {
"ANDROID": {
"message": "message",
"title": "title"
}
},
"campaignDelivery": { "type": "soon" }
}'
{
"status": "Success",
"requestId": "09562729-236b-4773-8207-63321523456",
"responseId": "09562729-236b-4773-8207-63321523456",
"cid": "66321523456"
}

Rate Limit

The rate limit is 10,000 requests per minute.

Authentication

A signature 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. MoEngage uses the SHA 256 method to generate this hash. Python code is used to generate the signature for your test account, and use your account’s app_id.
  1. On the left navigation menu in the MoEngage dashboard, go to Settings > Account > APIs.
  2. 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.

Generating Signature

Python code to generate the signature for your test account, use the app_id that is appropriate for your account.
from hashlib import sha256
app_id = "{{Your Workspace ID}}"
campaign_name = "{{your campaign name}}"
api_key = "{{your push api key}}"
signature_key = app_id+'|'+ campaign_name+'|'+ api_key
signature = sha256(signature_key.encode('utf-8')).hexdigest()
print(signature)

Body

application/json

The complete configuration for the push campaign.

appId
string
required

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.

campaignName
string
required

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.
Minimum string length: 5
signature
string
required

This field denotes the signature that is required to verify whether the client is authorized to make the API call. For more information, refer to Generate Authentication Signature.

targetPlatform
enum<string>[]
required

This 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.

Available options:
ANDROID,
IOS,
WEB
targetAudience
enum<string>
required

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.
Available options:
All Users,
Custom Segment,
User
payload
object
required

This object contains the payload details. Supported values are:

  • Android. For more information, refer to Android.
  • iOS. For more information, refer to IOS.
  • Web. For more information, refer to Web.
campaignDelivery
object
required

This field helps decide when the campaign should be sent.

ASAP

// send campaign asap
"campaignDelivery": {
"type": "soon"
}

Schedule Later

"campaignDelivery": {
"type": "later",
"date": "11/07/2016",
"time": "04:33 PM"
}

Recurring Campaigns

"campaignDelivery": {
"type": "periodic",
"endDate": "11/07/2016",
"time": "04:55 PM",
"timezone": "Asia/Calcutta",
"repeatAfter": "1" // campaign will be recurring sent after every 1 day.
}
campaignTags
string[]

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,

“campaignTags“ : [“Transactional“, “Accounts“]
requestType
string
default:push

The value of this key is used to indicate the intention of an API request. The default value is push.

customSegmentName
string

Required if targetAudience is 'Custom Segment'.

targetUserAttributes
object

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.
conversionGoals
object[]

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

"conversionGoals": [
{
"name": "Added To Cart",
"eventName": "AddedTocart",
"attrs": {
"name": "product_sku",
"filter": "is",
"value": "10089712",
"type": "string"
}
}
]

Multiple Conversion Goals

"conversionGoals": [
{
"name": "Added To Cart",
"eventName": "AddedTocart",
"attrs": {
"name": "product_sku",
"filter": "is",
"value": "10089712",
"type": "string"
}
},
{
"name": "Order Placed",
"eventName": "OrderSuccess",
"attrs": {
"name": "product_price",
"filter": "is equal to",
"value": 999,
"type": "numeric"
}
}
]

Without Event Attribute Filter

{
"name": "Added To Cart",
"eventName": "AddedTocart"
}

With String Event Attribute Filter

With "is" operator:

{
"name": "Added To Cart",
"eventName": "AddedTocart",
"attrs": {
"name": "product_sku",
"filter": "is",
"value": "10089712",
"type": "string"
}
}

With "is not" operator:

{
"name": "Added To Cart",
"eventName": "AddedTocart",
"attrs": {
"name": "product_sku",
"filter": "is not",
"value": "10089712",
"type": "string"
}
}

With "contains" operator:

{
"name": "Added To Cart",
"eventName": "AddedTocart",
"attrs": {
"name": "product_sku",
"filter": "contains",
"value": "10089712",
"type": "string"
}
}

With "does not contain" operator:

{
"name": "Added To Cart",
"eventName": "AddedTocart",
"attrs": {
"name": "product_sku",
"filter": "does not contain",
"value": "10089712",
"type": "string"
}
}

With "starts with" operator:

{
"name": "Added To Cart",
"eventName": "AddedTocart",
"attrs": {
"name": "product_sku",
"filter": "starts with",
"value": "10089712",
"type": "string"
}
}

With "does not start with" operator:

{
"name": "Added To Cart",
"eventName": "AddedTocart",
"attrs": {
"name": "product_sku",
"filter": "does not start with",
"value": "10089712",
"type": "string"
}
}

With "ends with" operator:

{
"name": "Added To Cart",
"eventName": "AddedTocart",
"attrs": {
"name": "product_sku",
"filter": "ends with",
"value": "10089712",
"type": "string"
}
}

With "does not end with" operator:

{
"name": "Added To Cart",
"eventName": "AddedTocart",
"attrs": {
"name": "product_sku",
"filter": "does not end with",
"value": "10089712",
"type": "string"
}
}

With "in the following" operator:

{
"name": "Added To Cart",
"eventName": "AddedTocart",
"attrs": {
"name": "product_sku",
"filter": "in the following",
"value": ["10089711", "10089712", "10089713"],
"type": "string"
}
}

With "not in the following" operator:

{
"name": "Added To Cart",
"eventName": "AddedTocart",
"attrs": {
"name": "product_sku",
"filter": "not in the following",
"value": ["10089711", "10089712", "10089713"],
"type": "string"
}
}

With "exists" operator:

{
"name": "Added To Cart",
"eventName": "AddedTocart",
"attrs": {
"name": "product_sku",
"filter": "exists",
"type": "string"
}
}

With "does not exist" operator:

{
"name": "Added To Cart",
"eventName": "AddedTocart",
"attrs": {
"name": "product_sku",
"filter": "does not exist",
"type": "string"
}
}

With Numeric/Double Event Attribute Filter

With "is equal to" operator:

{
"name": "Added To Cart",
"eventName": "AddedTocart",
"attrs": {
"name": "product_price",
"filter": "is equal to",
"value": 999,
"type": "numeric"
}
}

With "is not equal to" operator:

{
"name": "Added To Cart",
"eventName": "AddedTocart",
"attrs": {
"name": "product_price",
"filter": "is not equal to",
"value": 999,
"type": "numeric"
}
}

With "is between" operator:

{
"name": "Added To Cart",
"eventName": "AddedTocart",
"attrs": {
"name": "product_price",
"filter": "is between",
"value": "899,999",
"type": "numeric"
}
}

With "is not between" operator:

{
"name": "Added To Cart",
"eventName": "AddedTocart",
"attrs": {
"name": "product_price",
"filter": "is not between",
"value": "899,999",
"type": "numeric"
}
}

With "is greater than" operator:

{
"name": "Added To Cart",
"eventName": "AddedTocart",
"attrs": {
"name": "product_price",
"filter": "is greater than",
"value": 999,
"type": "numeric"
}
}

With "is less than" operator:

{
"name": "Added To Cart",
"eventName": "AddedTocart",
"attrs": {
"name": "product_price",
"filter": "is less than",
"value": 999,
"type": "numeric"
}
}

With "exists" operator:

{
"name": "Added To Cart",
"eventName": "AddedTocart",
"attrs": {
"name": "product_price",
"filter": "exists",
"type": "numeric"
}
}

With "does not exist" operator:

{
"name": "Added To Cart",
"eventName": "AddedTocart",
"attrs": {
"name": "product_price",
"filter": "does not exist",
"type": "numeric"
}
}
Maximum array length: 5
advancedSettings
object

This 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
status
enum<string>

This field indicates the campaign status.

Available options:
Success
requestId
string

This field indicates the request ID.

responseId
string

This field indicates the response ID.

cid
string

This field indicates the campaign ID.