Push API

Overview

Push API is used to:

  • Create campaigns (targeting all users or a group of users) to send notifications.
  • Target a single user using a unique user attribute.
  • Personalize payload for each user.

API Endpoint

Method: POST

API Endpoint
https://pushapi-0X.moengage.com/v2/transaction/sendpush

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.

Authentication

The API request will be authenticated through Basic Authentication. Basic Authentication sends a Base64-encoded string containing your username and password with every API request. It encodes a 'username: password' string in Base64 and appends the encoded string with 'Basic '. This string is included in the authorization header as shown below:

{"Authorization":"Basic Base64_ENCODED_APPKEY_APIKEY=="}

You can obtain the username and password details from the MoEngage dashboard.

  1. On the left navigation menu in the MoEngage dashboard, go to Settings > Account > APIs.
  2. Copy the following details:
    • Username: Under Workspace ID (earlier app id), click the copy icon to copy the username.
    • Password: In the API keys section, click the copy icon in the Push templates tile to copy the API key.
  3. Use these details to authenticate the API requests.

Request Headers

Key Required  Sample Values Description

Content-Type

Required {"Content-Type": "application/json"} Set the Content-Type header to application/json.
Authorization Required {"Authorization":"Basic Base64_ENCODED_APPKEY_APIKEY=="} This authentication parameter, used for access control, must be passed in the request. For more information on generating the authentication header, refer to Authentication.
MOE-APPKEY Required {“MOE-APPKEY”: “Workspace ID”}

This is the workspace ID (earlier APP ID) of your MoEngage workspace. The MOE-APPKEY must be passed in the request. You can find your MoEngage Workspace ID in the MoEngage dashboard:

SettingsAccountAPIs -> Workspace ID (earlier app id)

For more information, refer to Authentication.

Request Body

Key Required Values Description
appId Required String This field denotes the app ID that you must pass to create the campaign. You can find it by selecting Settings > Account > APIs > API keys > Push tile on the MoEngage dashboard. MoEngage recommends that you test API integration in the Test Environment. The App ID for TEST ACCOUNT is suffixed with _DEBUG.
campaignName Required String

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.

campaignTags Optional 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“]
signature Required String

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

Python code to generate the signature for your test account, use the app_id that is appropriate for your account.

PushAPI_Transaction_Push_Settings.jpg

Python 3.xPython 2.x
from hashlib import sha256
app_id = "XXXXXXXXXXXXXXXXXXXXXX_DEBUG" #(Please refer to required parameters section)
campaign_name = "TEST"
api_secret = "XXXXXXXXXXXX" # This is the sample key. Each app has a different secret key
signature_key = app_id+'|'+ campaign_name+'|'+ api_secret
signature = sha256(signature_key.encode('utf-8')).hexdigest()
print(signature)

Generated Signature:

Signature
Generated Signature: 
bc52a205a64d18d9978d9532a59f6302e2a5745bd1fda05929dd6f044a9fb7b3
requestType Optional String The value of this key is used to indicate the intention of an API request. The default value is push.
targetPlatform Required List 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.
targetAudience Required String

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.
targetUserAttributes Optional JSON Object

This object contains the target user attribute details. For more information, refer to Target User Attributes.

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.
payload Required JSON Object 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 Required String

This field helps decide when the campaign should be sent.

Note

  • All notifications targeted to a single user will be sent as soon as possible (ASAP).
  • Scheduling campaigns for Later or Periodic is applied only for segmented or All users campaigns.
  • The timezone field can be used to pass the timezone for scheduled campaigns. This is not mandatory, and if it is not passed, the default timezone will be set to IST (and not UTC/GMT).
  • For more information on allowed timezone values, refer here.
ASAP Schedule Later Recurring Campaigns
// send campaign asap
"campaignDelivery": {
    "type": "soon"
  },
conversionGoals Optional JSON Object

This object contains the conversion goals details. For more information, refer to Conversion Goals.
Note:

  • You can pass a single conversion goal or multiple conversion goals.
  • If you are passing multiple conversion goals, the first conversion goal in the list is considered the primary conversion goal for the campaign.
  • A Push campaign supports a maximum of five conversion goals on its list.
advancedSettings Optional JSON Object This object contains information about advanced settings. For more information, refer to Advanced Settings.

Target User Attributes

Key Required Values Description
attribute Optional  String

