slack
Connects to Slack using Socket Mode, and can receive events, interactions (automated and user-initiated), and slash commands.
This input is useful for:
-
Building bots that can query or write data.
-
Sending events to data warehouses.
You could also try pairing this input with Redpanda Connect’s AI processors, which use the prefixes cohere, openai, and ollama.
inputs:
label: ""
slack:
app_token: "" # No default (required)
bot_token: "" # No default (required)
auto_replay_nacks: true
See also: Examples
Metadata
Each message emitted from this input has an @type metadata flag to indicate the event type, either "events_api", "interactions", or "slash_commands".
Fields
auto_replay_nacks
Whether to automatically replay messages that are rejected (nacked) at the output level. If the cause of rejections is persistent, leaving this option enabled can result in back pressure.
Set auto_replay_nacks to false to delete rejected messages. Disabling auto replays can greatly improve memory efficiency of high throughput streams, as the original shape of the data is discarded immediately upon consumption and mutation.
Type: bool
Default: true
bot_token
Your Slack bot user’s OAuth token, which must have the connections.write scope to access your Slack app’s Socket Mode WebSocket URL.
Type: string
Examples
Echo Slackbot
A slackbot that echo messages from other users
input:
slack:
app_token: "${APP_TOKEN:xapp-demo}"
bot_token: "${BOT_TOKEN:xoxb-demo}"
pipeline:
processors:
- mutation: |
# ignore hidden or non message events
if this.event.type != "message" || (this.event.hidden | false) {
root = deleted()
}
# Don't respond to our own messages
if this.authorizations.any(auth -> auth.user_id == this.event.user) {
root = deleted()
}
output:
slack_post:
bot_token: "${BOT_TOKEN:xoxb-demo}"
channel_id: "${!this.event.channel}"
thread_ts: "${!this.event.ts}"
text: "ECHO: ${!this.event.text}"