Code Monkey home page Code Monkey logo

oncall-bot's Introduction

This bot maintains a single Slack channel's topic to contain the name of the level-1 on-call user for a given PagerDuty schedule ID.

Create a settings.json file like:

{
  "pagerduty": {
    "scheduleID": "ID",
    "pagerdutyToken": "TOKEN"
  },
  "slack": {
    "channelName": "galaxy-alerts",
    "slackToken": "TOKEN1",
    "slackAdminToken": "TOKEN2"
  },
  "intervalMS": 30000,
  "statusUsers": {
    "U02FWGZ19": "[email protected]"
  },
}
  • In PagerDuty
    • Log in as an Admin-role user
    • Configuration -> API Access
    • Create New API Key
    • Make it a V2 Current token, Read-only.
    • Copy the token value into the pagerduty.pagerdutyToken settings field
    • Navigate to the page for the schedule you want to monitor. Its URL is something like https://meteorjs.pagerduty.com/schedules#PTJS3I9 Copy the final bit (PTJS3I9) to the pagerduty.scheduleID settings field
  • In Slack
    • Register an app at https://api.slack.com/apps
    • Select Permissions and add:
      • channels:read
      • channels:write
      • users:read
    • Click "Install App To Team" and select the appropriate team
    • This provides an Access Token. Copy it into the slack.slackToken settings field
    • Now get a Slack team admin to follow the same steps, but with only the permission users.profile:write. Put its Access Token into slack.slackAdminToken. This is used to set the status emoji and text for arbitrary users.

Users listed (by Slack ID) in the status section will have their status text and emoji set as configured when they are on call, and cleared if they are not on call any more and their status starts with 'On call!'. (If they already have a status, it is appended to the 'On call!' status text along with its emoji, and restored when they go off call.)

The simplest way to find a Slack ID is to run users.list via the Slack API tester and find the id field corresponding to the user.

Deploy to Galaxy. (This is deployed to galaxy-primary-oncall-bot.meteorapp.com.)

oncall-bot's People

Contributors

glasser avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.