Skip to content
This repository has been archived by the owner on Dec 21, 2018. It is now read-only.

TechforgoodCAST/castbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Castbot

Slack integration to help with general CAST admin

Why?

Important new documents are often added to specific folders in the CAST google drive. Google Drive however does not let you filter notifications on a per folder basis (updates on everything that happens in the drive are sent).

As a remote organisation, slack is the primary way in which we communicate as a team, so notifications there are picked up immediately.

It would be great if we could combine finer grained notification settings for google drive and send them to slack.

What?

Castmin Bot is a Haskell Snap server that communicates between the Google Drive API and Slack.

  • Castmin bot polls a google drive folder for new files
  • If it finds files created since it last checked it will notify slack with a message (and links to the files)
  • Notifications can be turned on and off from Slack via a slash-command /castbot on or /castbot off

Get up and running

The project is built using stack (install guides here and here).

install and build the project by running:

> stack build

Google Drive and Slack

You'll need a google drive client_id and client_secret (signup info here).
And to create a new slack app with a webhook and a slash command (api reference here).

Testing Webhooks

To develop webooks locally (i.e. incoming messages from slack to the server), I've been using ngrok which creates a secure tunnel to localhost. When registering a slash command, start ngrok and paste in the temporary url.

Environment Variables

These env vars (in a .env file) are required for the project to work:

PORT="<server port>"
SLACK_WEBHOOK_URL="<webhook url to post new messages to slack>"
GDRIVE_CLIENT_ID="<client id for google drive>"
GDRIVE_CLIENT_SECRET="<client secret for google drive>"
POLLING_SECRET_KEY="<random string for internal http client>"
REDIRECT_URI="<redirect uri for google drive authentication>"
REDIS_URL="<url to redis database>"
SLACK_VERIFICATION_TOKEN="<token sent from slack slash commands>"

Start the application

To start the snap server

> stack build
> stack exec castmin-bot

Test Suite

To run the test suite

stack test

About

slack integration to help with CAST admin

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published