This field denotes a unique identifier or characteristic of an entity or object used to specify the target users. This value is required when the targetAudience value is User. Other fields used are:

  • for unique ID: USER_ATTRIBUTE_UNIQUE_ID
  • for email:  USER_ATTRIBUTE_USER_EMAIL
  • For mobile number: USER_ATTRIBUTE_USER_MOBILE
  • for Google Advertising identifier: MOE_GAID
  • for iOS Identifier for advertising: ADVERTISING_IDENTIFIER
  • for device push token: PUSH_ID (the same key is used for Android GCM ID, iOS push token)
comparisonParameter Optional String

This field denotes a condition or operator that compares the user attributes against a specific value. Supported values are:

  • The "is" query type
  • The "in" query type

Note: The maximum number of parameters that can be added while using the "in" comparisonParameter is 50. This value is required when the targetAudience value is User.

attributeValue Optional String This field denotes the actual value assigned to an attribute, which is used for comparison or filtering. This value is required when the targetAudience value is User.
isCustom Optional Boolean This field denotes whether a custom attribute has been added. For custom attributes, targeting is done on any custom attribute with the available fields. Set the key "isCustom" to true.

Android

Key Required Values Description
message Required String This field denotes the main content or text to be displayed in the notification/message.
title Required String This field denotes the headline or subject of the notification/message.
channel_Id Optional String This field denotes the channel identifier for the campaign.
summary Optional String This field denotes the brief summary or condensed version of the content. Typically displayed in collapsed notifications.
richContent Optional list An object or HTML string containing rich text, images, or other multimedia to enhance the message. Supported values are:
  • Coupon
  • Image
  • Sound
defaultAction Optional list This helps you define the default action triggered when the user interacts with the notification.
additionalActions Optional list This object contains a list of extra actions or buttons that the user can perform, providing more functionality for the notification. Supported actions are:
  • Call
  • Snooze
  • Copy
  • Share

A maximum of two additional action buttons can be used at a time.

fallback Optional JSON Object This JSON object contains the fallback values for the values mentioned above.

iOS

Key Required Values Description
message Required String This field denotes the primary text or body of the notification/message.
title Required String This field denotes the title or subject line of the notification/message.
subtitle Optional String This field denotes the subtitle of the notification/message.
contentAvailable Optional Integer Used for updating the iOS app’s badge count with push notifications. Supported values are 0 or 1.
richContent Optional list

This field denotes a resource, such as an image or multimedia attachment, to provide additional visual or interactive elements. Supported contents are:

  • Coupon
  • Sound
  • Image
  • Audio
  • Video

Image, video, and audio are only supported after iOS-10.
To use emoticons (emojis), just copy-paste it where required (for example, ❤️ )
Note: Image, video, and audio can not be used together.

defaultAction Optional list

This object contains a set of default actions associated with the notifications. Supported values are:

  • Navigation
  • Richlanding
  • Deeplinking
additionalActions Optional list This object contains a set of supplementary actions or buttons associated with the notification, enabling users to perform specific tasks. You can add only one category for additional actions.
fallback Optional JSON Object This JSON object contains the fallback values for the values mentioned above.

Web

Key Required Values Description
message Required String This field denotes the main text content or notification body displayed to users.
title Required String This field denotes the subject or heading of the notification.
redirectURL Required String This field denotes the URL to which the user will be redirected upon interacting with the notification.
iconURL Required String This field denotes the URL of an icon image representing the notification, usually displayed alongside the title and message.
imageURL Optional String This field denotes the URL of an additional image to be shown in the notification, providing further context or visual appeal.
autoDismiss Optional Boolean This field specifies whether to dismiss the notification automatically after 8 seconds.
fallback Optional JSON Object This JSON object contains the fallback values for the values mentioned above.

Conversion Goals

Key Required Values Description
name Required String This field denotes the readable name of the conversion goal for the Campaign Info.
eventName Required String This field denotes the actual event name.
attrs Optional Array

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.

The following are the supported filter types:

String Event Attribute Filter Operators Number or Double Event Attribute Filter Operators
  • is
  • is not
  • contains
  • does not contain
  • starts with
  • does not start with
  • ends with
  • does not end with
  • in the following
  • not in the following
  • exists
  • does not exist
  • is equal to
  • is not equal to
  • is between
  • is not between
  • is less than
  • is greater than
  • exists
  • does not exist

conversionGoals

The following are sample payloads for the conversionGoals key:

Single Conversion Goals vs. Multiple Conversion Goals

