Cloud

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.

input:
  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

app_token

The app-level token, which starts with xapp-. The input uses it to open the Socket Mode connection, so it needs the connections:write scope.

Type: string

auto_replay_nacks

Whether to automatically replay rejected messages (negative acknowledgements, or nacks) at the output level. If the cause of rejections persists, 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

The OAuth token of your Slack bot user, which starts with xoxb-.

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}"