When a configured alert is triggered, MoEngage sends an HTTP POST request to your designated webhook URL, enabling seamless integration with your internal systems, monitoring tools, or third-party services.
Set Up Your Webhook URL
To set up a webhook destination, you must provide a URL. Your URL must be a publicly accessible endpoint that acceptsHTTP POST requests with a JSON body.
Your webhook URL is the address of your application or service that will listen for and process the incoming alert notifications.
Webhook Payload Structure
All webhook notifications follow a consistent JSON structure. The table below describes each field in the payload. Note that some fields, particularly within theentity_data object, are specific to certain alert types.
| Field name | Data type | Description |
|---|---|---|
alert_id | String | The unique identifier for the alert that was triggered. |
alert_name | String | The user-defined name of the alert. |
alert_type | String | The type of the alert. Possible values: CAMPAIGN_STATS, FLOW_STATS, CAMPAIGN_EXPIRY, APNS_TOKEN_EXPIRY, FACEBOOK_TOKEN_EXPIRY. |
db_name | String | The name of the workspace associated with the alert. |
alert_evaluation_frequency | Object | An object describing how often the alert condition is checked. |
alert_evaluation_frequency.value | Number | The numeric value for the frequency (for example, 1). |
alert_evaluation_frequency.unit | String | The unit of frequency (for example, day, hour). |
alert_triggered_at | String | The ISO 8601 timestamp indicating when the alert was triggered. |
alert_evaluation_criteria | Object | An object containing the specific conditions that triggered the alert. |
alert_evaluation_criteria.name | String | The name of the metric being evaluated (for example, DELIVERY_RATE, EXPIRY_DAYS). |
alert_evaluation_criteria.operator | String | The comparison operator used. For example, gt (greater than), lt (less than). |
alert_evaluation_criteria.threshold | Number | The threshold value that was breached. |
alert_evaluation_criteria.unit | String | The unit for the threshold (for example, percentage, count, day). |
alert_evaluation_criteria.range_start | String | The ISO 8601 timestamp for the start of the evaluation window. |
alert_evaluation_criteria.range_end | String | The ISO 8601 timestamp for the end of the evaluation window. |
alert_evaluation_criteria.moving_avg_range | Object | Available only for relative alerts. Describes the window used to calculate the moving average (for example, the last 7 days). |
entity_data | Object | A flexible object containing details about the specific entities (for example, campaigns, flows) that triggered the alert. This object is not available for certain alerts, such as APNS_TOKEN_EXPIRY. |
entity_data.count | Number | The total number of entities listed in the content array. |
entity_data.content | Array | An array of objects, where each object represents a single entity that met the alert criteria. The fields within each object vary depending on the alert_type. |
entity_data.content object
The following table describes the possible fields in each object in theentity_data.content array.
| Field name | Data type | Description |
|---|---|---|
campaign_name | String | The name of the campaign. |
campaign_id | String | The unique identifier for the campaign. |
flow_name | String | The name of the flow. |
flow_id | String | The unique identifier for the flow. |
version_name | String | The name of the flow version. |
channel | String | The communication channel (for example, PUSH, EMAIL). |
delivery_type | String | The delivery type (for example, PROMOTIONAL, TRANSACTIONAL). |
current_value | Number | The metric’s current value for the entity that triggered the alert. |
moving_avg_value | Number | The metric’s calculated moving average value. Available only for relative alerts. |
expiry_in_days | Integer | The number of days until the campaign expires. |
event_type | String | The type of the event being tracked. |
event_name | String | The name of the event being tracked. |
Verify the webhook signature
To ensure that webhook requests are authentic and originate from MoEngage, we include a digital signature in the request headers.It is recommended to validate this signature on your server to prevent unauthorized access and ensure data integrity.
Signature HTTP header. It is generated by creating a SHA-256 hash of your API key concatenated with the raw request body.
Generate and verify the signature
- Get your Campaign Report API key: Find this key in your MoEngage dashboard by navigating to Settings > Account > APIs.
- Prepare the signature string: Concatenate your Campaign Report API key, a pipe character (
|), and the raw JSON request body. Format:YOUR_API_KEY|RAW_REQUEST_BODY - Calculate the hash: Create a SHA-256 hash of the signature string and encode it as a hexdigest.
- Compare signatures: Compare the hash you generated with the value from the
Signatureheader in the incoming request. If they match, the request is authentic.
Python
Sample Payloads and cURL Requests
Below are samples ofcURL commands demonstrating the POST request and JSON payload your webhook endpoint will receive. Replace 'https://your-webhook-url.com/endpoint' with your actual endpoint URL.
Campaign stats (CAMPAIGN_STATS)
Absolute Threshold Alert
This alert triggers when a metric crosses a fixed value.cURL
Relative Threshold Alert (with Moving Average)
This alert triggers when a metric deviates from its historical moving average. A moving average is the average of a metric over a specific number of past periods (for example, the last 7 days), which helps identify significant deviations from recent performance trends.cURL
Flow Stats (FLOW_STATS)
These alerts are similar to campaign stats but focus on flow-level metrics.cURL
Campaign Expiry (CAMPAIGN_EXPIRY)
This alert notifies you when campaigns are nearing their expiration date.cURL
APNS Token Expiry (APNS_TOKEN_EXPIRY)
This alert warns you when your Apple Push Notification Service (APNS) token is about to expire. Note that this payload does not contain anentity_data object.
cURL
Facebook Token Expiry (FACEBOOK_TOKEN_EXPIRY)
This alert warns you when your Facebook token is about to expire. This payload also does not contain anentity_data object.
cURL
Integrate Alert Management via Webhook URL
Enter connection details
On the Integrate tab, enter the following details:
- Connection name: Enter a name for the connection.
- Connection URL: Enter the webhook URL you created in the Set up your webhook URL section.
Select webhook as an alert destination
After the connection is defined, select the new destination from the Send Alerts On list while creating an alert on the Alert management page. You can select Email, Slack, or both.





