MoEngage Streams

Introduction

Streams allow you to forward events like user actions, campaign interaction events, and so on available in MoEngage to a pre-defined API endpoint in near real-time.

With MoEngage Streams, you can configure your API endpoint, define the events that you want to be forwarded, and once done, see a stream of data flowing to your system, which you can then utilize to enrich your data warehouses and recommendation systems, and so on.

Popular Use-cases for MoEngage Streams

A few popular use cases for Streams are as below:

      • Enrich the central data warehouse with MoEngage events like Notification Clicked Android, Email Clicked, SMS Clicked, and so on.
      • Forward the Conversion Events like Purchase, Song Played, Bill Payment Done, and so on from MoEngage to the external Analytics tool.
      • Feed campaign interaction events from MoEngage to your recommendation system.
      • Export the notification interaction data from MoEngage to our ML system for optimizing the performance of our algorithms.
      • Send all user events present in MoEngage to an external own data lake.

Enabling Streams for your account

Please reach out to your Customer Success Manager to get this enabled for your account.  Please note that Streams is only available as a part of a few pricing plans, and you can include this separately when required.

Setting up Streams

Streams can export data to your API endpoint or one of the partners integrated with MoEngage.

Setting up Streams for exporting data to your API endpoint

      1. API Endpoint to send the data. It could be something like https://api.example.com/events
      2. List of events that need to be sent to this API endpoint.
      3. List of User Attributes and Device Attributes that need to be sent to the API endpoint with each event.
      4. If you need all campaign interaction events, we will export such events as mentioned in the next section.

Setting up Streams for exporting data to partners

With Streams, you can export data directly to integrated partners so that you can enrich your marketing/analytics activities on these platforms. As of now, Streams can export data to the following partners:

      1. Mixpanel
      2. Amplitude
      3. Segment
      4. mParticle

Please follow partner-specific integration documents for setting this up.

Campaign Interaction Events

Below is a list of Campaign Interaction Events that MoEngage generates and which you will often need to be sent to your API endpoint:

Event Name Event Code Channel

Email Sent

MOE_EMAIL_SENT

Email

Email Deferred

MOE_EMAIL_DEFERRED

Email

Email Delivered

MOE_EMAIL_DELIVERED

Email

Email Dropped

MOE_EMAIL_DROP

Email

Email Bounced

MOE_EMAIL_HARD_BOUNCE

Email

Email Soft Bounced

MOE_EMAIL_SOFT_BOUNCE

Email

Email Opened

MOE_EMAIL_OPEN

Email

Email Clicked

MOE_EMAIL_CLICK

Email

Email Unsubscribed

MOE_EMAIL_UNSUBSCRIBE

Email

Email Spam Complained

MOE_EMAIL_SPAM

Email

SMS Sent

SMS_SENT

SMS

SMS Delivered

SMS_DELIVERED

SMS

Notification Received Android

NOTIFICATION_RECEIVED_MOE

Push

Notification Clicked Android

NOTIFICATION_CLICKED_MOE

Push

Notification Sent iOS

n_i_s

Push

Notification Clicked iOS

NOTIFICATION_CLICKED_IOS_MOE

Push

Notification Received Web

NOTIFICATION_RECEIVED_WEB_MOE

Push

Notification Clicked Web

NOTIFICATION_CLICKED_WEB_MOE

Push

Connector Sent

MOE_CONNECTOR_SENT

Connector

Card Sent

MOE_CARD_SENT

Cards

Card Delivered

MOE_CARD_DELIVERED

Cards

Card Viewed

MOE_CARD_VIEWED

Cards

Card Clicked

MOE_CARD_CLICKED

Cards

Mobile In-App Shown

MOE_IN_APP_SHOWN

Mobile In-Apps

Mobile In-App Clicked

MOE_IN_APP_CLICKED

Mobile In-Apps

Mobile In-App Closed

MOE_IN_APP_DISMISSED

Mobile In-Apps

On-site Message Shown

MOE_ONSITE_MESSAGE_SHOWN

On-site Messaging

On-site Message Clicked

MOE_ONSITE_MESSAGE_CLICKED

On-site Messaging

On-site Message Closed

MOE_ONSITE_MESSAGE_DISMISSED

On-site Messaging

User Entered Flow

USER_ENTERED_FLOW

Flows

User Exited Flow

USER_EXITED_FLOW

Flows

User Added to Control Group

MOE_CAMPAIGN_CONTROL_GROUP

All channels


With the above events, the following event attributes will be exported by default - campaign_id, campaign_name, campaign_type, campaign_channel
The following event attributes are not supported for export in streams right now - email_subject, email_click_url, inapp_widget_clicked, onsite_message_url_clicked.
For more information on when the campaign events and attributes are tracked, please refer to this article.

API Request Format

When Streams sends an event to your API endpoint, the request format will be as below: 

Headers:

"Content-Type" : "application/json"

Request Body:

JSON
{
    "app_name": "App Name",
    "source": "MOENGAGE",
    "moe_request_id": "moengage unique request id for each request",
    "events": [{
        "event_name": "Notification Received Android",
        "event_code": "NOTIFICATION_RECEIVED_MOE",
        "event_uuid": "moengage unique id for each event",
        "event_time": 1580967474,
        "event_type": "CAMPAIGN_EVENT",
        "event_source": "MOENGAGE",
        "push_id": "recipient device’s push token",
        "uid": "<MoEngage customer_id>",
        "event_attributes": {
            "campaign_id": "353df897hkbh67658",
            "campaign_name": "Name of the Campaign",
            "campaign_type": "Event Trigger",
            "campaign_channel": "Push"
        },
        "user_attributes": {
            "moengage_user_id": "moe_internal_user_id",
            "user_attr_1": "user_attr_val1",
            "user_attr_2": "user_attr_val2"
        },
        "device_attributes": {
            "moengage_device_id": "moe_internal_device_id",
            "device_attr_1": "device_attr_val1",
            "device_attr_2": "device_attr_val2"
        }
    }, {
        "event_name": "Email Sent",
        "event_code": "MOE_EMAIL_SENT",
        "event_uuid": "moengage unique id for each event",
        "event_time": 1580967474,
        "event_type": "CAMPAIGN_EVENT",
        "event_source": "MOENGAGE",
        "email_id": "recipient email_id",
        "uid": "<MoEngage customer_id>",
        "event_attributes": {
            "campaign_id": "353df897hkbh67658",
            "campaign_name": "Name of the Campaign",
            "campaign_type": "General",
            "campaign_channel": "Email"
        },
        "user_attributes": {
            "moengage_user_id": "moe_internal_user_id",
            "user_attr_1": "user_attr_val1",
            "user_attr_2": "user_attr_val2"
        },
        "device_attributes": {
            "moengage_device_id": "moe_internal_device_id",
            "device_attr_1": "device_attr_val1",
            "device_attr_2": "device_attr_val2"
        }
    }, {
        "event_name": "SMS Delivered",
        "event_code": "SMS_DELIVERED",
        "event_uuid": "moengage unique id for each event",
        "event_time": 1580967474,
        "event_type": "CAMPAIGN_EVENT",
        "event_source": "MOENGAGE",
        "mobile_number": "recipient mobile number",
        "uid": "<MoEngage customer_id>",
        "event_attributes": {
            "campaign_id": "353df897hkbh67658",
            "campaign_name": "Name of the Campaign",
            "campaign_type": "Event Trigger",
            "campaign_channel": "SMS"
        },
        "user_attributes": {
            "moengage_user_id": "moe_internal_user_id",
            "user_attr_1": "user_attr_val1",
            "user_attr_2": "user_attr_val2"
        },
        "device_attributes": {
            "moengage_device_id": "moe_internal_device_id",
            "device_attr_1": "device_attr_val1",
            "device_attr_2": "device_attr_val2"
        }
    }]
}

Streams Data Glossary

The keys in the API request and their description is as below:

Key Description
app_name Your app name in MoEngage
source Source = MoEngage to identify the requests coming from MoEngage
event_name Display the Name of the event. This is also the name for the event that you will see on the MoEngage dashboard.
event_code Event code as present in the MoEngage system. This is not visible on the MoEngage dashboard but is the raw event name that we save in the MoEngage database.
event_uuid This is the unique event identifier for each event added by MoEngage. You can use this for de-duplication.
event_time Time of event in UTC, format - epoch time in seconds. This is the time when the event happened.
event_type CAMPAIGN_EVENT or USER_ACTION_EVENT to differentiate between campaign events and user action.
event_source This will have value = MoEngage for you to identify that MoEngage is the source of these events.
push_id
Push token of the device to which the push notification was sent. This will only be available for push-related events.
email_id
Email Id to which the email was sent. This will only be available for email-related events.
mobile_number
Mobile Number to which the SMS was sent. This will only be available for SMS-related events.
uid
MoEngage customer_id to uniquely identify a user in MoEngage
campaign_name
Campaign Name in MoEngage
campaign_id
Campaign Id in MoEngage
event_attributes
Additional event attributes, dictionary
campaign_channel
Campaign Type - Push / Email / SMS
user_attributes
Additional user attributes, dictionary
moengage_user_id
MoEngage internal user-id
device_attributes
Additional device attributes, dictionary
campaign_type
Type of campaigns like PERIODIC, ACTIVE, ONETIME.
variation_id
Present with event_type = CAMPAIGN_EVENT when the campaign has multiple variations.
locale_id
Present with event_type = CAMPAIGN_EVENT when the campaign has multiple locales.
locale_name
Present with event_type = CAMPAIGN_EVENT when the campaign has multiple locales.
parent_campaign_id
Present with event_type = CAMPAIGN_EVENT when the campaign has multiple locales.
parent_flow_id Present for campaigns that are created inside a MoEngage Flow campaign.
parent_flow_name
Present for campaigns that are created inside a MoEngage Flow campaign.

Limitations

Please be aware of the following constraints/limitations while integrating Streams with third-party apps.

  • We can send data to only one static endpoint where the access token or link has no expiry. We cannot integrate it on a dynamic endpoint where the access token is refreshed every few hours.

  • We cannot modify the body or key names while streaming the data from MoEngage.

 

 

 

Was this article helpful?
9 out of 12 found this helpful

How can we improve this article?