Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/joyarzun/jenkins-slack

Jenkins notifications for slack
https://github.com/joyarzun/jenkins-slack

jenkins nodejs slack

Last synced: 25 days ago
JSON representation

Jenkins notifications for slack

Awesome Lists containing this project

README

        

Jenkins Slack Notificator
=========

Allow notifications to Slack from Jenkins with a simple Webhook

![Message](./slack.png "Message")

In advance: The image is just referential :p

## Installation

`npm install jenkins-slack --save`

## Usage

const App = require("jenkins-slack");
const config = {
port: 8080
token: "xoxb-XXXXXXXXX",
channel: "XXXXXXXXX" //channel id, not name
};

const app = App(config);

Then, go to your job, configure, and in Job Notifications like:
![Job Notifications](./job.png "Job Notifications")

The next parameters can be customized in config object:

{
route: "/slack-notification",
port: 8080,
processBody: body => ({
name: body.name,
url: body.build.full_url,
status: body.build.status,
scm: body.build.scm
}),
slackPostMessageUrl: "https://slack.com/api/chat.postMessage",
textFormat: data =>
`The job \`${data.name}\` has finished\nStatus: \`${data.status}\``
}

## How to get token and channel

To get a token you can use your own or create an app https://api.slack.com/apps

To obtain channel id you can go to https://api.slack.com/methods/channels.list/test and get a list of channels.

## Contributing

In lieu of a formal style guide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.