You can pass a single conversion goal or multiple conversion goals. If you are passing multiple conversion goals, the first conversion goal in the list is considered the primary conversion goal for the campaign. A Push campaign supports a maximum of five conversion goals on its list.

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

Without Event Attribute Filter

Event attributes are optional. You can track a conversion goal just with an event name (without any event attribute). The following is a sample payload without the event attribute filter:

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

With String Event Attribute Filter

The following are sample payloads with string event attribute filters:

With "is" operator With "is not" operator
{
  "name": "Added To Cart",
  "eventName": "AddedTocart",
  "attrs": {
      "name": "product_sku",
      "filter": "is",
      "value": "10089712",
      "type": "string"
      }
}
With "contains" operator With "does not contain" operator
{
  "name": "Added To Cart",
  "eventName": "AddedTocart",
  "attrs": {
      "name": "product_sku",
      "filter": "contains",
      "value": "10089712",
      "type": "string"
      }
}
With "starts with" operator With "does not start with" operator
{
  "name": "Added To Cart",    
  "eventName": "AddedTocart", 
  "attrs": {                  
      "name": "product_sku",  
      "filter": "starts with",         
      "value": "10089712",    
      "type": "string"        
      }
}
With "ends with" operator With "does not end with" operator
{
  "name": "Added To Cart",    
  "eventName": "AddedTocart", 
  "attrs": {                  
      "name": "product_sku",  
      "filter": "ends with",         
      "value": "10089712",    
      "type": "string"        
      }
}
With "in the following" operator With "not 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 "exists" operator With "does not exist" operator
{
  "name": "Added To Cart",
  "eventName": "AddedTocart",
  "attrs": {                 
      "name": "product_sku", 
      "filter": "exists",    
      "type": "string"       
      }
}

Note: The “value“ key is not present here.

With Numeric/Double Event Attribute Filter

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

Note: The “value“ key has a comma-separated string value.

With "is greater than" operator With "is less than" operator
{
  "name": "Added To Cart",    
  "eventName": "AddedTocart", 
  "attrs": {                  
      "name": "product_price",  
      "filter": "is greater than",         
      "value": 999,
      "type": "numeric"
      }
}
With "exists" operator With "does not exist" operator
{
  "name": "Added To Cart",
  "eventName": "AddedTocart",
  "attrs": {                 
      "name": "product_price", 
      "filter": "exists",    
      "type": "numeric"       
      }
}

Note: The “value“ key is not present here.

Advanced Settings

Key Required Values Description
ttl Optional JSON Object This field denotes the duration for which the push notification service keeps a push message before it's discarded if it can't be delivered. If not delivered, Push Services (GCM/WEB) retry to send the message until the TTL (in minutes) does not expire. Send ‘0’ if it is not applicable to you. After the TTL has expired, push notifications will not be shown to the user. The default value for TTL is 36 mins and applies only to Android push or Web push notifications.
ignoreFC Optional String

This field denotes if the ignoreFC is enabled. Supported values are:

  • true
  • false

Note: This field is case-sensitive. When passing the value in the request, follow the case as described in the allowed values above.

  • "true" value: Bypasses frequency capping set on the dashboard and sends the notifications to everyone in the target segment.
  • "false" value: Applies the frequency capping set on the dashboard and does not send the notification after the limit is reached.
  • If the key is not present, it will be treated as ignoreFC="false." While testing your API, ensure that you set this flag as "true"; otherwise, you might not receive a few notifications.
countFC Optional String

This field denotes if the countFC is enabled. Supported values are:

  • true
  • false

Values are "true" or "false" only when ignoreFC value is set to true.

  • "true" value - Only Push campaigns are counted in the frequency cap count.
  • "false" value - Push campaigns are not counted in the frequency cap count.
notificationPrioritySettings Optional JSON Object This field denotes whether the notification priority settings are configured. Supported values are "true" or "false" only for Android push / Web push notifications. It uses the GCM/FCM flag to send time-critical messages with high priority and drains the user's device battery more than normal messages. This object contains information about notification priority settings. For more information, refer to notificationPrioritySettings.
pushAmp+ Optional String This field denotes whether the pushAmp+ is enabled. Supported values are "true" or "false." For more information about Push Amp+, refer to Push Amp+ help documentation.
preCacheSegment Optional String This field denotes whether the preCacheSegment is enabled. Supported values are "true" or "false." Applicable for scheduled and periodic campaigns. If enabled, pre-caches the segmentation and improves campaign sending time. For caching, it is recommended that the campaign be created at least 2 hours before the scheduled time.
campaignThrottleTime Optional Intg This field denotes if the campaign throttle time is configured. Push throttling allows you to control the rate of sending a push notification. The value to be passed can be between 1 and 360 (minutes).
campaignThrottleRpm Optional Intg

