Skip to main content

Developing apps with AI features

Developing and using AI features requires a paid plan, despite being visible in the app settings on any plan.

Don't have a paid plan? Join the Developer Program and provision a fully-featured sandbox for free.

Slack offers a unique messaging experience for apps using AI features, including a side-by-side window within the Slack client, an app launch point accessible from the top bar in Slack, special loading states, suggested prompts, and app threads. Slack does not provide an LLM; rather, it gives you the tools and interface to best integrate an LLM of your choice for use in Slack.

End user experience

For details on the end user experience of apps using platform AI features, check out these Help Center articles: Understand AI apps in Slack and Manage app agents and assistants.

AI features

Enabling the Agents & AI apps feature in your app's settings gives your app a new entry point, a split view surface, loading states, suggested prompts, and app threads.

Additionally, the Messages tab that is typically in the app home is replaced with Chat and History. Past conversations only show in History if the user has sent a message in the thread (threads with only the app's initial message does not show in History).


App entry point: Users can find and open apps through a new entry point in Slack.

Image of an entry point


Split view: Users can initiate private conversations with apps using AI features in a split view within a channel, in the flow of work.

Image of split view


Loading states: Developers can set loading states while application operations are in progress.

Image of loading states


Suggested prompts: Developers can define default suggested prompts to help start the conversation.

Image of suggested prompts


App threads: These are designed to organize conversations and feature a single thread in the conversational experience. Slack automatically starts new threads when appropriate.

Image of ai app threads


Getting started

To set up your app for the AI capabilities discussed above, first create an app, then find the Agents & AI Apps feature in the sidebar, and enable it. You will also want to subscribe to the assistant_thread_started, assistant_thread_context_changed, and message.im events.

App flow

Bolt simplifies

The instructions here show the app flow without the use of the Bolt framework. However, using Bolt for Python or Bolt for JavaScript simplifies listening for and responding to these events.

1. Listen for the assistant_thread_started event

When the user first opens the container, Slack sends the assistant_thread_started event along with the context object. The context object is shown below:

    "context": { 
"channel_id": "C123ABC456",
"team_id": "T123ABC456",
"enterprise_id": "E123ABC456"
}

Some applications have no use for the context object. Perhaps your app does, though! If so, first call the conversations.info method to see if your app has access to the channel, then proceed from there.

The assistant_thread_context_changed event is sent when a user opens a new channel while the container is open. This can be used to track the active context of a user in Slack.

2. Respond to the assistant_thread_started event

A user's first impression is a crucial moment. Capitalizing on this first interaction is an opportunity to create a delightful experience.

Your app can call the assistant.threads.setStatus method if it needs time to generate prompts.

If your app is sending hardcoded prompts (this can be configured in the app settings), it would skip this step and instead call the assistant.threads.setSuggestedPrompts method to send one or more suggested prompts.

3. Listen for the message.im event

The user then will type a message or click on a prompt which triggers a message.im event. The event is the same whether the user clicked the suggested prompt or typed it manually. Users can message your app via the container or through your app's Chat tab.

Your app can respond to the user directly or it can pass back the thread_ts parameter to continue in the same thread. In most situations, you will want to call the chat.postMessage method with the thread_ts parameter.

When your app receives the thread_ts parameter, you can retrieve the conversation by using thread_ts as the unique identifier. This is useful if your app stores the long-lived context or the state of a thread.

You can also fetch previous thread messages using the conversations.replies method and choose which other messages from the conversation to include in the LLM prompt or your app logic.

Note: @-mentions in channels can happen like they do today — whether you support this or not is up to you. You can engage with the user or ask them to use the container to converse with your app.

4. Respond to the message.im event

Your app should then call the assistant.threads.setStatus method to display the status indicator in the container. We recommend doing so immediately for the user's benefit.

Your app can send a message back to the user via the chat.postMessage method, automatically clearing the status indicator in the Slack client. The status can also be cleared by again calling the assistant.threads.setStatus method with an empty string in the status field.

Additional ways to add AI to your app

AI can be infused in your Slack app with any feature—the world is your oyster. Beyond the side-by-side chat experience, any user input can be used as input for an LLM query, and the answer can be posted back in Slack. Take these three examples:

  • Ask an LLM a question that was reacted to with a reacji. Learn how to do this in the Events API documentation
  • Initiate asking an LLM a question posed in a message from a message shortcut
  • Start off an LLM query with a slash command
  • Collect structured data in a modal, then use it in a query to an LLM

Remember to enable the Agents & AI Apps feature toggle to gain access to the assistant:write scope, which is required for calling assistant-related methods like assistant.threads.setStatus.

Tips and tricks

Block Kit and interactivity

Provide interactive Block Kit elements, such as drop-down menus and buttons, to allow your app to interact with the user. Block Kit is not required, however; you can forgo interactivity and message the user via plain text and Slack markdown.

When updating longer messages sent to a user, only call the chat.update method once every 3 seconds with new content, otherwise your calls may hit the rate limit.

You can also set a section block element's expand property to true to allow your app to post long messages without the user needing to click 'see more' to see the full text of the message.

Slash commands

Slash commands are not supported in the split view container because all messages in the container or in conversation with the app take place in message threads. Slash commands do not work in threads in general. They do work in messages.

Sending notifications

When your app has the Agents & AI Apps feature toggled on, every DM with the user is a thread.

When sending a notification to a user outside of an existing thread:

  1. Use the chat.postMessage method as normal, but look for the ts parameter in the response.
  2. Call the assistant.threads.setTitle method, sending the new ts parameter as the thread_ts parameter to set the title of the thread. This allows a user to see the new notification with a titled thread when they view the app's DM.

When a user navigates to your app, two tabs are available. The History tab is all of the past threads (in which the user has sent a message) — this is where they will see new notifications. The Chat tab is the last active thread between the user and your app.

Slack has the Activity side rail tab to show new activity in a workspace. This area is optimized for users to quickly see and respond to notifications from your app.

Data retention

Do not store any Slack data you obtain. Instead, store metadata and pull in data in real time if needed.

Members only

Workspace guests are not permitted to access apps with the Agents & AI Apps feature enabled.

Next steps

✨ Explore distributed apps using AI in the Slack Marketplace.

✨ Build an AI-fueled Code Assistant app using Bolt for JavaScript with this tutorial.

✨ Make your app the best it can be with our Best practices for AI-enabled apps.