Back to all Usecases
How to Alert drop in Stock Price using Business Events

Introduction

As a marketer, if you want to alert your users about a drop in the price of their favorite stock, you need not manually send a campaign to the target audience every time a new episode is released. In this article, we will learn how you can create campaigns once in a lifetime and just watch how MoEngage does the rest of the job for you. We will use Business Events in MoEngage to achieve this.

With Business events, you can automate the entire campaign process without the need of any manual intervention and still ensure the relevant values are picked up dynamically to provide the correct context, hence can offer the right communication at the right time for your customers.

library_add_check

Prerequisites

  • Enterprise plan with the Business Events feature enabled for your account.
  • Events to track the interest of the customer in a particular stock. In this example, we will name the event at "Stock Viewed". When a customer checks a stock’s details, an event can be triggered with the name or the ID of the stock. To understand how to track events, refer to the Developer Guide.

Create a Business Event

In this section, let us create a Business Event for your account, which will help create an event template to capture all the required details. We can use the MoEngage Business Event public API. For our example, the following information is a part of the Business Event:

  • Event name: “Stock Price Drop Alert"
  • Attributes of the event and their data type:
    • Stock ID - string
    • Percentage Drop - string
    • Current Stock Price - float

Perform the following steps:

  1. Write the information above in the JSON format and send to MoEngage through Postman.
    JSON
    {
    "event_name": "Stock Price Drop Alert",
    "event_attributes": [
    {
    "attribute_name": "Stock ID",
    "attribute_data_type": "string"
    },
    {
    "attribute_name": "Percentage Drop",
    "attribute_data_type": "string"
    },
    {
    "attribute_name": "Current Stock Price",
    "attribute_data_type": "float"
    }
    ],
    "created_by": "john.doe@example.com"
    }
  2. Use the information above in the JSON format and make the API call with Authorization information to the right data center your DB belongs to. For more information, refer to Create Business Event API.
    After the API call is made and the event is created successfully, MoEngage sends the following response:
    JSON
    {
    "message": "The business event has been created",
    "_id": "64a40cff5547a6b2c5b14404"
    }
  3. To verify if the event is successfully added, open the MoEngage Dashboard and go to any Business Event Triggered campaign. From the Select business event drop-down list, you can check for your event. You can see the "Stock Price Drop Alert" event.
    6.png

Create a Push Campaign

In this section, let us create price drop alerts through business event-triggered Push notifications for the favorite stock of your users.

Step 1: Target Users

  1. Navigate to the sidebar on the left and click Engage > Campaigns and click + Create campaign or click + Create new > Campaign.
  2. Under Outbound, select PushBusiness Event Triggered.
    3.png
    You are taken to the first step "Target users" of defining your campaign.
  3. Enter the following details:
    1. Team: Select a team if your organization has teams enabled for your account. For more information, refer to Teams in MoEngage.
    2. Campaign name: Enter a name for the campaign. For example, "Stock Price Drop Alert".
    3. Campaign tags: Select the required campaign tags.
  4. From the Select business event drop-down list, select the "Stock Price Drop Alert" event.
    6.png
  5. In the Target Audience section, define the logic to identify all the customers who have viewed the stock with the same Stock ID. So for this example, the target audience can be as shown below:
    7.png

    The business event attributes are now available in the drop-down lists. The event attribute’s Stock ID can now have a dynamic value every time the business event is triggered where the value against the business event attribute Stock ID is automatically substituted in the segmentation query.

  6. In the Target Platforms section, select Android.
    1.png
  7. Click Next to move to the second step "Content" where you can define the content that will go into your Push campaign.

Step 2: Content

  1. Select the template that you like to go with. For our example, select Basic notification.
    7.png
  2. Enter the required content for the campaign. We can enter a title, message, and summary manually, or generate it using Merlin AI. For more information, refer to Generate Push Messages with Merlin AI.
    8.png

    The content for such communications would need to have the values picked from the business event’s attributes, which can be done similarly to any other personalization.

  3. Add personalisation to the message using information such as the name of the user. Such personalization makes the message more contextual and makes the users feel connected. To do the same, enter “@". The Push Personalization pop-up is displayed from where you can select the information that can be from the business event or user property of a user.
    9.png
  4. Add a deeplink to this Push message by mentioning the specific URL that directly takes them to the page in your App or website where they can check their ticket details.
  5. Click Next to move to the third step "Schedule and goals" where you can define the schedule and goal of your campaign.

Step 3: Schedule and Goals

  1. Define when to start and end this campaign and the conversion goal based on your requirements.
  2. Change the deliverability settings based on your requirements. For more information, refer to Create Push Campaigns.
    10.png
  3. Click Publish.

Trigger Campaign by Triggering Business Events

We are now ready to start triggering the communications. When a stock price drop is detected, the campaign can be triggered using the Trigger Business Event trigger. The logic of when to pass this event to MoEngage lies at the client’s end based on the business requirement.

Here is a payload example:

JSON
{
"event_name": "Stock Price Drop Alert",
"event_attributes": {
"Stock ID": "GOOG",
"Percentage Drop": "10%",
"Current Stock Price":136.65},
"triggered_by": "john.doe@example.com"
}

Conclusion

In this use case, we created price drop alerts through Push notifications for the favorite stock of your users. We used Business Events in MoEngage to achieve this.

Now that we have published the Campaign, we can test the same using MoEngage APIs. For more information, refer to Business Event Triggered Campaigns.

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

How can we improve this article?