Skip to content

trucknet-io/pivotal-tracker-slack-bot

Repository files navigation

Pivotal Tracker Slack Bot

Build Status Coverage Status code style: prettier

Slack bot for integration with Pivotal Tracker.

Overview

This Slack bot listens for messages with Pivotal story IDs(which look like #123456789), fetches appropriate stories from Pivotal Tracker and posts them as a nice message in Slack.

Pre installation

  1. Get your Slack bot token:
  1. Get your Pivotal Tracker token:
  • Go to your profile
  • Get your API token on the bottom of the page. This is your PIVOTAL_API_TOKEN.

Installation

With Docker image

Just run our trucknet/pivotal-tracker-slack-bot:latest docker image providing SLACK_API_TOKEN and PIVOTAL_API_TOKEN env variables.

From source code

  1. Create .env file and put it in project's root folder.
  2. Paste your environment variables to this file. Your .env file should look something like this:
    SLACK_API_TOKEN=xoxb-xxxxxxxxxxxx-xxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxx
    PIVOTAL_API_TOKEN=aaaaaaaaaabbbbbbbbbbffffffffff00
    
  3. Run npm install and that's it.

Note: instead of creating .env file you can pass SLACK_API_TOKEN and PIVOTAL_API_TOKEN as Node.js env variables.

Start

npm run build to build js
npm start to run the bot
npm run start:dev to watch for file changes and restart bot instance

Note: after the bot is installed and running you need to invite him as a member to your channel in Slack so that he can post new messages.

Tests

npm test to launch all tests.

Unit tests should be near the file with .spec.ts extension. Integration tests should be in tests.

Release

npm test patch/minor/major will start a release/ branch (using git flow), edit package.json (and lock) to update the version, commit, finish the release and push including all branches and tags.

Deployment

You can use project's Dockerfile to build a Docker image.
There are helper npm scripts available in the project:
npm run docker - builds Docker image named pivotal and runs it inside a container also named pivotal.
npm run docker:clean - stops and removes pivotal Docker container, then removes pivotal Docker image.