Send bot notifications to a Slack channel via the Slack Incoming Webhooks API
1M+
The code for this image is located on GitHub: https://github.com/technosophos/slack-notify
Slack-Notify is a very simple tool for sending a Slack notification via a Slack Incoming Webhook. It is packaged as a simple Docker app.
This tool uses Slack Incoming Webhooks to send a message to your slack channel.
Before you can use this tool, you need to log into your Slack account and configure this.
Running slack-notify in a shell prompt goes like this:
$ export SLACK_WEBHOOK=https://hooks.slack.com/services/Txxxxxx/Bxxxxxx/xxxxxxxx
$ SLACK_MESSAGE="hello" slack-notify
Running the Docker container goes like this:
$ export SLACK_WEBHOOK=https://hooks.slack.com/services/Txxxxxx/Bxxxxxx/xxxxxxxx
$ docker run -e SLACK_WEBHOOK=$SLACK_WEBHOOK -e SLACK_MESSAGE="hello" -e SLACK_CHANNEL=acid technosophos/slack-notify
You can use it in a Brigade script like this:
var slack = new Job("slack-notify", "technosophos/slack-notify:latest", ["/slack-notify"])
slack.storage.enabled = false
slack.env = {
SLACK_WEBHOOK: "http://slackwebhookurl", // Best practice: Store in project secrets: project.secrets.SLACK_WEBHOOK,
SLACK_USERNAME: "BrigadeBot",
SLACK_TITLE: "title goes here",
SLACK_MESSAGE: "message goes here",
SLACK_COLOR: "#0000ff"
}
slack.run()
# The Slack-assigned webhook
SLACK_WEBHOOK=https://hooks.slack.com/services/Txxxxxx/Bxxxxxx/xxxxxxxx
# A URL to an icon
SLACK_ICON=http://example.com/icon.png
# The channel to send the message to (if omitted, use Slack-configured default)
SLACK_CHANNEL=example
# The title of the message
SLACK_TITLE="Hello World"
# The body of the message
SLACK_MESSAGE="Today is a fine day"
# RGB color to for message formatting. (Slack determines what is colored by this)
SLACK_COLOR="#efefef"
# The name of the sender of the message. Does not need to be a "real" username
SLACK_USERNAME"
Content type
Image
Digest
Size
42 MB
Last updated
about 9 years ago
docker pull technosophos/slack-notify