Skip to content

Slack bot plugin supporting thread replies (optionally posting the first reply in the channel), mrkdwn formatting, and referencing thread history and user list.

License

Notifications You must be signed in to change notification settings

solaoi/dify-plugin-slack-thread-bot

Repository files navigation

Read this in other languages: 日本語, 简体中文, Português.

license

Slack Thread Bot

Image

Author: solaoi Version: 0.0.5 Type: extension

Description

Slack bot plugin for thread replies (optionally posting the first reply to the channel), Slack file uploads, mrkdwn formatting, referencing thread history and user list, and optional usage channel restriction.

Features

  • Reply within Slack threads (with an optional setting to also post the first reply in the channel)
  • Slack file uploads (automatically passed to a linked app)
  • Support for Slack mrkdwn formatting in replies
  • Access to thread conversation history, user information, and Slack thread info (channel_id, thread_ts) from a linked app
  • Optional restriction to a single Slack channel for more secure usage

Note

The channel_id and thread_ts are primarily provided for advanced use cases. In most scenarios, you likely won't need to use them. However, if you have the Slack Post plugin installed, these parameters can be conveniently leveraged to post messages to specific channels or threads, enabling deeper integration between Slack Thread Bot and your apps.

1. Install

To install this plugin, specify the following GitHub repository when selecting "Install Plugin":

https://github.com/solaoi/dify-plugin-slack-thread-bot

2. Setup

Follow the same setup procedure as the official SlackBot plugin. However, this plugin requires different scopes:

app_mentions:read, users:read, channels:history, groups:history, chat:write, groups:write, channels:read,
groups:read, files:read

Additionally, when configuring "Subscribe to bot events" in your Slack app settings, you need to add the following events:

  • app_mention - When someone mentions your bot
  • message.channels - To receive messages in public channels (required for thread caching)
  • message.groups - To receive messages in private channels (required for thread caching)

The message.channels and message.groups events are essential for the bot's caching mechanism, which helps avoid Slack's strict rate limits (1 request per minute for thread history). This allows the bot to maintain real-time thread context without hitting rate limits.

For details on how to set up the official SlackBot plugin, see:

https://github.com/langgenius/dify-official-plugins/blob/main/extensions/slack_bot/README.md

3. How to use

In the start node of the chat flow app that you link to this plugin, you can reference the conversation history and the list of users in the thread using the following arguments:

INPUT FIELD FIELD TYPE
thread_history Paragraph, Max length (e.g., 65535)
thread_users Paragraph, Max length (e.g., 65535)
files File List
thread_ts Short Text, Max length (e.g., 48: Default)
channel_id Short Text, Max length (e.g., 48: Default)

Example (LLM node in the chat flow app):

You are an assistant on Slack who answers user questions.
Refer to the recent conversation history and provide an appropriate response.

If you need to mention a specific user, refer to the user list and mention them in the format `<@ID>`.

# Recent conversation history
Start.thread_history
# User list
Start.thread_users

About

Slack bot plugin supporting thread replies (optionally posting the first reply in the channel), mrkdwn formatting, and referencing thread history and user list.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Languages