ezvpn-mqtt-slack listens on an MQTT broker and sends messages to a specific Slack channel ID.
In IOhubTM architecture,
ezvpn-mqtt-slack subscribes to an MQTT topic (
slack/# by default) on the internal MQTT broker and sends messages to Slack.
How to use it
ezvpn-mqtt-slack is a Docker container image pre-configured for communication with
ezvpn-mqtt and Slack. To use it, you first need a Slack account with a Workspace and a channel where to receive notifications from IOhub. When used in combination with ezvpn-fld-exchanger you have a flexible system that sends messages based on specific conditions triggered by events.
Create a Slack account if you don't have it.
Open https://api.slack.com/apps and click "Create App" to start:
- Give your new app a name, select your Slack Workspace, click "Create App":
- At the bottom of the "Basic Information" section, you can add a name and a logo that your Slack Bot will use in your Workspace:
- Go to "OAuth & Permissions" in the left menu, navigate to "Scopes > Bot Token Scopes" and click "Add an OAuth Scope":
- Add the "chat:write" and "files:write" scopes to the "Bot Token Scopes":
- After scopes are added, click "Install to Workspace" at the top of the page:
- You will get a "Bot User OAuth Access Token"; copy the token and use it as the value of the
- In your Slack Workspace, invite the IOhub Bot to the channel it will post to using
- If you need to get the channel ID, follow this procedure:
- right-click on the slack channel (or direct message) in the desktop App and select the 'Copy Link' option.
- This will give you a URL of the form:
files:write scope is, at the moment of writing, not needed. We suggest that you add it to be ready for future extensions sending images and other documents.
When you start the Slack container, you can adjust the instance's configuration by passing one or more environment variables to the
docker run command.
MQTT_HOST: MQTT host. Defaults to
MQTT_PORT: MQTT port. Defaults to
MQTT_SUBSCRIBE_TOPIC: IOhubTM MQTT topic to subscribe. Defaults to
slack/#. Subscribe to multiple topics can be obtained defining each topic on a separated line.
MQTT_WANT_QOS2: ask MQTT to upgrade each incoming message on
MQTT_IN_TOPICto QoS 2 (delivery guaranteed). MQTT will honor the request only if persistence is enabled.
true, discard all MQTT messages with retain flag set to
true. Defaults to
SKIP_RETAIN set to
false, each client that subscribes to a topic pattern receives the retained message immediately after they subscribe.
The broker stores only one retained message per topic.
SLACK_TOKEN: App token. Must be provided.
SLACK_CHANNEL_ID: channel id where messages are posted. Must be provided if
true, the slack channel id is extracted from the incoming topic; the last portion of the topic after the last / is be used as channel id;
SLACK_CHANNEL_IDis not be used. Defaults to
SLACK_TEMPLATE: used as a message template.
## DATA ##can be used as a placeholder for the value read from mqtt.
## TOPIC ##can be used as a placeholder for the incoming topic from MQTT. If empty, the raw incoming data is sent.
true, post to Slack the incoming data as quoted text. Defaults to
Docker container details
- Smaller image
- First Release