Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/joyarzun/jenkins-slack
- Owner: joyarzun
- License: mit
- Created: 2017-08-15T15:55:50.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-08-15T20:00:25.000Z (about 7 years ago)
- Last Synced: 2024-10-01T15:24:09.196Z (about 1 month ago)
- Topics: jenkins, nodejs, slack
- Language: JavaScript
- Size: 69.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE.txt
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.