Create Push Campaigns

You can use this API to create a push campaign in MoEngage.

info

Information

If this API is not enabled for your account, contact your CSM or raise a support ticket to request enablement.

API Endpoint

Method: POST

API Endpoint
https://api-0X.moengage.com/core-services/v1/campaigns

Each customer is hosted on a different data center; you can find your data center number (value of X) by checking the data center and API endpoint mapping page.

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

  1. Navigate 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 Campaign report/Business events/Custom 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 bmF2ZWVua3VtYXI6bW9lbmdhZ2U=="}

This authentication parameter, used for access control, must be passed in the request. To generate 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 has to be passed in the request. You can find your MoEngage Workspace ID in the MoEngage UI:

Settings -> Account -> APIs -> Workspace ID (earlier app id)

For more information, refer to Authentication.

Request Body

Key Required Values Description
request_id
Required String

This field denotes the request ID that you must pass to create the campaign.

Note: After you create a campaign successfully using a request ID, do not use it again for the next 1 hour. If campaign creation is unsuccessful, you can use the same request ID immediately again.

channel
Required String

This field denotes the type of channel. For push campaigns, the supported value is PUSH.

campaign_delivery_type
Required String

This field denotes the type of campaign based on delivery. Supported values are:

  • ONE_TIME
  • PERIODIC
  • EVENT_TRIGGERED
  • BUSINESS_EVENT_TRIGGERED
  • DEVICE_TRIGGERED
  • LOCATION_TRIGGERED
  • BROADCAST_LIVE_ACTIVITY
created_by
Required String This field denotes the Email ID of the user who created the campaign. Supported value is email ID only.
basic_details Required JSON Object This object contains the basic details of the campaign. For more information, refer to Basic Details.
trigger_condition Optional JSON Object This object contains the details of the trigger conditions defined for your campaign. For more information, refer to Trigger Condition.
campaign_content Required JSON Object This object contains the campaign content. For more information, refer to Campaign Content.
segmentation_details Required JSON Object

This object contains the segmentation details. For more information, refer to Segmentation Details.

scheduling_details Required JSON Object

This object contains the scheduling details. For more information, refer to Scheduling Details.

delivery_controls Required JSON Object

This object contains the delivery control details. For more information, refer to Delivery Controls.

advanced Required JSON Object

This object contains the advanced details. For more information, refer to Advanced.

conversion_goal_details Optional JSON Object

This object contains the conversion goal details. For more information, refer to Conversion Goal Details.

control_group_details Optional JSON Object This object contains the control group details. For more information, refer to Control Group Details.

Basic Details

The basic_details JSON object contains the following information:

Key Required Values Description
business_event Optional String

This field denotes the business event to be mapped to the campaign.

Note: This field is required for business event-triggered campaigns.

name Required String This field denotes the name of the campaign.
tags Optional Array

This field provides context about the campaigns and describes the nature of the campaign or the campaign's central theme.

team Optional String This field denotes the name of a group of users collaborating on the same campaign. For more information, refer to Teams.
platforms Required Array

The field denotes the name of the platform to target. Supported values are:

  • ANDROID
  • IOS
  • WEB
broadcast_live_activity_id Optional String

This field denotes the broadcast live activity ID of the campaign. This field is applicable when the platform is passed as iOS and the delivery type is passed as BROADCAST_LIVE_ACTIVITY.

geofences Optional JSON Object

This object contains the following information: 

Key Required Values Description
name Required String This field denoted the unique name of the geofence location being targeted.
latitude Required String This field denotes the latitude coordinate for the center of the geofence area.
longitude Required String This field denotes the longitude coordinate for the center of the geofence area.
radius Required  String This field denotes the radius, measured in meters, from the center point that defines the boundary of the geofence.
dwell_time_value Required String

This field denotes the numeric value for the time to wait before sending the message after the trigger condition is met.

Note: This field is required when the triggered_at value is set to dwell.

dwell_time_granularity Required String

This field denotes the time unit for the response_time_value (for example, "MINUTES", "HOURS", or "DAYS").

Note: This field is required when the triggered_at value is set to dwell.

response_time_value Required String This field denotes the numeric value for the time to wait before sending the message after the trigger condition is met.
response_time_granularity Required String This field denotes the time unit for the response_time_value (for example, "MINUTES", "HOURS", or "DAYS").
triggered_at Required String This field denotes the user action that triggers the campaign. The value can be "ENTRY" (when a user enters the geofence) or "EXIT" (when a user leaves the geofence).

Note: This field is required for location-triggered campaigns.

send_to_triggered_platform_only Optional Boolean

This field denotes whether the you wants to send the campaign to the triggered platform only. This field is applicable for push campaigns created with the event-triggered delivery type. 

platform_specific_details Required JSON Object

This object contains the following platform-specific details.

For Android:

Key Required Values Description
push_amp_plus_enabled Optional Boolean

This field denotes whether the push amp feature is enabled for this campaign. Supported values are:

  • true
  • false

The default value is false.

For iOS:

You must pass one of the following keys as true.

Key Required Values Description
send_to_all_eligible_device Required Boolean

This field denotes whether the campaign is sent to all eligible devices. Supported values are:

  • true
  • false
exclude_provisional_push_devices Required  Boolean

This field denotes whether the campaign is excluded from provisional push devices. Supported values are:

  • true
  • false
send_to_only_provisional_push_enabled_devices Required Boolean

This field denotes whether the campaign is only sent to provisional push-enabled devices. Supported values are:

  • true
  • false

Trigger Conditions

The trigger_condition is used for Event-Triggered campaigns. This JSON object contains the following information:

info

Information

The trigger_condition object is required only for Event-Triggered campaigns. For more information on creating Event-Triggered campaigns, refer here.

Key Required Values Description
included_filters Required JSON Object This object denotes the segmentation filters that help you choose the trigger condition for your campaign. For more information on the detailed segmentation payload and supported fields, refer to Create Custom Segment.
secondary_included_filters Optional JSON Object

This object denotes the segmentation filters that help you choose the secondary trigger condition for your campaign.

Note: Secondary include filters will be used when the secondary events are used in the event-triggered campaigns.

trigger_delay_type Required String

This field denotes the type of triggered delay. Supported values are:

  • DELAY
  • ASAP

Note: When you pass a DELAY value in this parameter, the following fields are mandatory:

  • trigger_delay_value
  • trigger_delay_granularity
  • trigger_relation
trigger_delay_value Required Integer This field denotes the value of the triggered delay.
trigger_delay_granularity Required String

This field denotes the granularity of the triggered delay. Supported values are:

  • DAYS
  • HOURS
  • MINUTES
trigger_relation Required String

This field denotes the trigger relation with a delay. Supported values are:

  • BEFORE
  • AFTER

Note: This field is required when the trigger_delay_type key is passed with the value DELAY.

trigger_attr Required JSON Object This object denotes the attribute value of the trigger.
intelligent_delay_optimization Optional JSON Object

This Object denotes the configuration object used when trigger_delay_type is INTELLIGENT_DELAY. It defines a time window (min/max delay) within which the system will find the optimal moment to send the message to maximize engagement.

This JSON Object contains the following information: 

  • min_delay_value: The field denotes the numeric component of the lower bound for the intelligent delay window.
  • min_delay_granularity: The field denotes the unit of time (for example, MINUTES or HOURS) that qualifies the min_delay_value.
  • max_delay_value: The field denotes the numeric component of the upper bound for the intelligent delay window.
  • max_delay_granularity: The field denotes the unit of time (for example, HOURS or DAYS) that qualifies the max_delay_value.

Campaign Content

The campaign_content JSON object contains the following information: 

Key Required Values Description
content Required JSON Object

This object contains the push JSON object, which denotes the platform-specific payload details for your campaign. For more information, refer to:

