Skip to content

DangerJS plugin to send report & message to Slack

License

Notifications You must be signed in to change notification settings

julon/danger-plugin-slack

Repository files navigation

danger-plugin-slack

Build Status npm version semantic-release Greenkeeper badge

Report to Slack the result of Danger

Usage

Install:

yarn add danger-plugin-slack --dev

To send the Danger report to slack:

// dangerfile.js
import slack from 'danger-plugin-slack'

const options = {
  webhookUrl: "YOUR_SLACK_WEBHOOK_URL" // only the webhook URL is required
}

slack(options) // to invoke at the end of the dangerfile to get the full report

To send a specific message:

// dangerfile.js
import slack from 'danger-plugin-slack'

const options = {
  webhookUrl: "YOUR_SLACK_WEBHOOK_URL",
  text: "Hello world!", // A custom message to send instead of the report (optional, default: null)
  username: "Jacky", // A custom sender name (optional, default: "DangerJS")
  iconEmoji: ":sunglasses:", // A custom emoji (optional, default: ":open_mouth:")
  iconUrl: "http://path/custom/icon/url", // A custom iconUrl (optional, default: null)
  channel: "#general", // A custom channel (optional)
}

slack(options)

Incoming Webhook

To get a new incoming webhook url, you will have to click here. Keep in mind that optional parameters such as channel or emoji doesn't work with integrations declared as Slack Apps. So it's better to create a simple incoming webhook.

Changelog

See the GitHub release history.

Contributing

See CONTRIBUTING.md.