The default throughput for the Push API is 100K RPM. You can send either of the key-value pairs in the Push API payload between campaignThrottleRpm and campaignThrottleTime. Both of the key-value pairs are optional.

  • If you send both, the value for campaignThrottleRpm takes precedence over the value for campaignThrottleTime.
  • If you send either of them, the value you send is considered.
  • If you do not send any of them, the value defined in settings is considered (the Limit to <> Push notifications per minute setting at Settings > Channels > Delivery controls > Throttling > Campaign Throttling Limits > Push). If the RPM value is defined in settings, the defined value is considered.
  • If the RPM value is not defined in settings, the default RPM for Push channel (that is, 100K) is enforced.
    For personalized campaigns, the maximum RPM value MoEngage supports is 250K.
useJinjaPersonalization Optional String

This field denotes whether Jinja personalization can be used in the payload. Values are "true" or "false." A boolean value is used to indicate if Jinja personalization is applied to the message payloads. It is recommended that this personalization format be used. For example, you can add the following Jinja code to personalize the user name.
"title": "Hello {{UserAttribute['userName']}}"

ignoreMinimumDelay Optional String

This field denotes whether ignore minimum delay is enabled. Supported values are "true" or "false." This is a boolean value to indicate if the Client level Minimum Delay setting should be applied for the campaign. The default value is true, if this field is not passed in the API.

inboxExpiry Optional Integer This field specifies the expiry value for the push notification in hours.
iOSTargetDevice Optional String

Supported values are:

  • apns_device_default_push
  • apns_device_provisional_push
  • apns_device_non_provisional_push
deliverWhenActive Optional String

This field specifies whether the push notifications will be delivered when the device is in an active state. supported value: "true" and "false".

bypassDND Optional Boolean

This field specifies whether to deliver the notification immediately, bypassing device restrictions such as battery optimizations or low-power modes.

notificationPrioritySettings

Key Required Values Description
Android Optional String

This field denotes the notification priority configured for Android devices for this campaign.
Supported values are:

  • High
  • Low
iOS Optional Integer

This field denotes the notification priority configured for iOS devices for this campaign. Supported values are:

  • 1
  • 5
  • 10

Response Codes

 

Status Code Request State Error Description
200 Success NA This response is returned when the request is processed successfully.
Invalid JSON This response is returned when an incorrect JSON format is passed.
Invalid Request Type This response is returned when an invalid request type is passed, that is, other than push.
Invalid appId This response is returned when no dashboard exists for the given app ID.
appId is not present This response is returned when appID is missing in the request.
Please specify a campaign name of more than or equal to 5 characters This response is returned when the campaign name is less than 5 characters.
Request limit exceed. This response is returned when the dashboard is blocked for push API.
Campaign name is missing This response is returned when the campaign name is missing in the request.
Signature is missing This response is returned when the signature is missing in the request for Push API.
Signature is not verified This response is returned when the signature is incorrect. Verify the app secret and campaign name while generating signature.
key is Mandatory This response is returned when the key is missing from the payload.
Campaign With this name already exists. For targetAudience type All User or Custom Segment you can't create campaign with same campaign previous name This response is returned when the campaign name already exists. Try a new campaign name.
key is not of Type List This response is returned when the key contains a value that is not supported. 
value is not a allowed value. Allowed values for this field are : example This response is returned when the key contains a value that is not supported.
Failed to get all whitelisted event list This response is returned when failed to get all whitelisted action from the data-team management team.
Custom Segment Name: s_name not found in our database.Please verify same on Dashboard This response is returned when the defined custom segment is not found in the MoEngage database.
error or set isCustom to True. This response is returned when the defined user attribute is not among the allowed types when the is_custom is set to false.
Selected Attribution window is not within limits (1 - 36 hours) This response is returned when the Selected attribution window is not within limits (1 - 36 hours).
Error parsing parameters This response is returned when some value in the payload fails in parsing.

Sample cURL Request