Android

The Android JSON object contains the following information: 

Key Required Values Description
template_type Required String

This field denotes the type of Android push template. Supported values are:

  • BASIC
  • STYLIZED_BASIC
  • SIMPLE_IMAGE_CAROUSEL
  • IMAGE_BANNER_WITH_TEXT
  • TIMER
  • TIMER_WITH_PROGRESS_BAR
  • Custom

Note: If you are passing a template ID, pass the template_type as "Custom".

basic_details Required JSON Object

This object contains the following information: 

Key Required Values Description Supported Templates

notification_channel

Required String

This field denotes the Android notification channel where the push will be sent (for example, "general").

All

include_app_name_and_time

 

Required String

This field denotes whether to include the application's name and the notification timestamp within the banner image.

Image banner text template

background_color_code

Required String

This field denotes the hex code for the notification's background color.

  • Stylized basic
  • Simple image carousel
  • Image banner text

app_name_color_code

Required String

This field denotes the hex code for the color of the application's name text.

  • Stylized basic
  • Simple image carousel
  • Image banner text

notification_control_color

Required String

This field denotes the hex code for the color of the notification's control elements, such as action buttons.

  • Stylized basic
  • Simple image carousel
  • Image banner text
include_title_and_message

 

Required String

This field denotes whether to include the notification's title and message text within the banner image.

Image banner text

apply_background_color_in_text_editor

Required String

This field denotes whether to apply the specified background color within the rich text editor, providing a visual preview.

  • Stylized basic
  • Simple image carousel
  • Image banner text
title Required String

This field denotes the main title of the push notification.

All

message Required String

This field denotes the message of the push notification.

All

summary Optional String

This field denotes the main title of the push notification.

All

image_url Optional String

This field denotes the image URL of the push notification.

All

image_scaling Required String

This field denotes the scaling behavior for images within the carousel template. Sample values are:

  • "FIT_INSIDE_IMAGE_CONTAINER"
  • "FILL_IMAGE_CONTAINER"
  • Simple image carousel
  • Image Banner with Text Overlay
banner_image_url Required String

This field denotes the URL for the background image used in the Image Banner Text template.

Image banner text

input_gif_url Optional String

This field denotes the URL for the GIF media used in the push campaign content.

Basic

collapsed_push_notification Required String

This field denotes the configuration for the notification's collapsed state, which is the view shown before the user expands it.

Image banner text

carousel_content Optional JSON Object

This field denotes the JSON object containing the data and settings for the image carousel, including transition effects and an array of slide data. For more information, refer carousel content.

Simple image carousel template

default_click_action Required String

This field denotes the action performed when the main body of the notification is clicked. Supported values are:

  • DEEPLINKING
  • NAVIGATE TO A SCREEN
  • RICH-LANDING

All

default_click_action_value Required String

This field denotes the URL or deep link to open when the notification is clicked.

All

key_value_pairs Optional Array

This field denotes the custom key-value pairs specific to this button's click event.

All

timer Optional JSON Object

This object contains the following information: 

Key Required Values Description
timer_ends_at Required String

This field denotes how the timer's endpoint is determined. "DURATION" means it will last for a fixed period from the time it is received.

specific_time Required String

This field is required when personalized_value is passed as true.

time_period Required String

This field is required when timer_ends_at is passed as:

  • SPECIFIC_TIME_USER_TIMEZONE
  • SPECIFIC_TIME_CAMPAIGN_TIMEZONE
personalized_value Required Boolean

This field specifies if the timer duration is personalized per user. If passed as false, it means all users get the same duration. 

duration_hour Required String

This field specifies the number of hours the timer will run for. This field is required when personalized_value is passed as false. Sample values: "0", "1", "2", "3".

duration_minute Required String

This field denotes the number of minutes the timer will run for (in addition to the hours). This field is required when personalized_value is passed as false. Sample values: "15", "20", "45".

Note: This field is required for campaigns created with the Timer and Timer with progress bar Android templates.

buttons Optional JSON Object

The object contains the following information: 

Key Required Values Description
btn_name Required String

This field denotes the text to be displayed on the button.

click_action_type Required String

This field denotes the type of action to perform when the button is clicked.

Supported values are:

  • DEEPLINKING
  • NAVIGATE TO A SCREEN
  • RICH-LANDING
  • CALL
  • SHARE
  • COPY
  • SET_USER_ATTRIBUTE
  • TRACK_EVENT
  • CUSTOM_ACTION
  • SNOOZE
  • REMIND_LATER
click_action_value Required String

This field denotes the URL or deep link to open for the button's action.

key_value_pairs Optional Array

This field denotes the custom key-value pairs specific to this button's click event.

advanced  Optional JSON Object

This object contains the following information: 

Key Required Values Description
coupon_code Optional String

This field denotes the coupon code to be included in the push payload.

icon_type_in_notification Required String

This field denotes the icon type to be included in the push payload.

make_notification_sticky Optional Boolean

When this field is enabled, the user cannot swipe away the notification.

dismiss_button_text Optional String

This field denotes the text to display on the dismiss button, which is typically required if the notification is sticky. This is required when auto_dismiss_notification is passed as true.

auto_dismiss_notification Required Boolean

When this field is passed as true, the notification can be auto-dismissed.

auto_dismiss_notification_time_value Required String

This is required when auto_dismiss_notification is passed as true.

auto_dismiss_notification_time_granularity Required String

This is required when auto_dismiss_notification is passed as true.

group_key Optional String

This field denotes the group key used to identify and categorize related push notifications.

Note:

  • Ensure you use the same group key for all push notifications you want to group.
  • MoEngage automatically modifies the group key to ensure it does not exceed the 45-character limit. MoEngage removes non-Latin scripts, special characters, and spaces to restrict the key composition to ASCII characters exclusively.
collapse_replace_key Optional String

This field denotes the update key used to identify and update related push notifications. Ensure you use the same update key for all push notifications intended to update each other.

template_backup  Optional JSON Object

This object contains the following information: 

Key Required Values Description
title Required String

This field denotes the title for the fallback notification.

message Required String

This field denotes the message body for the fallback notification.

summary Optional String

This field denotes the summary for the fallback notification.

image_url Optional String

This field denotes the URL of an image for the fallback notification.

default_click_action Required String

This field denotes the default click action for the fallback notification.

default_click_action_value Required String

This field denotes the URL or deep link for the fallback's click action.

key_value_pairs  Optional Array

This field denotes the custom key-value pairs specific to the fallback payload.

Note: This field is required when the campaign is created using the following template types:

  • Stylized Basic
  • Simple Image Carousel
  • Image banner with text overlay
  • Timer
  • Timer with Progress Bar

Carousel Content

This object contains the following information:

Key Required Data Type Description
slider_transition Required String This field denotes the transition type. Supported values are "manual", "automatic".
slide_data Required Array

This field contains the following information related to the slide:

  • image_url: This is a required field, which specifies the image URL for the slide data.
  • image_click_action: This is an optional field, which specifies the click action defined for the slide data image.
  • image_click_action_value: This is a required field when image_click_action key is passed. This field denotes the click action value defined for the slide data image.
  • key_value_pairs: This is an optional field, which specifies the defined key value pairs.

iOS

The iOS JSON object contains the following information: 

Key Required Values Description
template_type Required JSON Object

This field denotes the type of iOS push template. Supported values are:

  • BASIC
  • STYLIZED_BASIC
  • SIMPLE_IMAGE_CAROUSEL
  • Custom 
basic_details Required JSON Object

This object contains the following information:

Key Required Values Description Supported Template 
background_color_code Optional String

This field denotes the hexadecimal color code for the notification's background.

  • Simple Image Carousel
  • Stylized Basic Notification
apply_background_color_in_text_editor Optional Boolean

