Skip to content

SLA Buddy: a helpful robot to help you meet Service Level Agreement in Slack

License

Notifications You must be signed in to change notification settings

mansueli/slabuddy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SLA-buddy mascot SLA Buddy

SLA Buddy: a helpful robot to help you meet Service Level Agreement in Slack.

This bot started as an internal tooling project to help enforce and meet SLAs at Supabase. It borrows many mechanisms and most of the functionality designed in supa_queue while extending them to be a standalone product.

Pre-requisites

  • Supabase logo Supabase
    • pg_cron
    • pg_net
    • Vault
    • Edge Functions
  • SLA-buddy mascot Slack API

Supported ticketing PlatformsÂą:

Currently supported Includes Edge Function? Has setup guide?
Zendesk Yes Yes
Freshdesk Yes Yes

Note

  1. We encourage contributions to include other Help/Support platforms.
  2. Platform specific Edge Functions are in this directory

How it works:

Here's the top-level diagram explaining how it works: slabuddy drawio

  • It monitors for new tickets in a few slack channels. For example, you could set different priorities depending on the Tier/Plan of your customer.

  • If there is no message after an X amount of time, then it will post on the channels to alert people working in support.

  • You can respond in the thread with a @mention to the bot, so they will know you acknowledged the ticket and will delay future comms in 30 min.

Installing

Get a Supabase Project

  • Setup a Supabase project for the bot here
  • Install the Supabase CLI
  • Login to your Supabase instance in the CLI
  • Run the initial.sql in the database.
  • Deploy the Supabase Edge Functions with the option --no-verify-jwt

Integrate Help Platform with Slack

It will depend on the integrations available but we recommend setting each slack channel for each level of Priority you have example: (Enterprise, Teams, Pro, Free). This allows you to set different SLA enforcements on each of them.

Deploy Bot to Slack:

Use this manifest to create the bot:

{
    "display_information": {
        "name": "Sla Buddy",
        "description": "Your helpful fren",
        "background_color": "#4061c7"
    },
    "features": {
        "bot_user": {
            "display_name": "Sla Buddy",
            "always_online": false
        },
        "slash_commands": [
            {
                "command": "/add-support-engineer",
                "url": "https://supabase.slabuddy.com/functions/v1/modal-handler/add-engineer",
                "description": "adds an new support engineer to SLA Buddy",
                "usage_hint": "Just run it without arguments and use the modal",
                "should_escape": false
            },
            {
                "command": "/sla-setup",
                "url": "https://supabase.slabuddy.com/functions/v1/modal-handler/sla-setup",
                "description": "setup or edit the configuration for a given channel",
                "usage_hint": "Just run it without arguments and use the modal",
                "should_escape": false
            }
        ]
    },
    "oauth_config": {
        "scopes": {
            "bot": [
                "app_mentions:read",
                "channels:history",
                "channels:join",
                "channels:read",
                "chat:write",
                "links:write",
                "users:read",
                "commands",
                "files:write",
                "chat:write.public"
            ]
        }
    },
    "settings": {
        "event_subscriptions": {
            "request_url": "https://supabase.slabuddy.com/functions/v1/get-mentions",
            "bot_events": [
                "app_mention"
            ]
        },
        "interactivity": {
            "is_enabled": true,
            "request_url": "https://supabase.slabuddy.com/functions/v1/modal-handler/modal"
        },
        "org_deploy_enabled": false,
        "socket_mode_enabled": false,
        "token_rotation_enabled": false
    }
}

Note

You'll need to edit the URLs being called according to your project URL on Supabase.

Setting the secrets in Vault & Edge Functions:

It is necessary to set up secrets to get the SLA Buddy working. In this section we go over the secrets that need to be set.

Vault Secrets (used within database):

  • service_role
  • Supabase API URL

Example:

service_role: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InNsYWJ1ZGR5Iiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsInlvdSI6ImFyZSBzbmVha3kg8J-kq_CfmYMiLCJpYXQiOjE2NTQ1NDA5MTYsImV4cCI6MTk3MDExNjkxNn0.eGFfzIM05qy6ALGVJ4rCSiadFThqeGfCxCdfK_Zyus0
supabase_api_url: https://slabuddy.supabase.co

