Get Child Campaigns of Periodic and Triggered Campaigns

You can use the Get Child of a Campaign API to get the child campaign details of a Periodic or Business Event-triggered campaign in MoEngage. This API can fetch the following details:

  • Child campaign ID
  • Sent time
  • Status
  • How many times a parent campaign is executed
info

Information

  • Currently, you can use this API to get the child of Periodic and Business Event-triggered Email campaigns only.
  • You can get the child of only those Email campaigns that are created using the Create Campaigns API.

API Endpoint

API Endpoint
POST https://api-0X.moengage.com/core-services/v1/campaigns/{{parent_campaign_id}}/executions

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 bmF2ZWVua3VtYXI6bW9lbmdhZ2U="}

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

  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 Dashboard:

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

For more information, refer to Authentication.

Request Body

Key Required Values Description
limit Required Number

This field denotes the number of campaigns to be displayed on a page.

Note: The maximum limit is 15.

page Required Number This field denotes the number of pages to display the campaigns based on the limit. For example, if there are 200 campaigns and you set the limit to 10, there will be 20 pages.
request_id Required String This field denotes the request ID for which the child campaign is fetched.

Response

Key Data Type Description
executions Array

This field contains the execution details. This array contains the following item fields:

  • campaign_id: This field is of String type and indicates the child campaign ID.
  • sent_time: This field is of String type and indicates the time when the child campaign was sent.
  • status: This field is of String type and indicates the Status of the child campaign. For example, Sent and Sending.
total_instances Number

Total number of times the parent campaign is executed.

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

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

500

Internal Server Error

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

Sample cURL Request

The following are sample codes to:

  • Get child campaigns of a Periodic campaign
  • Get child campaigns of a Business Event-triggered campaign
Periodic Business Event-Triggered
curl --location 'https://api-0X.moengage.com/core-services/v1/campaigns/{{parent_campaign_id}}/executions' \
--header 'MOE-APPKEY: {{Workspace_ID or APP_ID}}' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {{Authorization_Key}}' \
--data '{
    "request_id": "12347",
    "page": 1,
    "limit": 15
}'

Sample Response

200 400 401 500
{
    "executions": [
        {
            "campaign_id": "{Campaign_ID}",
            "sent_time": "2024-06-24T14:30:18.908000",
            "status": "Sent"
        },
        {
            "campaign_id": "{Campaign_ID}",
            "sent_time": "2024-06-24T15:27:45.971000",
            "status": "Sent"
        },
        {
            "campaign_id": "{Campaign_ID}",
            "sent_time": "2024-06-24T15:47:43.528000",
            "status": "Sent"
        },
        {
            "campaign_id": "{Campaign_ID}",
            "sent_time": "2024-06-24T15:54:26.254000",
            "status": "Sent"
        },
        {
            "campaign_id": "{Campaign_ID}",
            "sent_time": "2024-06-24T16:35:01.834000",
            "status": "Sent"
        }
    ],
    "total_instances": 8
}

Postman Collections

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

Previous

Next

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

How can we improve this article?