Skip to content
Create Clubhouse stories from PagerDuty events with Lambda
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
LICENSE
README.md
handler.js
package.json
serverless.yml

README.md

pd2ch

Pagerduty to Clubhouse

Operations teams usually leverage some sort of ticket or work tracking system - at Life360, we use Clubhouse to track our work, and incidents are part of our everyday workload. When a team member creates an incident or an automatic one is triggered along certain pathways, this Serverless function will create a Lambda and ingest Pagerduty events and write them to Clubhouse with the incident title and details as a story, where we can track further work during or post-incident.

pd2ch is written in node.js and is licensed under the MIT License.

Installing

Prerequesties

  • npm
  • AWS Account with CloudFormation, API Gateway + Lambda access
  • Clubhouse API token, Project ID and Workflow State

Configuration

serverless.yml

# Serverless config

service: pd2ch

provider:
  name: aws
  runtime: nodejs6.10
  stage: prod
  region: us-west-2

functions:
  createStory:
    handler: handler.createStory
    events:
      - http:
          path: incident
          method: post

# Enter your Clubhouse-specific variables here:
    environment:
      CLUBHOUSE_API_TOKEN: 'EXAMPLE'
      CLUBHOUSE_PROJECT_ID: 00000000
      CLUBHOUSE_DEFAULT_WORKFLOW_STATE: 00000000

Config is straightforward. Simply enter the API credentials from Clubhouse (https://app.clubhouse.io/life360/settings/account/api-tokens), and enter your token.

Clubhouse project ID (found in the URL when you go to your project, e.g. /company/project/5, 00000005 is your project ID.)

Workflow state can be found by searching under a workflow, e.g. Blocked will return state:500000015.

Deploying

# Install the serverless client
npm install -g serverless

# Clone pd2ch
git clone https://life360.com/pd2ch && cd pd2ch

# Deploy pd2ch to AWS
serverless deploy -v

If successful, you can navigate to API Gateway in your AWS console and find the Lambda with the API endpoint, e.g. https://xxxxxxxxx.execute-api.us-west-2.amazonaws.com/prod/incident

Integrating into Pagerduty

Integration is straightforward. Simply go to the Service that you want to create stories from incidents, go to Integrations, and click on New Extension. Create a Generic V2 Webhook and enter in the endpoint from above.

Once that's done, Pagerduty incidents will create Clubhouse stories in any state you desire.

Using

# Publish a test story
serverless invoke -f createStory --data '{$example_pagerduty_payload}'

Notes

pd2ch uses a public AWS API Gateway endpoint, but the endpoint will only accept traffic from Pagerduty nodes via calling their webhook endpoint at https://app.pagerduty.com/webhook_ips, which will return a list of valid Pagerduty IP's.

You can’t perform that action at this time.