Cohort Notifications
Moesif supports notifications through saved cohorts for both Users and Companies. Unless this document states explicitly, it uses the term user to represent both Users and Companies for simplicity.
With User and Company Notifications, you can receive notifications when customers match specific behaviors. This might include scenarios such as when a user has made their first API call or when a user hasn’t sent any traffic through your APIs after a definite number of days.
Saved cohorts power all User and Company notification capabilities. For example, let’s say you create a cohort named “New users who made their first API call today”. This creates a group, or cohort, of users who make their first API call today. Whenever a new user signs up for your product and makes their first API call, Moesif adds that user to the cohort. If you configure notifications in your cohort, Moesif notifies you whenever Moesif adds a new user to the cohort, or removes a user from the cohort.
Saved cohorts drive a massive amount of functionality within Moesif. The following example use cases demonstrate how you can use cohorts:
- Trigger marketing automation workflows such as when a customer makes their first API call.
- Receive Slack notifications on struggling customers with issues and proactively reach out.
- Get email update when customers stop sending traffic.
Alert Rules versus Cohort Notifications
Moesif has two different notification systems that you can use for different use cases. This document focuses on User Notifications.
Let’s discuss the differences between these two systems:
- User Notifications sends a list of users or companies that match a specific behavior according to your definition. For example, customers who made their first API call. The notification doesn’t involve any metrics, rather the notification contains a list of customers.
- Alert Rules monitor a time-series metric such as average latency or request volume in real time and alerts you when the metric deviates from what you expect. You can trigger the alert when the metric passes a static threshold or when Moesif detects an anomaly. Alert rules can also work multi-dimensionally that allows you to track metrics on a per-customer level.
The following table further illustrates the differences:
Name | Type | Primary User | Use Case | Example Metrics | Frequency |
User Notifications | User behavior centric | Marketing and Customer Success | Receive notifications on customers who exhibit certain behaviors | Whenever Moesif adds a customer to a cohort (sent as a batch) | |
Alert Rules | Time-series centric | Product & Engineering | Receive alerts when a metric has abnormal behavior or passes a threshold | Real-time or specific intervals |
How to Set Up Cohort Notifications
Step 1: Create a Saved Cohort
Follow the instructions in Creating a Cohort to create a cohort.
Step 2: Create the Cohort Notification
After you create a saved cohort, select Notification ✐ in the Cohort Actions pane.
In the Set Up User Cohort Notification dialog that appears, fill out the details of your notification:
- Recipient
- Select a notification channel in the Send to field to specify where you want to send the notifications to. The following channels are supported:
- Slack
- Webhooks
For more information, see Adding a channel.
- Notification trigger criteria
- In Send when, select the condition when you want Moesif to send notifications:
- When user joins cohort.
- When user leaves cohort.
- When user either joins or leaves cohort.
- Custom data in notifications
- To include custom data fields in notifications, specify them in Includes custom fields when joining.
- Notification frequency
- In the last two configuration options, you can specify the frequency at which Moesif sends notifications:
- By selecting the Once Only checkbox, Moesif aggregates all alerts within 5 minutes into a single notification. This can help you keep the noise down from multiple notifications spamming the selected channels.
- If you want to receive notifications each additional time a user enters or leaves a cohort, select the User eligible for resend checkbox and specify a time interval.
Finally, select Save to finish your notification configuration for the cohort.
Adding a Notification Channel
In configuring notification for a cohort, you have to select a channel in the Send To field to send cohort notifications to. A channel defines communication method to receive notifications. Notification channels make it easier to ensure the right people receive the right notification alerts. Moesif supports the following channel types for cohort notifications:
- Slack
- Webhooks
To add a new channel, in the Send to field, select New channel…. The Create Notification Channel dialog appears where you need to fill in the details of the notification channel.
Channel Name
Give your channel a friendly name such as Support Team or Backend Alerts. If you create multiple channels, this helps identify the audience.
Channel Type
Select the type of channel you want to create. Depending on the type you select, additional input fields may appear such as Slack webhook URL or email address.
The following channel types are supported:
- Enter your email address of choice where Moesif sends email notifications to.
Add team@moesif.com to your address book to ensure email notifications don’t land in your spam folder.
- Slack
- Moesif routes Slack alerts to a specific Slack channel. You must reate a Slack hook URL by following Slack’s Incoming WebHooks instructions.. Then paste your Slack hook URL in the Slack Webhook URL field.
- Webhook
- To receive notificaiton through a webhook, enter your webhook URL and select the corresponding HTTP method you want to allow.
Webhooks enable leveraging of Moesif’s alerting infrastructure to trigger automated workflows in your infrastructure unlocking a large variety of use cases. This allows you to trigger workflows for consumption-based billing, marketing automation, and more, all from customer API usage data in Moesif.
To authenticate webhook requests as coming from Moesif, we strongly recommended that you add a secret key in a HTTP request header. For security, Moesif only allows webhooks protected by HTTPS.
Notification Throttle
Set a reasonable throttle for this alert. This prevents spams with a storm of alerts. After Moesif sends the first notification, Moesif silences additional alerts. You can still see silenced notifications within the Alert History page.
Moesif has a correlation engine which detects related anomalies or triggers and consolidates them in the same notification. Throttling only impacts separate notifications.
Receiving Notifications
You receive notifications as Moesif adds or removes customers from your cohort based on their behavior. To avoid sending too many notifications, this happens in batches, usually within 15 to 30 minutes.