cURL
curl --location 'https://pushapi-0X.moengage.com/v2/transaction/sendpush\
      --header 'content-type: application/json' \
      --header 'MOE-APPKEY: {{Workspace_ID or APP_ID}}' \
      --header 'Authorization: Basic {{Authorization_Key}}' \
      --data '{
      "appId": "ABC123",
      "campaignName": "Test_Campaign",
      "signature": "{{Signature}}",
      "requestType": "push",
      "targetPlatform": [
      "ANDROID"
      ],
      "targetAudience": "User",
      "targetUserAttributes": {
      "attribute": "USER_ATTRIBUTE_USER_EMAIL",
      "comparisonParameter": "is",
      "attributeValue": "abc@example.com"
} , "payload": { "ANDROID": { "message": "this is message", "title": "this is title", "Summary": "this is summary", "richContent": [ { "type": "image", "value": "https://images.iimg.in/c" } ], "defaultAction": { "type": "richlanding", "value": "https://www.moengage.com" }, "additionalActions": [ { "type": "call", "value": "123123", "name": "call button", "iconURL": "abc" } ] }, "IOS": { "message": "this is ios message", "title": "this is ios title", "richContent": [ { "type": "sound", "value": "custSound4.wav" } ], "additionalActions": [ { "category": "INVITE_CATEGORY" } ] }, "WEB": { "message": "this is web message", "title": "this is web title", "redirectURL": "https://www.google.com", "iconURL": "sbc.jpeg", "imageURL": "https://cdn.dribbble.com/users/146881/screenshots/1180383/despicable_me_1x.jpg" } }, "campaignDelivery": { "type": "soon" }, "conversionGoals": [ { "name": "amount1", "eventName": "AddedTocart", "attrs": { "filter": "is between", "name": "amount", "value": "10,100", "type": "numeric" } } ], "advancedSettings": { "ttl": { "ANDROID": 12, "WEB": 24 }, "ignoreFC": false, "sendAtHighPriority": true, "inboxExpiry": 360 } }

Sample Response

Response
{
      "requestId": "{{requestId}}",
      "responseId": "{{responseId}}",
      "cid": "{{cid}}",
      "status": "Success"
      }

Response Body

Key Values Description
requestId string This field indicates the request ID.
responseId string This field indicates the response ID.
cid string This field indicates the campaign ID.
status string This field indicates the campaign status.

Response Code Structure

Success Failure
{
      "requestId": "{{requestId}}",
      "responseId": "{{responseId}}",
      "cid": "{{cid}}",
      "status": "Success"
      }

Rate Limit

You can create 10000 requests per minute.

Sample Payloads Examples

Here are the sample payloads across different platforms (Android, iOS, and Web).

Example 1

Android app iOS app web (Chrome Push)
"ANDROID": {
      "message": "Message", // Message of the push notification
      "title": "Title", // Title of the push notification 
  		"channel_id": "ChannelId", // Channel id of push notification (Optional)
      "richContent": [ //List of rich content items. Android push notifications have support  Image, Coupon and Sound. One single notifcation can support all combinations of these three types of rich content.
        {
          "type": "image",
          "value": "https://images.iimg.in/c" 
        },
        {
          "type": "coupon", 
          "value": "free" // when user click notifications, this code will be copied.
        },
        {
          "type": "sound",
          "value": "tring"
        }
      ],
      "defaultAction": { // Default action when user click on notifications. 
        "type": "richlanding", // Type of the default action
        "value": "https://www.google.co.in/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8 ",
        "kvPairs" :{ // additional key value pairs to be passed while sending notification.
        		"key1" : "value1",
        		"Key2" : "value2"
         }
      },
      "additionalActions": [ // List of action buttons. Maximum 2 buttons are allowed.
        {
          "type": "call",// action type
          "value": "12345678", // respective value
          "name": "Call button", // action name, displayed on notification
          "iconURL": "abc" // url for icon to be displayed
        },
        {
          "type": "copy", // action type
          "value": "12345678", // respective value
          "name": "Copy button", // action name, displayed on notification
          "iconURL": "abc" // icon url
        }
      ],
      "fallback": { // Complete replica of the android dict, in case a personalization is failed, this message content will be sent.
      }
    },

Example 2

This is a sample payload to target all users for each platform and also all platforms.