This field specifies if the background color should be applied within the text editor view. 

  • Simple Image Carousel
  • Stylized Basic Notification
title Required JSON Object

This field denotes the main title of the push notification.

All

message Required String

This field denotes the main body text of the notification.

All

subtitle  Optional String

This field denotes the subtitle displayed below the main title.

All

allow_bg_refresh  Optional Boolean

This field denotes whether to allow the app to be woken up in the background to refresh content.

All

rich_media_type  Required String

This field denotes the type of rich media to be included in the notification, such as an image, video, or GIF.

Basic Notification

rich_media_value Optional  String

This field denotes the URL of the rich media asset specified in the rich_media_type field.

Basic Notification

image_url Optional String

This field denotes the URL of a large image to be displayed within the notification content.

Note: This field is required when the campaign is created using the simple image carousel template.

All

input_gif_url Optional String

This field denotes the URL for the GIF media used in the push campaign content.

  • Basic
  • Stylized Basic
default_click_action  Optional String

This field denotes the action performed when the main body of the notification is tapped (for example, "DEEPLINKING"). 

All

default_click_action_value  Required String

This field denotes the URL or deep link associated with the default click action.

All

key_value_pairs  Optional JSON Object

This field denotes the list of custom key-value pairs sent with the push payload for in-app handling.

All

buttons  Optional JSON Object

The object contains the button_category string, which denotes the pre-defined category name for a set of interactive buttons configured in the app (for example, "MOE_PUSH_TEMPLATE"). 

advanced Optional  JSON Object

This object contains the following information:

Key Required Values Description
coupon_code Required JSON Object

This field denotes the coupon code to be included in the push payload.

sound_file Optional JSON Object

This field denotes the name of a custom sound file located in the app bundle to play upon receiving the notification.

enable_ios_badge  Required Boolean

This field denotes whether this campaign allows the notification to increment the app's badge count.

group_key Optional String

This field denotes the group key used to identify and categorize related push notifications.

Note:

  • Ensure you use the same group key for all push notifications you want to group.
  • MoEngage automatically modifies the group key to ensure it does not exceed the 45-character limit. MoEngage removes non-Latin scripts, special characters, and spaces to restrict the key composition to ASCII characters exclusively.

collapse_replace_key

Optional String

This field denotes the update key used to identify and update related push notifications. Ensure you use the same update key for all push notifications intended to update each other.

template_backup Required  JSON Object

This object contains the following information:

Key Required Values Description
title Required String

This field denotes the title for the fallback notification.

message Optional String

This field denotes the message body for the fallback notification.

subtitle Required String

This field denotes the subtitle for the fallback notification.

allow_bg_refresh Optional Boolean

This field denotes whether the background app refresh for the fallback notification is enabled.

rich_media_type Optional String

This field denotes the type of media attachment for the fallback (for example, "Image").

rich_media_value  Required String

This field denotes the URL of the media attachment for the fallback.

default_click_action Optional String

This field denotes the default click action for the fallback notification.

default_click_action_value Optional String

This field denotes the URL or deep link for the fallback's click action.

key_value_pairs Optional JSON Object

This field denotes the custom key-value pairs specific to the fallback payload.

Web

The Web JSON object contains the following information: 

Key Required Values Description
template_type Required JSON Object

This field denotes the template type for the web push campaign. Supported value is BASIC.

basic_details Required JSON Object

This object contains the following information: 

Key Required Values Description
title Required String

This field denotes the title text displayed at the top of the notification.

message Required String

This field denotes the main body text of the notification.

redirect_url Required String

This field denotes the URL that the user is redirected to when they click the main body of the notification.

image_url Optional String

This field denotes the URL of a large image to be displayed within the notification content.

buttons Optional  JSON Object

The object contains the following information: 

Key Required Values Description
title Required String

This field denotes the text displayed on the button.

icon_url Required String

This field denotes the URL of an icon to be displayed next to the button text.

url Optional String

This field denotes the destination URL that the user is redirected to when they click this button.

advanced Optional JSON Object

This object contains the following information: 

Key Required Values Description
icon_image_type Required String

This field denotes the type of icon to use for the notification.

icon_url Optional String

This field denotes the URL for a custom notification icon.

 

Segmentation Details

The segmentation_details JSON object contains the following information: 

Key Required Values Description
included_filters Required JSON Object

This object denotes the details about the defined filter operators and filters for the included filters of your campaign. 

excluded_filters Optional JSON Object

This object denotes the details about the defined filter operators and filters for the excluded filters of your campaign.

is_all_user_campaign Optional  Boolean

This field indicates if all users should be included in the campaign.

 

info

Note

For more information on the detailed segmentation payload and supported fields, refer to Create Custom Segment.

 

Scheduling Details

The scheduling_details JSON object contains the following information: 

Key Required Values Description
bts_details  Optional JSON Object This field contains the details about the best time to send. For more information, refer to Best Time to Send (BTS) Details.
delivery_type Required String

This field denotes the type of delivery schedule.
for your campaign. Supported values are:

  • ONE_TIME
  • PERIODIC
  • EVENT_TRIGGERED
  • BUSINESS_EVENT_TRIGGERED
  • DEVICE_TRIGGERED
  • LOCATION_TRIGGERED
  • BROADCAST_LIVE_ACTIVITY
start_time  Optional String This field denotes the start time for the campaign in ISO 8601 format.
periodic_details Optional JSON Object

This object denotes the periodic details of the campaign. For more information, refer to Periodic Details.

Note: This field is required for periodic campaigns.

expiry_time Optional String This field denotes the expiry time for the campaign in ISO 8601 format.
user_timezone_details Optional JSON Object This object denotes the user's time zone details. For more information, refer to User Timezone Details.

Best Time to Send (BTS) Details

Best Time to Send (BTS) provides a prescriptive time slot for sending a campaign to the user to increase the chance of interaction or user response. For more information, refer to Best time to send. The bts_details JSON object contains the following information:

Key Required Values Description
if_user_bts_is_not_available Optional String This field denotes when to send the campaign if the user's best time is not available.
if_user_bts_outside_time_window Optional String This field denotes when to send the campaign if the user's best time is outside this time window.
send_in_bts Optional Boolean This field denotes whether to send a campaign at the best time or not.
window_end_time Optional String This field denotes the window end time. 

User Timezone Details

The user_timezone_details JSON object contains the following information:

Key Required Values Description
send_if_user_timezone_has_passed Optional Boolean This field denotes whether to send the campaign if the user's time zone has passed.
send_in_user_timezone Optional Boolean This field denotes whether to send the campaign on a specific date and time within the time zone of the user.

Periodic Details

The periodic_details JSON object contains the following information:

Key Required Values Description
no_of_occurences Optional Number This field denotes the number of occurrences of the campaign.
repeat_frequency Optional Number This field denotes the repeat frequency of the campaign. 
repeat_on_date_of_month Optional Array

This field indicates the date of the month on which the campaign should be repeated.

For example, to send the campaign on the 5th and the 25th of a month, pass 5 and 25.

repeat_on_days_of_week_for_month Optional Array

This field denotes which days of the week for a month the campaign should repeat.

This array contains the following item fields: 

  • week_granularity: This field is of String type and indicates the days on which the campaign should be sent. For example, SECOND, FIRST, and LAST.
  • repeat_on_days_of_week: This field indicates the days of the week on which the campaign should be repeated and is an Array. For example, MONDAY.
repeat_on_days_of_week Optional Array

This field denotes which days of the week the campaign repeats. 

For example, if you wish to send the campaign every Monday and Friday, pass these days in this field as MONDAY and FRIDAY.

sending_frequency Optional String

This field denotes the frequency to send the campaign. Supported values are:

  •  “DAILY”
  • “MONTHLY”
  • “WEEKLY” 

Delivery Controls

