Slack Sink
Provided by: "Apache Software Foundation"
Support Level for this Kamelet is: "Stable"
Posts each message as a text message to a Slack channel, through an incoming webhook of a Slack app.
Use it to tell a team in Slack when something happens, such as a monitoring alert, a failed build, a new order or a daily report. To read the messages of a channel instead, use slack-source.
Input: the body is the text of the Slack message, as text; another kind of body is turned into text first. JSON text is posted as it is, as the text of the message, not as a Slack message structure. The text can use Slack’s own formatting, such as bold. Headers are not read.
Output: the message is unchanged.
Good to know: the webhook decides where the message goes. The webhook of a Slack app posts only to the channel chosen when the webhook was created, whatever channel says. When Slack does not answer with a success status, the message fails.
Configuration Options
The following table summarizes the configuration options available for the slack-sink Kamelet:
| Property | Name | Description | Type | Default | Example |
|---|---|---|---|---|---|
Channel | Required The channel to post to, with a leading | string | #alerts | ||
Webhook URL | Required The incoming webhook URL of your Slack app, which starts with | string |
Dependencies
At runtime, the slack-sink Kamelet relies upon the presence of the following dependencies:
-
camel:jackson3
-
camel:slack
-
camel:kamelet
Camel JBang usage
Prerequisites
-
You’ve installed JBang.
-
You have executed the following command:
jbang app install camel@apache/camel Supposing you have a file named route.yaml with this content:
- route:
from:
uri: "kamelet:timer-source"
parameters:
period: 10000
message: 'test'
steps:
- to:
uri: "kamelet:slack-sink" You can now run it directly through the following command
camel run route.yaml Slack Sink Kamelet Description
Team Communication Integration
This Kamelet integrates with Slack, a popular team collaboration and messaging platform. It posts each message as a text message to a Slack channel, through an incoming webhook.
Setup Requirements
-
Create a Slack app in your workspace at https://api.slack.com/apps.
-
On the Incoming Webhooks page of the app, turn incoming webhooks on.
-
Click Add New Webhook to Workspace and choose the channel to post to.
-
Copy the webhook URL, which starts with
https://hooks.slack.com/services/, intowebhookUrl, and the name of the same channel intochannel.
The webhook of a Slack app always posts to the channel it was created for. To post to several channels, create one webhook per channel and one Kamelet per webhook.
Message Formatting
The body of the message becomes the text of the Slack message. The text can use Slack formatting, such as bold, italic and , and emoji such as code :tada:. JSON in the body is posted as text, not as a Slack message structure, so attachments, blocks and interactive elements are not available through this Kamelet.