Sign inSign up

midmich/slack_helper

By midmich

•Updated about 6 years ago

A Docker image to streamline sending a message to Slack

Image
1

10K+

midmich/slack_helper repository overview

⁠slack_helper

A Docker image to streamline sending a message to Slack.

⁠Examples

⁠Docker CLI
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
⁠Docker Compose

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"

⁠Usage Note: Multiple In, Single Out

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"

⁠Run-Time Configuration

⁠Required Enviroment variables
⁠Optional Environment variables

The 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.

⁠Internal Implementation

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.

Tag summary

Content type

Image

Digest

Size

7.2 MB

Last updated

about 6 years ago

docker pull midmich/slack_helper