The delivery_controls JSON object contains the following information: 

Key Required Values Description
bypass_dnd Optional Boolean This field denotes whether you want to bypass DND. It is required when the campaign is created with an event-triggered delivery type.
campaign_throttle_rpm Optional Number

This field denotes the campaign throttle RPM. It is not applicable when the campaign is created with the following delivery types:

  • device-triggered
  • location-triggered
  • event-triggered.

Sample value: "50000", "70000".

For more information, refer here.

count_for_frequency_capping Optional Boolean This field denotes whether you want to count the channel message sent by a particular Flow for frequency capping.
ignore_frequency_capping Optional Boolean This field denotes whether you want to ignore frequency capping or not.
minimum_delay_between_two_notification_in_hour Optional Numeric This field denotes the minimum delay between two notifications in an hour. It applies to push campaigns created with event-triggered and device-triggered delivery types.
max_time_to_show_message_of_same_campaign Optional String The maximum duration, in hours, that a message from this specific campaign will be displayed to a user. A value of 0 typically disables this feature. This field is applicable when the campaign is created with the device-triggered delivery type.
expiry_time_of_sync_data_in_hour Optional String The duration, in hours, after which the campaign data synced to a device will expire if the trigger condition has not been met. This is used to clear out old campaign data. A value of 0 often means it will not expire. This field is applicable when the campaign is created with a device-triggered delivery type.
send_message_in_offline_mode Optional Boolean If true, the message will be stored and delivered to the user even if their device is offline at the time of sending. If false, the message is discarded if the user is offline. This field is applicable when the campaign is created with a device_triggered delivery type.
send_limit_value Optional String The maximum number of times a user can receive this campaign within the specified time granularity. This field applies when the campaign is created with the location_triggered delivery type.
send_limit_granularity_in_hours Optional String

The time window, in hours, during which the send_limit_value is enforced. For example, a send_limit_value of 2 and a send_limit_granularity_in_hours of 24 means the user will receive this message at most twice in any 24-hour period.

This field is applicable when the campaign is created with a location-triggered delivery type.

Advanced

The advanced JSON object contains the following information: 

Key Required Values Description
expiration_settings Optional JSON Object

This object contains the following information:

Key Required Values Description

expire_notification_after_value

Required Integer

The numeric value for the notification expiration time.

expire_notification_after_type

Required  String

The time unit for notification expiration (for example, "HOUR", "DAY").

remove_from_inbox_after_value

Required  Integer

The numeric value for when to remove the message from the user's notification inbox.

remove_from_inbox_after_type Required String

The time unit for removing the message from the inbox (for example, "DAY").

platform_level_priority  Optional JSON Object

The android_specific_priority JSON object contains the following information: 

Key Required Values Description
send_with_priority Optional Boolean This field denotes the platform-specific payload details for your campaign.

The ios_specific_priority JSON object contains the following information: 

Key Required Values Description
apns_priority Optional String

This field denotes the priority of a notification's delivery, informing APNS how to handle delivery under network or power constraints. Supported values are:

  • 10
  • 5
  • 1
interruption_level Optional String

This field denotes the interruption level configured for your campaign. Supported values are:

  • Passive
  • Active
  • Time sensitive
  • Critical
relevance_score Optional String

This field denotes the relevance score defined for your push campaign. Supported values are:

  • 0
  • 0.5
  • 1

Conversion Goal Details

The conversion_goal_details JSON object contains the following information:

Key Required Values Description
attribution_window_in_hours Optional Number This field denotes the attribution window in hours.
goals Optional Array This field has the items object. For more information on its structure, refer to Items Details.

Items Details

The items JSON object contains the following information:

Key Required Values Description
goal_event_attribute Optional JSON Object This object denotes the goal event attribute. For more information, refer to Goal Event Attributes.
goal_event_name Optional String This field denotes the goal event name.
goal_name Optional String This field denotes the goal name.
is_primary_goal Optional Boolean This field denotes whether this is a primary goal or not.
revenue_attribute Optional String This field denotes the revenue attribute.
revenue_currency Optional String This field denotes the revenue currency.

Goal Event Attributes

The goal_event_attribute JSON object contains the following information:

Key Required Values Description
condition Optional String This field denotes the condition used while creating a goal. 
is_case_sensitive Optional Boolean This field denotes whether the goal event attribute is case-sensitive or not.
name Optional String This field denotes the name of the goal event attribute.
value Optional String This field denotes the value of the goal event attribute.

Control Group Details

The control_group_details JSON object contains the following information:

Key Required Values Description
is_campaign_control_group_enabled Optional Boolean This field denotes whether the campaign control group is enabled or not.
campaign_control_group_percentage Optional Integer

This field denotes the percentage of users added to an exclusion list.

Note: If is_campaign_control_group_enabled is True, the campaign_control_group_percentage field is required.

is_global_control_group_enabled Optional Boolean This field denotes whether the global control group is enabled or not.

Response

Key Data Type Description
campaign_id String This field contains the unique ID corresponding to a successful campaign creation request and needs to be stored by you. This campaign ID is used for searching a specific campaign and updating it.
error JSON Object

This field contains the reason for the request's failure.

Structure:

 "error": {

    "code": "<error_code>", 

    "message": "<error_message>",

    "target": "<target>",

    "details": [

         {

             "target": "<target>",

             "message": "<error_message>"

          }

    ],

    "request_id": "<request_id>"

    }

}

The error object contains the following fields:

  • code - This field is of String type and contains the error code that provides a brief explanation of the error. For example, 400 - Bad Request, 401- Authentication required, and so on. This field is present in the response only in the case of errors.
  • message - This field is of String type and describes why the request has failed.
  • target - This field is of String type and denotes the target of the error.
  • details - This object provides the error details and contains the following information:
    • target - This field is of String type and denotes the target of the error.
    • message - This field is of String type and describes why the request has failed.
  • request_id: This field denotes the request ID.

Response Codes

Status Code Request State Description

201

Created

This response is returned when the campaign is created. 

400

Bad Request

This response is returned when the required parameters are missing from the request, or when the provided parameters are invalid, or when a template already exists with the same version, name, or ID.

401

Authentication Failure

This response is returned when the authorization parameters are missing in the HTTP Auth Header.

429

Rate Limit Breach

This response is returned when the number of requests per minute has exceeded the rate limit.

500

Internal Server Error

This response is returned when the system runs into an unexpected error.

Rate Limit

You can create 5 campaigns per minute, 25 campaigns per hour, and 100 campaigns per day.

Sample cURL Request

Delivery Types

