Slackbot for responding to messages that match regexes
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.
src Update code to @slack/client@4.8.0 and fix vulnerabilities Jan 9, 2019
test
.eslintrc.js
.gitignore
.travis.yml Add travis config Jun 27, 2016
LICENSE
README.md Updating linting again Mar 21, 2017
config.js.example
package.json

README.md

regexbot: slackbot with configurable regexes

Build Status

Simple slackbot for responding to messages matching a regex.

Setup

  1. Create a new bot user to get a slack api token.
  2. cp config.js.example src/config.js
  3. Edit src/config.js to have your slack api token and selected regexes.
  4. npm install && npm start
  5. Try it out on a slack channel!

Matching

See config.js.example for examples.

config.js contains a list of regexes, and a corresponding message, or messages (if an array) to show.

A function may also be given; which is called with regex matches.

A simple search and replace for numbers in square brackets then fills in the matches - [0] for the whole string, [1] for the first match, and so on.

An example function is given for Jira, taking a config object. This function will connect to Jira, retrieve the message summary for the given case (if found) and respond with a nicely formatted message/link

Development

npm test to lint and run tests