Trigger Business Event API

Overview

This API allows you to trigger a business event in MoEngage. You can set up campaigns to be executed when these events are triggered.

API Endpoint

API Endpoint
POST https://api-0X.moengage.com/v1.0/business_event/trigger

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

Basic authentication sends a Base64-encoded string containing a username and password for all API requests. For example, Basic Authentication encodes a 'username:password' using base64 encoding and prepends it with the string 'Basic '. The string is passed in the authorization header as follows:

{"Authorization":"Basic bmF2ZWVua3VtYXI6bW9lbmdhZ2U="}

To fetch the username and password details :

  1. Navigate to Settings > APIs > TRANSACTION PUSH/REPORT Settings.
  2. Click on the link - Click here to show API Secret to view the API Secret key.
  3. User name - APP ID and Password - API SECRET

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 e3tEQVRBX0FQUF9JRH19Ont7REFUQV9BUElfS0VZfX0=} This is the authentication parameter for access control and needs to be passed along with the request. The APP ID and API SECRET need to be picked up from the TRANSACTION PUSH API Settings in MoEngage Dashboard, and a Basic Authorization header needs to be created and set in the header. Navigation: Settings -> API -> General Settings -> TRANSACTION PUSH/REPORT SETTINGS section. For more information, refer to Authentication.

Request Body

Key Required Values Description
event_name Yes String

This field contains the name of the business event to be triggered

Example: "event_name": "NameOfOTTSeries"

event_attributes Yes JSON Objects

This field contains the event attributes with which the business event will be triggered.

Structure:

"event_attributes": {

   "attribute_name1": "<attribute value>",

  "attribute_name2": "<attribute value>",

  "attribute_name3": "<attribute value>",

}

Every attribute contains the following information:

attribute_name - This field contains the name of the business event attribute for which the value is being sent in the request. The attribute_name is a String. 

Example: "attribute_name": "season"

triggered_by No String

This field contains information about who triggered the business event. 

Example:  "triggered_by": "john.doe@example.com"

Response

Key Data Type Description
message String

This field contains information about whether the request was successful or not.

Example:

"message": "The business event has been triggered"

error JSON Object

This field is present in the response only in case of an unsuccessful request and contains the following fields:

      • code - This field contains the error code.
      • message - This field contains the error message.
      • details - This array contains the specifics and describes the error in detail.
      • request_id - This field contains the request id of the failed request.

Response Codes

Status Code Request State Description
200 Success This response is returned when the request is processed successfully. 
400 Bad Request This response is returned when the required parameters are missing from the request or when the provided parameters are invalid.
401

Authorization Failure

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

Rate Limit Breach

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

500 Internal Server Error This response is returned when the system runs into an unexpected error.

Rate Limit

The rate limit is 100 RPM.

Sample cURL

cURL
curl --location 'https://api-0X.moengage.com/v1.0/business_event/trigger' \
--header 'Content-Type: application/json' \
--header 'Authorization Basic Base64_ENCODED_APPID_APISECRET==' \
--data '{
  "event_name": "Series_Name",
  "event_attributes": {
      "season": "Season 1",
      "episodes": 12,
      "cast": ["John Doe", "Jane Doe"],
      "date": "11/11/2023" },
   "triggered_by": "john.doe@example.com"
}'

Sample Response

200 400 401429 500
Sample Response for a successful request
{
   "message": "The business event has been triggered"
}

Postman Collections

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

FAQs

  • Do I need to pass the value for all event attributes while triggering the campaign?
    No, it is not required to pass all the attributes while triggering the business event.
  • How do I know if the campaign has been triggered successfully?
    You can view the campaign analytics to see if the campaign for the business event has been triggered successfully. Navigate to Engage -> Campaigns on the MoEngage Dashboard and search for the campaign associated with the Business Event. You can see the child campaign's performance here with the details of all the campaigns that have run for the business event till now.
Was this article helpful?
0 out of 0 found this helpful

How can we improve this article?