One-Time Periodic Event-Triggered Business Event-Triggered Device-Triggered Location-Triggered Broadcast-Live-Activity
curl --location 'https://api-0X.moengage.com/core-services/v1/campaigns' \
--header 'accept: application/json' \
--header 'Content-Type: application/json' \
--header 'MOE-APPKEY: {{Workspace_ID or APP_ID}}' \
--header 'Authorization: Basic {{Authorization_Key}}' \
--data-raw '{
    "request_id": "{{request_id}}",
    "channel": "PUSH",
    "campaign_delivery_type": "ONE_TIME",
    "created_by": "{{email_id}}",
    "basic_details": {
        "name": "{{campaign_name}}",
        "team": "{{team_name}}",
        "platforms": [
            "ANDROID",
            "IOS",
            "WEB"
        ],
        "platform_specific_details": {
            "android": {
                "push_amp_plus_enabled": true
            },
            "ios": {
                "send_to_all_eligible_device": true,
                "exclude_provisional_push_devices": false,
                "send_to_only_provisional_push_enabled_devices": false
            }
        }
    },
     "campaign_content": {
        "locales": [
            "{{locale1}}",
            "{{default}}"
        ],
        "variation_details": {
            "distribution_type": "MANUAL",
            "no_of_variations": 2,
            "manual_distribution_percentage": {
                "variation_1": 50,
                "variation_2": 45
            }
        },
        "content": {
            "{{locale1}}": {
                "variation_1": {
                    "push": {
                        "android": {
                            "template_type": "BASIC",
                            "basic_details": {
                                "notification_channel": "general",
                                "title": "quick scheduled update",
                                "message": "Message",
                                "summary": "Message summary",
                                "image_url": "https://www.gstatic.com/webp/gallery/2.jpg",
                                "default_click_action": "DEEPLINKING",
                                "default_click_action_value": "https://www.google.com",
                                "key_value_pairs": [
                                    {
                                        "key": "abcd",
                                        "value": "efgh"
                                    }
                                ]
                            },
                            "buttons": [
                                {
                                    "btn_name": "Button 1.1",
                                    "click_action_type": "DEEPLINKING",
                                    "click_action_name": "asd",
                                    "click_action_value": "https://www.google.com",
                                    "key_value_pairs": [
                                        {
                                            "key": "q",
                                            "value": "adfsa"
                                        }
                                    ]
                                },
                                {
                                    "btn_name": "button2.1",
                                    "click_action_type": "RICH_LANDING",
                                    "click_action_name": "asd",
                                    "click_action_value": "https://www.google.com",
                                    "key_value_pairs": [
                                        {
                                            "key": "q",
                                            "value": "adfsa"
                                        }
                                    ]
                                }
                            ],
                            "advanced": {
                                "coupon_code": "Coupon code 24",
                                "icon_type_in_notification": "app_icon",
                                "auto_dismiss_notification": true,
                                "auto_dismiss_notification_time_value": 1,
                                "auto_dismiss_notification_time_granularity": "DAYS"
                            }
                        },
                        "ios": {
                            "template_type": "BASIC",
                            "basic_details": {
                                "title": "IOS Check",
                                "message": "Kannada - ಶುಭೋದಯ  Hindi - शुभ प्रभात, आपका दिन अच्छा हो|Chinese - 早上好,祝你有美好的一天 Russian - Доброе утро! Хорошего дня   |    Arabic - صباح الخير يوما سعيدا   |  Gujrati - શુભ સવાર, તમારો દિવસ શુભ રહે",
                                "subtitle": "😃 😄",
                                "allow_bg_refresh": true,
                                "rich_media_type": "Image",
                                "rich_media_value": "https://sample-videos.com/gif/2.gif",
                                "default_click_action": "DEEPLINKING",
                                "default_click_action_value": "https://hatrabbits.com/wp-content/uploads/2017/01/random.jpg",
                                "key_value_pairs": [
                                    {
                                        "key": "keyy",
                                        "value": "valuee"
                                    }
                                ]
                            },
                            "buttons": [
                                {
                                    "button_category": "INVITE_CATEGORY"
                                }
                            ],
                            "advanced": {
                                "coupon_code": "{{Coupons.CouponListName['\''Sanity_Coupons'\'']|default('\''MOE_NOT_SEND'\'')}}",
                                "sound_file": "sAnity 😃 ",
                                "enable_ios_badge": true
                            }
                        },
                        "web": {
                            "template_type": "BASIC",
                            "basic_details": {
                                "title": "Sample Check",
                                "message": "Kannada - ಶುಭೋದಯ   Hindi - शुभ प्रभात, आपका दिन अच्छा हो| ",
                                "redirect_url": "https://www.gstatic.com/webp/gallery/1.jpg",
                                "auto_dismiss_notification": true,
                                "image_url": "https://www.gstatic.com/webp/gallery/2.jpg"
                            },
                            "buttons": [
                                {
                                    "title": "Button-1",
                                    "icon_url": "https://www.gstatic.com/webp/gallery/1.jpg",
                                    "url": "https://www.gstatic.com/webp/gallery/2.jpg"
                                }
                            ],
                            "advanced": {
                                "icon_image_type": "ICON_URL",
                                "icon_url": "https://www.gstatic.com/webp/gallery/4.jpg"
                            }
                        }
                    }
                },
                "variation_2": {
                    "push": {
                        "android": {
                            "template_type": "BASIC",
                            "basic_details": {
                                "notification_channel": "general",
                                "title": "quick scheduled update",
                                "message": "Message",
                                "summary": "Message summary",
                                "image_url": "https://www.gstatic.com/webp/gallery/2.jpg",
                                "default_click_action": "DEEPLINKING",
                                "default_click_action_value": "https://www.google.com",
                                "key_value_pairs": [
                                    {
                                        "key": "q",
                                        "value": "adfsa"
                                    }
                                ]
                            },
                            "buttons": [
                                {
                                    "btn_name": "Button 1.1",
                                    "click_action_type": "DEEPLINKING",
                                    "click_action_name": "asd",
                                    "click_action_value": "https://www.google.com",
                                    "key_value_pairs": [
                                        {
                                            "key": "q",
                                            "value": "adfsa"
                                        }
                                    ]
                                },
                                {
                                    "btn_name": "button2.1",
                                    "click_action_type": "RICH_LANDING",
                                    "click_action_name": "asd",
                                    "click_action_value": "https://www.google.com",
                                    "key_value_pairs": [
                                        {
                                            "key": "q",
                                            "value": "adfsa"
                                        }
                                    ]
                                }
                            ],
                            "advanced": {
                                "coupon_code": "Coupon code 24",
                                "icon_type_in_notification": "app_icon",
                                "auto_dismiss_notification": true,
                                "auto_dismiss_notification_time_value": 1,
                                "auto_dismiss_notification_time_granularity": "DAYS"
                            }
                        },
                        "ios": {
                            "template_type": "BASIC",
                            "basic_details": {
                                "title": "IOS Check",
                                "message": "Kannada - ಶುಭೋದಯ  Hindi - शुभ प्रभात, आपका दिन अच्छा हो|Chinese - 早上好,祝你有美好的一天 Russian - Доброе утро! Хорошего дня   |    Arabic - صباح الخير يوما سعيدا   |  Gujrati - શુભ સવાર, તમારો દિવસ શુભ રહે",
                                "subtitle": "😃 😄",
                                "allow_bg_refresh": true,
                                "rich_media_type": "Image",
                                "rich_media_value": "https://sample-videos.com/gif/2.gif",
                                "default_click_action": "DEEPLINKING",
                                "default_click_action_value": "https://hatrabbits.com/wp-content/uploads/2017/01/random.jpg",
                                "key_value_pairs": [
                                    {
                                        "key": "keyy",
                                        "value": "valuee"
                                    }
                                ]
                            },
                            "buttons": [
                                {
                                    "button_category": "INVITE_CATEGORY"
                                }
                            ],
                            "advanced": {
                                "coupon_code": "{{Coupons.CouponListName['\''Sanity_Coupons'\'']|default('\''MOE_NOT_SEND'\'')}}",
                                "sound_file": "sAnity 😃 ",
                                "enable_ios_badge": true
                            }
                        },
                        "web": {
                            "template_type": "BASIC",
                            "basic_details": {
                                "title": "Sample Check",
                                "message": "Kannada - ಶುಭೋದಯ   Hindi - शुभ प्रभात, आपका दिन अच्छा हो| ",
                                "redirect_url": "https://www.gstatic.com/webp/gallery/1.jpg",
                                "auto_dismiss_notification": true,
                                "image_url": "https://www.gstatic.com/webp/gallery/2.jpg"
                            },
                            "buttons": [
                                {
                                    "title": "Button-1",
                                    "icon_url": "https://www.gstatic.com/webp/gallery/1.jpg",
                                    "url": "https://www.gstatic.com/webp/gallery/2.jpg"
                                }
                            ],
                            "advanced": {
                                "icon_image_type": "ICON_URL",
                                "icon_url": "https://www.gstatic.com/webp/gallery/4.jpg"
                            }
                        }
                    }
                }
            },
            "{{default}}": {
                "variation_1": {
                    "push": {
                        "android": {
                            "template_type": "BASIC",
                            "basic_details": {
                                "notification_channel": "general",
                                "title": "quick scheduled update",
                                "message": "Message",
                                "summary": "Message summary",
                                "image_url": "https://www.gstatic.com/webp/gallery/2.jpg",
                                "default_click_action": "DEEPLINKING",
                                "default_click_action_value": "https://www.google.com",
                                "key_value_pairs": [
                                    {
                                        "key": "q",
                                        "value": "adfsa"
                                    }
                                ]
                            },
                            "buttons": [
                                {
                                    "btn_name": "Button 1.1",
                                    "click_action_type": "DEEPLINKING",
                                    "click_action_name": "asd",
                                    "click_action_value": "https://www.google.com",
                                    "key_value_pairs": [
                                        {
                                            "key": "q",
                                            "value": "adfsa"
                                        }
                                    ]
                                },
                                {
                                    "btn_name": "button2.1",
                                    "click_action_type": "RICH_LANDING",
                                    "click_action_name": "asd",
                                    "click_action_value": "https://www.google.com",
                                    "key_value_pairs": [
                                        {
                                            "key": "q",
                                            "value": "adfsa"
                                        }
                                    ]
                                }
                            ],
                            "advanced": {
                                "coupon_code": "Coupon code 24",
                                "icon_type_in_notification": "app_icon",
                                "auto_dismiss_notification": true,
                                "auto_dismiss_notification_time_value": 1,
                                "auto_dismiss_notification_time_granularity": "DAYS"
                            }
                        },
                        "ios": {
                            "template_type": "BASIC",
                            "basic_details": {
                                "title": "IOS Check",
                                "message": "Kannada - ಶುಭೋದಯ  Hindi - शुभ प्रभात, आपका दिन अच्छा हो|Chinese - 早上好,祝你有美好的一天 Russian - Доброе утро! Хорошего дня   |    Arabic - صباح الخير يوما سعيدا   |  Gujrati - શુભ સવાર, તમારો દિવસ શુભ રહે",
                                "subtitle": "😃 😄",
                                "allow_bg_refresh": true,
                                "rich_media_type": "Image",
                                "rich_media_value": "https://sample-videos.com/gif/2.gif",
                                "default_click_action": "DEEPLINKING",
                                "default_click_action_value": "https://hatrabbits.com/wp-content/uploads/2017/01/random.jpg",
                                "key_value_pairs": [
                                    {
                                        "key": "keyy",
                                        "value": "valuee"
                                    }
                                ]
                            },
                            "buttons": [
                                {
                                    "button_category": "INVITE_CATEGORY"
                                }
                            ],
                            "advanced": {
                                "coupon_code": "{{Coupons.CouponListName['\''Sanity_Coupons'\'']|default('\''MOE_NOT_SEND'\'')}}",
                                "sound_file": "sAnity 😃 ",
                                "enable_ios_badge": true
                            }
                        },
                        "web": {
                            "template_type": "BASIC",
                            "basic_details": {
                                "title": "Sample Check",
                                "message": "Kannada - ಶುಭೋದಯ   Hindi - शुभ प्रभात, आपका दिन अच्छा हो| ",
                                "redirect_url": "https://www.gstatic.com/webp/gallery/1.jpg",
                                "auto_dismiss_notification": true,
                                "image_url": "https://www.gstatic.com/webp/gallery/2.jpg"
                            },
                            "buttons": [
                                {
                                    "title": "Button-1",
                                    "icon_url": "https://www.gstatic.com/webp/gallery/1.jpg",
                                    "url": "https://www.gstatic.com/webp/gallery/2.jpg"
                                }
                            ],
                            "advanced": {
                                "icon_image_type": "ICON_URL",
                                "icon_url": "https://www.gstatic.com/webp/gallery/4.jpg"
                            }
                        }
                    }
                },
                "variation_2": {
                    "push": {
                        "android": {
                            "template_type": "BASIC",
                            "basic_details": {
                                "notification_channel": "general",
                                "title": "quick scheduled update",
                                "message": "Message",
                                "summary": "Message summary",
                                "image_url": "https://www.gstatic.com/webp/gallery/2.jpg",
                                "default_click_action": "DEEPLINKING",
                                "default_click_action_value": "https://www.google.com",
                                "key_value_pairs": [
                                    {
                                        "key": "q",
                                        "value": "adfsa"
                                    }
                                ]
                            },
                            "buttons": [
                                {
                                    "btn_name": "Button 1.1",
                                    "click_action_type": "DEEPLINKING",
                                    "click_action_name": "asd",
                                    "click_action_value": "https://www.google.com",
                                    "key_value_pairs": [
                                        {
                                            "key": "q",
                                            "value": "adfsa"
                                        }
                                    ]
                                },
                                {
                                    "btn_name": "button2.1",
                                    "click_action_type": "RICH_LANDING",
                                    "click_action_name": "asd",
                                    "click_action_value": "https://www.google.com",
                                    "key_value_pairs": [
                                        {
                                            "key": "q",
                                            "value": "adfsa"
                                        }
                                    ]
                                }
                            ],
                            "advanced": {
                                "coupon_code": "Coupon code 24",
                                "icon_type_in_notification": "app_icon",
                                "auto_dismiss_notification": true,
                                "auto_dismiss_notification_time_value": 1,
                                "auto_dismiss_notification_time_granularity": "DAYS"
                            }
                        },
                        "ios": {
                            "template_type": "BASIC",
                            "basic_details": {
                                "title": "IOS Check",
                                "message": "Kannada - ಶುಭೋದಯ  Hindi - शुभ प्रभात, आपका दिन अच्छा हो|Chinese - 早上好,祝你有美好的一天 Russian - Доброе утро! Хорошего дня   |    Arabic - صباح الخير يوما سعيدا   |  Gujrati - શુભ સવાર, તમારો દિવસ શુભ રહે",
                                "subtitle": "😃 😄",
                                "allow_bg_refresh": true,
                                "rich_media_type": "Image",
                                "rich_media_value": "https://sample-videos.com/gif/2.gif",
                                "default_click_action": "DEEPLINKING",
                                "default_click_action_value": "https://hatrabbits.com/wp-content/uploads/2017/01/random.jpg",
                                "key_value_pairs": [
                                    {
                                        "key": "keyy",
                                        "value": "valuee"
                                    }
                                ]
                            },
                            "buttons": [
                                {
                                    "button_category": "INVITE_CATEGORY"
                                }
                            ],
                            "advanced": {
                                "coupon_code": "{{Coupons.CouponListName['\''Sanity_Coupons'\'']|default('\''MOE_NOT_SEND'\'')}}",
                                "sound_file": "sAnity 😃 ",
                                "enable_ios_badge": true
                            }
                        },
                        "web": {
                            "template_type": "BASIC",
                            "basic_details": {
                                "title": "Sample Check",
                                "message": "Kannada - ಶುಭೋದಯ   Hindi - शुभ प्रभात, आपका दिन अच्छा हो| ",
                                "redirect_url": "https://www.gstatic.com/webp/gallery/1.jpg",
                                "auto_dismiss_notification": true,
                                "image_url": "https://www.gstatic.com/webp/gallery/2.jpg"
                            },
                            "buttons": [
                                {
                                    "title": "Button-1",
                                    "icon_url": "https://www.gstatic.com/webp/gallery/1.jpg",
                                    "url": "https://www.gstatic.com/webp/gallery/2.jpg"
                                }
                            ],
                            "advanced": {
                                "icon_image_type": "ICON_URL",
                                "icon_url": "https://www.gstatic.com/webp/gallery/4.jpg"
                            }
                        }
                    }
                }
            }
        }
    },
    "segmentation_details": {
        "included_filters": {
            "filter_operator": "and",
            "filters": [
                {
                    "data_type": "string",
                    "category": "Tracked Custom Attribute",
                    "name": "{{attribute_name}}",
                    "filter_type": "user_attributes",
                    "case_sensitive": false,
                    "operator": "exists",
                    "negate": false
                }
            ]
        },
        "excluded_filters": {
            "filter_operator": "and",
            "filters": [
                {
                    "data_type": "string",
                    "category": "Tracked Standard Attribute",
                    "name": "uid",
                    "value": "{{attribute_value}}",
                    "filter_type": "user_attributes",
                    "case_sensitive": false,
                    "operator": "is",
                    "negate": false
                }
            ]
        }
    },
    "conversion_goal_details": {
        "attribution_window_in_hours": 2,
        "goals": [
            {
                "goal_event_attribute": {
                    "condition": "is",
                    "is_case_sensitive": true,
                    "name": "appVersion",
                    "value": "1.0"
                },
                "goal_event_name": "{{event_name}}",
                "goal_name": "Goal 1",
                "is_primary_goal": true,
                "revenue_attribute": "appVersion",
                "revenue_currency": "INR"
            }
        ]
    },
    "scheduling_details": {
        "delivery_type": "ASAP"
    },
    "delivery_controls": {
        "campaign_throttle_rpm": 20000,
        "count_for_frequency_capping": true,
        "ignore_frequency_capping": true,
        "max_time_to_show_message_of_same_camapign": 0
    },
    "advanced": {
        "expiration_settings": {
            "expire_notification_after_value": 5,
            "expire_notification_after_type": "HOUR",
            "remove_from_inbox_after_value": 10,
            "remove_from_inbox_after_type": "DAY"
        },
        "platform_level_priority": {
            "android_specific_priority": {
                "send_with_priority": true
            },
            "ios_specific_priority": {
                "apns_priority": "1",
                "interruption_level": "ACTIVE",
                "relevance_score": 1
            }
        }
    }
}'

