Simple Lambda function to customise ZenHub event notifications to Slack.
By default, ZenHub's Slack Integration sends notifications when an issue is moved between any pipelines, estimate is set or cleared and when an issue is moved up or down a pipeline. This can become overwhelming for large projects, and so we need to use Zenhub's custom webhook integrations to control what type of events are notified on Slack.
- Download the latest build from releases.
- Alternatively, if you want to build it yourself, clone this repo and install the dependency. (Run
npm installoryarnin project root) and create the deployment package by zipping the project folder (On MacOS, Runzip -r build.zip *in project root). - Create a Lambda function in AWS with basic lambda execution policy and upload the build.zip.
- Set API Gateway as the trigger and provide a name to the API. Configure authentication as open, since ZenHub can only trigger open webhooks. Copy the execution url provided by API Gateway after saving the changes.
- To control what events are sent, set
EVENT_TYPESenvironment variable to one of possible Zenhub event types. Also accepts multiple comma separated values. (issue_transfer,estimate_set,estimate_cleared,issue_reprioritized). - Create an incoming webhook on Slack and set the url in the
SLACK_WEBHOOK_URLenvironment variable. - To get issue transfer notifications for only some pipelines, you can optionally set
PIPELINESenvironment variable with the comma-separated names of the pipelines in your project. Note: This value is ignored ifissue_transferis not set inEVENT_TYPES. - If you want to tag certain people on Slack when there's activity on a particular pipeline, you can optionally set the
TAG_MAPenvironment variable which is a JSON map of pipeline names to Slack names (multiple names are separated by white-space). For instance, if you want to tag@nrand@test-teamwhen there's movement inIssuespipeline, you should create aTAG_MAPenv var with the value{"Issues": "@nr @test-team"} - Finally, on ZenHub Dashboard, on the Integrations tab create a new custom integration. Select the repo to connect, and provide the Lambda execution url as the webhook url.
- In addition to this, if you would like monitor dependencies and send alerts when they get cleared, set
DEPENDENCY_PIPELINESenv variable similar toPIPELINES. You'll also need to set theDEPENDENCY_REPO_IDin which dependencies are being marked and the ZenHub API tokenZH_API_TOKENto fetch these dependencies. (Refer ZenHub's API for more on these 2 variables.)