Code Monkey home page Code Monkey logo

gollum-slack's Introduction

Rationale

Many projects keep their knowledge base in GitHub wiki. Many of us use Slack. Some of us would like to be notified when pages are being created/edited, and unfortunately this is not supported by GitHub.

GitHub Webhook is not format compatible with Slack Webhook handler.

Synopsis

This project is a shim between GitHub Webhook and Slack Webhook handler performing a trivial JSON transformation that on a free Heroku tier.

Installation

Deploy gollum-slack application to Heroku

git clone [email protected]:pirj/gollum-slack.git
cd gollum-slack
heroku create
git push heroku master
WEBHOOK_PATH=$(base64 /dev/urandom | tr -d 'A-Z/+' | head -c 32)
heroku config:set WEBHOOK_PATH=$WEBHOOK_PATH

Set up Slack incoming webhook

Point gollum-slack to your Slack webhook handler

heroku config:set SLACK_URI=https://hooks.slack.com/services/BLAH/BLAH/WOOBAHDOOBAH

Point GitHub to gollum-slack application

Use URL that consists of 'Web URL' from heroku info and path from echo $WEBHOOK_URL

Override default notification template

Slack webhook handler format

Basically Slack is expecting webhook in the following format:

{
  "text": "New Help Ticket Received: http://domain.com/ticket/123456"
}

More information here: https://api.slack.com/custom-integrations

Default template

#{sender.login} has #{pages.first.action} page '#{pages.first.title}' at #{pages.first.html_url}

Usually resulting in something like

pirj has created page 'Home' at https://github.com/pirj/gollum-slack/wiki/Home

Gollum webhook format

https://developer.github.com/v3/activity/events/types/#gollumevent

Gotchas

No, there is no event for page delete.

No, Edit Message is not in payload.

There is a SHA-1 of this revision in payload, but there is no link to compare this to previous revision, and previous revision SHA-1 is not in payload.

gollum-slack's People

Contributors

pirj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  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.