Scheduling

The following is a sample code for a Periodic campaign with:

Monthly frequency Weekly frequency with BTS Daily frequency with user time zone
"scheduling_details": {
        "delivery_type": "AT_FIXED_TIME",
        "start_time": "2024-06-29T20:32:00",
        "periodic_details": {
            "sending_frequency": "MONTHLY",
            "repeat_frequency": 1,
            "no_of_occurences": 3,
            "repeat_on_days_of_week_for_month": [
                {
                    "week_granularity": "FIRST",
                    "repeat_on_days_of_week": [
                        "TUESDAY",
                        "FRIDAY"
                    ]
                },
                {
                    "week_granularity": "THIRD",
                    "repeat_on_days_of_week": [
                        "TUESDAY",
                        "MONDAY"
                    ]
                },
                {
                    "week_granularity": "SECOND",
                    "repeat_on_days_of_week": [
                        "TUESDAY",
                        "THURSDAY"
                    ]
                },
                {
                    "week_granularity": "FOURTH",
                    "repeat_on_days_of_week": [
                        "TUESDAY",
                        "WEDNESDAY"
                    ]
                },
                {
                    "week_granularity": "LAST",
                    "repeat_on_days_of_week": [
                        "SATURDAY",
                        "FRIDAY"
                    ]
                }
            ]
        }
    },