Secrets (Edge Functions):

  • SLACK_BOT_TOKEN
  • SLACK_ORG
  • GIPHY_API (optional // requires minor tweaking in an edge function to remove this)
  • Help Platform secrets [depends on the platform detailed instructions below]

FAQs:

Frequentely Asked Questions

Can I use this in the Supabase Free plan?

Yes, on a busy day, you should expect up to around 7500 edge function invocations/day which would sum up to 225k invocations/month in the billing period. The memory might be constrained. If you want to make it more reliable, a Pro Plan + small compute add-on is recommended. This would be 30$/month if you don't use supabase for anything else, but around 15$/month if you already use a pro Supabase org.

Why I cannot disable SLA Buddy? ( it just postpones messages with @mentions)

We believe that even if you are unable to answer to a user, you should still be able to give them some information about the next steps. E.g I am escalating this to the responsible team and a human-provided message will enhance the trust of your users.

What are the recommendations for setting it up?

We believe that the trickiest part of a good experience is to nail the first two escalation levels. Since these will be the most widely used, it should be the least intrusive as possible. So, you should customize the Edge-Function post-ticket-escalation with more personalized tagging ensuring that it fits your team.

Configuration

  • Add Support engineers to the Bot using the slash command /add-support-engineer
  • Add @SLA Buddy to the channels that receive ticket information
  • Set the escalation levels & messages with /sla-setup

FreshDesk setup:

Instruction guide for setting up with Freshdesk

1. Add the Slack Integration for FreshDesk:

https://support.freshdesk.com/support/solutions/articles/206103-the-slack-app

2. Create and configure channels to receive the notifications:

To push notifications to Slack when new tickets are created in Freshdesk, go to Admin > Workflows > Automations > Ticket creation tab > New rule

3. Format expected to parse the messages:

*Ticket ID*: <message here>
*Ticket priority*: <priority here>
*Type*: <extra data for the ticket>

4. Use the /sla-setup slash command to set SLA Buddy to monitor the channel

5. Setting the secrets for the Freshdesk Edge Function:

Setting the Freshdesk secrets to be available on Supabase Edge Functions:

Secrets needed:

  • FRESHDESK_DOMAIN
  • FRESHDESK_API

Zendesk setup:

Instruction guide for setting up with Zendesk

1. Setup Zendesk to send Slack Notifications to Slack:

https://support.zendesk.com/hc/en-us/community/posts/4409515204506-Send-notifications-to-Slack

2. Create and configure channels to receive the notifications:

3. Format expected to parse the messages:

This is the format expected by the scanner edge function:

*Ticket ID*: <message here>
*Ticket priority*: <priority here>
*Type*: <extra data for the ticket>

You can check this guide for sending slack messages. Example of attachment to use for the message box:

{
 "attachments": [
    {
      "fallback": "New problem ticket created: {{ticket.id}}",
      "pretext": "New problem ticket created: {{ticket.id}}",
      "color": "#D00000",
      "fields": [
        {
          "title": "Ticket ID",
          "value": "{{ticket.id}}",
          "short": true
        },
        {
          "title": "Ticket Priority",
          "value": "{{ticket.priority}}",
          "short": true
        },
        {
          "title": "Type",
          "value": "{{ticket.type}}",
          "short": true
        }
      ]
    }
 ]
}

You can check [Zendesk placeholders](https://support.zendesk.com/hc/en-us/articles/4408886858138-Zendesk-Support-placeholders-reference) if you want to configure more how to pass type and other data.

4. Use the /sla-setup slash command to set SLA Buddy to monitor the channel

5. Deploy the secrets for the Edge Function:

Setting the Zendesk secrets to be available on Supabase Edge Functions:

Secrets needed:

  • ZENDESK_EMAIL
  • ZENDESK_SUBDOMAIN
  • ZENDESK_API_TOKEN

License

This code is licensed under Apache License 2.0.

About

SLA Buddy: a helpful robot to help you meet Service Level Agreement in Slack

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published