Creating email alerts with Mode and email filters

Folks often want to set up Mode schedules so that they only get emails about the report when it returns certain results. While this isn't possible natively in Mode today, you can easily set up alerts like this using email filters. The example below shows how to do it in Gmail, though you could set up the same filters in most other email clients. 

Step 1: Add a flag to your Mode report when you want it to trigger your alert

Suppose you've got a report that counts how many people are abandoning their shopping cart right before checking out. You should first add logic to your query so that if you want to be alerted, it adds a distinctive value to your query result.

For example, you could do something like this:

## Report: Shopping Cart Abandonment Report

SELECT abandonment_rate,
       CASE WHEN abandonment_rate > 0.1 THEN 'SHOPPING CART ALERT DANGER DANGER'
            ELSE 'shopping cart performing normally' END AS alert
  FROM cart_abandonments

This alert value should be unique because it's what you'll use filter alerts in your email. Unless “SHOPPING CART ALERT DANGER DANGER” frequently appears in your emails, this example should work.

Step 2: Set up a subscription in Mode that will email you this report

Set up a scheduled share (https://help.modeanalytics.com/articles/share-via-email/) in Mode to send this report to your email address. Make sure to include the embedded data table. The table will be used to identify the alert.

Step 3: Set up automatic email filters

Next, set up a filter in your email client that automatically deletes emails of this Mode report if they don't have the exact text in Step 1. When the report runs and the alert isn't triggered, the text won't be included in the data table in your email and the filter will delete the email. If the alert is triggered, the text will be included, so the filter will let it through and the email will show up in your inbox just like any other.

To do this in Gmail, click on the arrow in the far right of the search bar at the top of your inbox. From here, create a filter that filters out

  1. emails from noreply@modeanalytics.com
  2. that contain the text in the title of your report
  3. and doesn't contain the alert text from step 1.

This filter will delete emails from this report that don't have the alert value, including results that return no rows. 

The picture below shows how to do this in Gmail:



Next, click the “Create filter with this search” link at the bottom of the form. On the next form, choose “Skip the Inbox (Archive it),” “Mark as read,” “Delete it.” 

Fowarding it to a list
Most email clients also allow you to set up filters that automatically forward emails as well. You can use the same process above to automatically forward emails to other emails or email lists.

4replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • Nice. Presumably you could also have it auto-forward to a Slack channel then:

    https://get.slack.help/hc/en-us/articles/206819278-Send-emails-to-Slack

    Reply Like 2
  • Ilse Ackerman Yup, we've done a bit of that ourselves. We've also built some internal hacks on top of our API that can share things into Slack as well (and will be sharing more on that later!)

    Reply Like 1
  • Hey, is there any update on this method ?

    Now, can we create an alert ,only when things will not go fine ?

    Reply Like
  • Hey Charu Solanki , we don't have any updates at this time - sorry! However, I've gone ahead and added your voice to this request. Someone from our team will be in touch if our Product Team decides to move forward with this!

    Reply Like
Like7 Follow
  • 7 Likes
  • 8 days agoLast active
  • 4Replies
  • 1563Views
  • 4 Following

Create A New Discussion

Share your thoughts