A Docker image to streamline sending a message to Slack
10K+
A Docker image to streamline sending a message to Slack.
docker run --rm midmich/slack_helper:latest "Message to send to Slack"
docker run --rm --env SLACK_TEXT="A different way to indicate which message to Slack" midmich/slack_helper:latest
A minimum viable docker-compose.yml
version: '3.2'
services:
slack:
image: midmich/slack_helper:latest
environment:
SLACK_WEBHOOK_URL: https://hooks.slack.com/services/your/webhook/path
SLACK_TEXT: "foo bar baz"
If you provide both SLACK_TEXT and a message parameter, only the SLACK_TEXT value is used
For example, this command will send "message foo" to Slack:
docker run --rm --env SLACK_TEXT="message foo" midmich/slack_helper:latest "message bar"
SLACK_WEBHOOK_URLSLACK_TEXTSLACK_WEBHOOK_CHANNELchannel. Examples include channel ID (C8UJ12P4P), user DM (@username), or channel (#testing).SLACK_WEBHOOK_USERusernameSLACK_WEBHOOK_ICONicon_urlDEBUG_LEVELThe SLACK_WEBHOOK_* variables are typically stored somewhere (e.g. in Gitlab CI/CD configuration variables) and usually do not need to be explicitly specified in .env or docker-compose.yml.
The internal mechanism used to send the message to Slack, Incoming Webhooks, has been marked as "Legacy" by Slack and could be deprecated/discontinued in the future.
This image continues to use this "Legacy" mechanism because of the ease of use and features that are not possible in the current, supported mechanism.
From Slack's current version documentation:
You cannot override the default channel (chosen by the user who installed your app), username, or icon when you're using Incoming Webhooks to post messages. Instead, these values will always inherit from the associated Slack app configuration.
Content type
Image
Digest
Size
7.2 MB
Last updated
about 6 years ago
docker pull midmich/slack_helper