Android app iOS app web (Chrome Push) Across all platforms
{
  "appId": "XXXXXXXXXXXXXXXXXXXXXXXX",
  "campaignName": "Test Push", // Name of the campaign.
  "campaignTags": ["Transactional"],
  "signature": "d7d28929ba474edf293b7c892efe22ec0e426ab1ba242b50c96f3126b9285385",
  "requestType": "push", // Type of request (push)
  "targetPlatform": [
    "ANDROID"
  ],
  "targetAudience": "All Users",
  "payload": {
    "ANDROID": { // Android Payload, detailed is described above
      "message": "Android Message",
      "title": "Android Message Title",
      "Summary": "Android Summary",
      "richContent": [
        {
          "type": "image",
          "value": "https://images.iimg.in/c"
        },
        {
          "type": "coupon",
          "value": "free"
        },
        {
          "type": "sound",
          "value": "tring"
        }
      ],
      "defaultAction": {
        "type": "richlanding",
        "value": "https://www.google.co.in/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8 "
      },
      "additionalActions": [
        {
          "type": "call",
          "value": "12345678",
          "name": "Call button",
          "iconURL": "abc"
        },
        {
          "type": "copy",
          "value": "12345678",
          "name": "Copy button",
          "iconURL": "abc"
        }
      ]
    }
  },
  "campaignDelivery": { 
    "type": "soon", //values can be - soon/later/periodic; if later/periodic, please provide respective values as well.
  },
  "conversionGoals": [
    {
      "name": "amount 1",
      "eventName": "AddedTocart",
      "attrs": {
        "filter": "is between",
        "name": "amount",
        "value": "10,100",
        "type": "numeric"
      }
    }
  ],
  "advancedSettings": {
    "ttl": {
      "ANDROID": 12 // the ttl for both Android and iOS platforms are tracked in ANDROID field. 
    },
    "ignoreFC": "false",
    "sendAtHighPriority": "true",
    "inboxExpiry": 360  //in hours

  }
}

Example 3

This example shows different payloads to target different segments of users.

Target Single User Target Custom SegmentCustom Attribute Target All Users
{
  "appId": "XXXXXXXXXXXXXXXXXXXXXXXX",
  "campaignName": "Test Push", // Reuse this campaign name for requests that should be clubbed in the same campaign.
  "signature": "d7d28929ba474edf293b7c892efe22ec0e426ab1ba242b50c96f3126b9285385",
  "requestType": "push", // Type of request (push)
  "targetPlatform": [
    "ANDROID"
  ],
  "targetAudience": "User",
  "targetUserAttributes":{
    "attribute": "USER_ATTRIBUTE_USER_EMAIL",
    "comparisonParameter": "is",
    "attributeValue": "abc@example.com"
  },
  "payload": {
    "ANDROID": { // Android Payload, detailed is described above
      "message": "Android Message",
      "title": "Android Message Title",
      "Summary": "Android Summary",
      "richContent": [
        {
          "type": "image",
          "value": "https://images.iimg.in/c"
        },
        {
          "type": "coupon",
          "value": "free"
        },
        {
          "type": "sound",
          "value": "tring"
        }
      ],
      "defaultAction": {
        "type": "richlanding",
        "value": "https://www.google.co.in/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8 "
      },
      "additionalActions": [
        {
          "type": "call",
          "value": "12345678",
          "name": "Call button",
          "iconURL": "abc"
        },
        {
          "type": "copy",
          "value": "12345678",
          "name": "Copy button",
          "iconURL": "abc"
        }
      ]
    }
  },
  "campaignDelivery": { 
    "type": "soon" //values can be - soon/later/periodic; if later/periodic, please provide respective values as well.
  },
  "conversionGoals": [
    {
      "name": "amount 1",
      "eventName": "AddedTocart",
      "attrs": {
        "filter": "is between",
        "name": "amount",
        "value": "10,100",
        "type": "numeric"
      }
    }
  ],
  "advancedSettings": {
    "ttl": {
      "ANDROID": 12 // the ttl for both Android and iOS platforms are tracked in ANDROID field. 
    },
    "ignoreFC": "false",
    "sendAtHighPriority": "true",
    "inboxExpiry": 360  //in hours

  }
}

Example 4

This payload describes the sample for the push API response payload.

Sample Response
// sample success push respons payload
{
 "status": "Success",// shows valid request and accepted for processing
 "responseId": "cd13199a-0f70-4bf2-9c54-99879eefae76",
 "requestId": "",
 "cid": "581e08281069b855c03576d2"
}

// sample failure push response payload
{
 "status": "Fail", // shows invalid request
 "Error_Message": "Campaign Name not found", // reason of failure
 "responseId": "5612064a-24fa-4e8c-9e8a-c1c4221fe0ea",
 "requestId": "", 
}

Postman Collection

We have made it easy for you to test the APIs. Click here to view it in Postman.

Previous

Next

Was this article helpful?
7 out of 18 found this helpful

How can we improve this article?