Skip to main content
Log inGet a demo

How to Monitor Customer Usage in Slack via SQL

The Slack integration on Hightouch enables you to pull the resources and metrics important to your business via SQL and then get notified when these resources and metrics change, right within Slack of course!

Joshua Curl.

Joshua Curl

November 4, 2020

4 minutes

How to Monitor Customer Usage in Slack via SQL.
  • Each account has their own "workspace" in our app with many users

  • As part of normal usage of the product, users create fictitious resource "widgets" within a workspace

  • Enterprise accounts are expected to create at least 5-10 widgets per week

  • Let's suppose we want to monitor for workspaces whose usage dips below the expected amount. To make this work, we need to write a SQL statement that returns all enterprise tier workspaces with less than 5 widgets created in the last 7 days.

    WITH widget_count_last_7_days AS (
      SELECT workspaces.id, count(*) AS count
      FROM workspaces
      JOIN widgets ON widgets.workspace_id = workspaces.id
      WHERE widgets.created_at > (now() - '7 days'::interval)
      GROUP BY workspaces.id
    )
    
    SELECT workspaces.id, workspaces.name, count
    FROM workspaces
    JOIN widget_count_last_7_days ON workspaces.id = widget_count_last_7_days.id
    WHERE tier = 'enterprise' AND widget_count_last_7_days.count < 5;
    

    The results of this query will contain the IDs and names of the enterprise workspaces whose usage is below normal.

    idnamecount
    743Rite Aid1
    384ALDI1
    528CVS2

    (3 rows)

    Now that we have a query we want to track, we can set up the Slack integration!

    Hightouch detects when rows are added and removed from your query. You can configure a message to be sent for both cases. In this case, we'll leave the latter empty since we're primarily interested in the at risk accounts whose usage has dropped.

    SLACK INTEGRATION.png

    You'll now receive an alert message for each account whose usage has dipped below the normal!

    SLACK INTEGRATION 2.png

    How does this differ from the Slack integrations that BI tools offer?

    Many popular BI tools, like Looker and Metabase, offer a feature where they can schedule and push results to Slack. How these features differ from the Hightouch Slack integration is a pretty natural question.

    A BI tool will dump all results from the query on a set schedule. This is most often used to display aggregate information about some metric over a given time interval. For example, showing some metrics over the last 24 hours every morning.

    What BI tools are not good at is providing a dynamic, near real-time feed of changes in data. As an example, Hightouch could send a feed of sign-ups, as they come, with a low (configurable) latency rather than posting all results to Slack each time.

    All this being said, sometimes you do want to just dump all results from a query on a schedule. If you don't have a BI tool, or yours doesn't have a Slack integration, Hightouch supports pushing all results of a query on a schedule as well.

    Try it for free now

    If you want to try out the Hightouch Slack integration, try it for free now!

    Or, if you'd like to learn more about the Hightouch platform, schedule a 20min demo now or email hello@highotuch.com.

    More on the blog

    • What is Reverse ETL? The Definitive Guide .
  • Friends Don’t Let Friends Buy a CDP.
  • Snowflake

    Marketplace Partner of the Year

    Gartner

    Cool Vendor in Marketing Data & Analytics

    Fivetran

    Ecosystem Partner of the Year

    G2

    Best Estimated ROI

    Snowflake

    One to Watch for Activation & Measurement

    G2

    CDP Category Leader

    G2

    Easiest Setup & Fastest Implementation

    Activate your data in less than 5 minutes