Android Template Types

The following is a sample code for a Periodic campaign with:

Basic notification Stylized basic Simple image carousel Image banner with text overlay Timer Timer with Progress Bar Custom
curl --location 'https://api-0X.moengage.com/core-services/v1/campaigns' \
--header 'accept: application/json' \
--header 'Content-Type: application/json' \
--header 'MOE-APPKEY: {{Workspace_ID or APP_ID}}' \
--header 'Authorization: Basic {{Authorization_Key}}' \
--data-raw '{
    "request_id": "{{request_id}}",
    "channel": "PUSH",
    "campaign_delivery_type": "ONE_TIME",
    "created_by": "john.doe@abc.com",
    "basic_details": {
        "name": "{{campaign_name}}", 
        "team": "{{team_name}}",
        "platforms": [
            "ANDROID"
        ],
        "platform_specific_details": {
            "android": {
                "push_amp_plus_enabled": true
            },
            "ios": {
                "send_to_all_eligible_device": false,
                "exclude_provisional_push_devices": false,
                "send_to_only_provisional_push_enabled_devices": false
            }
        }
        
    },
    "campaign_content": {
        "content": {
            "push": {
                "android": {
                    "template_type": "BASIC",
                    "basic_details": {
                        "notification_channel": "extra",
                        "title": "img url",
                        "message": "done",
                        "summary": "sdvcsd",
                        "image_url": "https://cdn.pixabay.com/photo/2017/05/31/16/39/windows-2360920_1280.PNG",
                        "default_click_action": "NAVIGATE_TO_A_SCREEN",
                        "default_click_action_value": "https://www.google.com",
                        "key_value_pairs": [
                            {
                                "key": "q",
                                "value": "adfsa"
                            }
                        ]
                    },
                    "buttons": [
                        {
                            "btn_name": "Button 1.1",
                            "click_action_type": "DEEPLINKING",
                            "click_action_name": "asd",
                            "click_action_value": "{{click_action_value}}",
                            "key_value_pairs": [
                                {
                                    "key": "q",
                                    "value": "adfsa"
                                }
                            ]
                        },
                        {
                            "btn_name": "button2.1",
                            "click_action_type": "RICH_LANDING",
                            "click_action_name": "asd",
                            "click_action_value": "{{click_action_value}}",
                            "key_value_pairs": [
                                {
                                    "key": "q",
                                    "value": "adfsa"
                                }
                            ]
                        }
                    ],
                    "advanced": {
                        "coupon_code": "Coupon code 24",
                        "icon_type_in_notification": "app_icon",
                        "auto_dismiss_notification": true,
                        "auto_dismiss_notification_time_value": 1,
                        "auto_dismiss_notification_time_granularity": "DAYS"
                    }
                }
            }
        }
    },
    "segmentation_details": {
        "included_filters": {
            "filter_operator": "and",
            "filters": [
                {
                    "data_type": "string",
                    "category": "Tracked Standard Attribute",
                    "name": "uid",
                    "value": "USER",
                    "filter_type": "user_attributes",
                    "case_sensitive": false,
                    "operator": "is",
                    "negate": false
                }
            ]
        }
    },
    "scheduling_details": {
       "delivery_type": "ASAP"   
    },
    "delivery_controls": {
        
        "campaign_throttle_rpm": 60001,
        "count_for_frequency_capping": true,
        "ignore_frequency_capping": true,
        "minimum_delay_between_two_notification_in_hour": 0,
        "max_time_to_show_message_of_same_campaign": 0,
        "expiry_time_of_sync_data_in_hour": 0,
        "send_message_in_offline_mode": false
           
    },
    "advanced": {
        "expiration_settings": {
            "expire_notification_after_value": 5,
            "expire_notification_after_type": "HOUR",
            "remove_from_inbox_after_value": 10,
            "remove_from_inbox_after_type": "DAY"
        },
        "platform_level_priority": {
            "android_specific_priority": {
                "send_with_priority": true
            },
            "ios_specific_priority": {
                "apns_priority": "1",
                "interruption_level": "ACTIVE",
                "relevance_score": 1
            }
        }
    },
    "control_group_details": {
        "is_global_control_group_enabled": false,
        "is_campaign_control_group_enabled": false
        
    }
}'

iOS Template Type

The following is a sample code for Push campaigns with iOS templates:

Basic notification Stylized Basic Simple image Carousel
curl --location 'https://api-0X.moengage.com/core-services/v1/campaigns' \
--header 'accept: application/json' \
--header 'Content-Type: application/json' \
--header 'MOE-APPKEY: {{Workspace_ID or APP_ID}}' \
--header 'Authorization: Basic {{Authorization_Key}}' \
--data-raw '{
    "request_id": {{request_id}},
    "channel": "PUSH",
    "campaign_delivery_type": "BROADCAST_LIVE_ACTIVITY",
    "created_by": "john.doe@abc.com",
    "basic_details": {
        "name": "{{campaign_name}}",
        "team": "{{team_name}}",
        "platforms": [
            "IOS" 
        ],
        "broadcast_live_activity_id": "live_check123",
        "platform_specific_details": {
            "ios": {
                "send_to_all_eligible_device": true,
                "exclude_provisional_push_devices": false,
                "send_to_only_provisional_push_enabled_devices": false
            }
        }
    },
    "campaign_content": {
        "content": {
            "push": {
                "ios": {
                    "template_type": "BASIC",
                    "basic_details": {
                        "title": "Message title",
                        "message": "Message",
                        "subtitle": "Subtitle",
                        "allow_bg_refresh": true,
                        "rich_media_type": "Image",
                        "rich_media_value": "https://hatrabbits.com/wp-content/uploads/2017/01/random.jpg",
                        "default_click_action": "DEEPLINKING",
                        "default_click_action_value": "https://hatrabbits.com/wp-content/uploads/2017/01/random.jpg",
                        "key_value_pairs": [
                            {
                                "key": "keyy",
                                "value": "valuee"
                            }
                        ]
                    },
                    "buttons": [
                        {
                            "button_category": "INVITE_CATEGORY"
                        }
                    ],
                    "advanced": {
                        "coupon_code": "Coupon code",
                        "sound_file": "Sound",
                        "enable_ios_badge": true
                    }
                }
            }
        }
    },
    "segmentation_details": {
        "included_filters": {
            "filter_operator": "and",
            "filters": [
                {
                    "data_type": "string",
                    "category": "Tracked Standard Attribute",
                    "name": "uid",
                    "value": [
                        "hshs_00122"
                    ],
                    "filter_type": "user_attributes",
                    "case_sensitive": false,
                    "operator": "in",
                    "negate": false
                }
            ]
        }
    },
    "scheduling_details": {
        "delivery_type": "ASAP"
    },
    "delivery_controls": {
        "campaign_throttle_rpm": 100000,
        "count_for_frequency_capping": true,
        "ignore_frequency_capping": true,
        "minimum_delay_between_two_notification_in_hour": 0,
        "max_time_to_show_message_of_same_campaign": 0,
        "expiry_time_of_sync_data_in_hour": 0,
        "send_message_in_offline_mode": false
    },
    "advanced": {
        "expiration_settings": {
            "expire_notification_after_value": 5,
            "expire_notification_after_type": "HOUR",
            "remove_from_inbox_after_value": 10,
            "remove_from_inbox_after_type": "DAY"
        },
        "platform_level_priority": {
            "ios_specific_priority": {
                "apns_priority": 5,
                "interruption_level": "ACTIVE",
                "relevance_score": 1
            }
        }
    },
    "conversion_goal_details": {
        "attribution_window_in_hours": 2,
        "goals": [
            {
                "goal_event_attribute": {
                    "condition": "is",
                    "is_case_sensitive": true,
                    "name": "name",
                    "value": "john"
                },
                "goal_event_name": "sudo",
                "goal_name": "Goal 1",
                "is_primary_goal": true,
                "revenue_attribute": "Device Height",
                "revenue_currency": "INR"
            }
        ]
    }
}'

Web Template

The following is a sample code for a Push campaign created with Web template:

Sample cURL
curl --location 'https://api-0X.moengage.com/core-services/v1/campaigns' \
--header 'accept: application/json' \
--header 'Content-Type: application/json' \
--header 'MOE-APPKEY: {{Workspace_ID or APP_ID}}' \
--header 'Authorization: Basic {{Authorization_Key}}' \
--data-raw '{
    "request_id": {{request_id}},
    "channel": "PUSH",
    "campaign_delivery_type": "ONE_TIME",
    "created_by": "john.doe@abc.com",
    "basic_details": {
        "name": "{{campaign_name}}",
        "team": "{{team_name}}",
        "platforms": [
            "WEB"
        ],
        "platform_specific_details": {    
        }
    },
    "campaign_content": {
        "content": {
            "push": {
                "web": {
          "template_type": 
            "BASIC",
          "basic_details": {
            "title": "web string asap",
            "message": "web string asap",
            "redirect_url": "https://www.google.com",
            
            "image_url": "https://images.pexels.com/photos/248797/pexels-photo-248797.jpeg?w=1260&h=750&auto=compress&cs=tinysrgb"
          },
          "buttons": [
            {
              "title": "web button",
              "icon_url": "https://images.pexels.com/photos/248797/pexels-photo-248797.jpeg?w=1260&h=750&auto=compress&cs=tinysrgb",
              "url": "https://www.google.com"
            }
          ],
          "advanced": {
            "icon_image_type": "DEFAULT",
            "icon_url": "https://images.pexels.com/photos/248797/pexels-photo-248797.jpeg?w=1260&h=750&auto=compress&cs=tinysrgb"
          }
        }
            }
        }
    },
    "segmentation_details": {
        "included_filters": {
            "filter_operator": "and",
            "filters": [
                {
                    "data_type": "string",
                    "category": "Tracked Standard Attribute",
                    "name": "uid",
                    "value": "USER",
                    "filter_type": "user_attributes",
                    "case_sensitive": false,
                    "operator": "is",
                    "negate": false
                }
            ]
        }
    },
    "scheduling_details": {
        "delivery_type": "ASAP"
    },
    "delivery_controls": {
        "campaign_throttle_rpm": 60001,
        "count_for_frequency_capping": true,
        "ignore_frequency_capping": true,
        "minimum_delay_between_two_notification_in_hour": 0,
        "max_time_to_show_message_of_same_campaign": 0,
        "expiry_time_of_sync_data_in_hour": 0,
        "send_message_in_offline_mode": false
    },
    "advanced": {
        "expiration_settings": {
            "expire_notification_after_value": 5,
            "expire_notification_after_type": "HOUR"
            
            
        },
        "platform_level_priority": {
            "ios_specific_priority": {
                "apns_priority": 5,
                "interruption_level": "ACTIVE",
                "relevance_score": 1
            }
        }
    },
    "conversion_goal_details": {
        "attribution_window_in_hours": 2,
        "goals": [
            {
                "goal_event_attribute": {
                    "condition": "is",
                    "is_case_sensitive": true,
                    "name": "name",
                    "value": "john"
                },
                "goal_event_name": "sudo",
                "goal_name": "Goal 1",
                "is_primary_goal": true,
                "revenue_attribute": "Device Height",
                "revenue_currency": "INR"
            }
        ]
    }
}'

 

Sample Response

201 400 401 429 500
{
  "campaign_id": "{Campaign_ID}"
}

Postman Collections

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

FAQs

arrow_drop_down Can I create a Push campaign for just one platform?

Yes. You can create a Push campaign for a single platform such as Android, iOS, or Web. You can also create campaigns for a combination of these platforms.

arrow_drop_down How do I get the template ID required in the Push campaign payload?

Use the Search Push Template API and pass a request parameter such as the template name, created by, or any other supported parameter to retrieve the template ID in the response.

arrow_drop_down How do I decide which fields to include in the content section?

Select a template type, such as Stylized Basic, Timer, or any other available option. Then, refer to the template’s requirements and include all fields marked as mandatory for that template type.

Previous

Next

Was this article helpful?
0 out of 0 found this helpful

How can we improve this article?