https://github.com/user-attachments/assets/bc16597b-1632-46bb-b7aa-fe22330daf84
Try the AI Agent Sample app to explore the AI-enabled features and existing Assistant helper:
# Create a new AI Agent app
$ slack create slack-ai-agent-app --template slack-samples/bolt-js-assistant-template
$ cd slack-ai-agent-app/
# Add your OPENAI_API_KEY
$ export OPENAI_API_KEY=sk-proj-ahM...
# Run the local dev server
$ slack run
After the app starts, send a message to the "slack-ai-agent-app" bot for a unique response.
Loading states allows you to not only set the status (e.g. "My app is typing...") but also sprinkle some personality by cycling through a collection of loading messages:
app.event('message', async ({ client, context, event, logger }) => {
// ...
await client.assistant.threads.setStatus({
channel_id: channelId,
thread_ts: threadTs,
status: 'thinking...',
loading_messages: [
'Teaching the hamsters to type faster…',
'Untangling the internet cables…',
'Consulting the office goldfish…',
'Polishing up the response just for you…',
'Convincing the AI to stop overthinking…',
],
});
// Start a new message stream
});
The client.chatStream() helper utility can be used to streamline calling the 3 text streaming methods:
app.event('message', async ({ client, context, event, logger }) => {
// ...
// Start a new message stream
const streamer = client.chatStream({
channel: channelId,
recipient_team_id: teamId,
recipient_user_id: userId,
thread_ts: threadTs,
});
// Loop over OpenAI response stream
// https://platform.openai.com/docs/api-reference/responses/create
for await (const chunk of llmResponse) {
if (chunk.type === 'response.output_text.delta') {
await streamer.append({
markdown_text: chunk.delta,
});
}
}
// Stop the stream and attach feedback buttons
await streamer.stop({ blocks: [feedbackBlock] });
});
Alternative to the Text Streaming Helper is to call the individual methods.
client.chat.startStreamFirst, start a chat text stream to stream a response to any message:
app.event('message', async ({ client, context, event, logger }) => {
// ...
const streamResponse = await client.chat.startStream({
channel: channelId,
recipient_team_id: teamId,
recipient_user_id: userId,
thread_ts: threadTs,
});
const streamTs = streamResponse.ts
client.chat.appendStreamAfter starting a chat text stream, you can then append text to it in chunks (often from your favourite LLM SDK) to convey a streaming effect:
for await (const chunk of llmResponse) {
if (chunk.type === 'response.output_text.delta') {
await client.chat.appendSteam({
channel: channelId,
markdown_text: chunk.delta,
ts: streamTs,
});
}
}
client.chat.stopStreamLastly, you can stop the chat text stream to finalize your message:
await client.chat.stopStream({
blocks: [feedbackBlock],
channel: channelId,
ts: streamTs,
});
Add feedback buttons to the bottom of a message, after stopping a text stream, to gather user feedback:
const feedbackBlock = {
type: 'context_actions',
elements: [{
type: 'feedback_buttons',
action_id: 'feedback',
positive_button: {
text: { type: 'plain_text', text: 'Good Response' },
accessibility_label: 'Submit positive feedback on this response',
value: 'good-feedback',
},
negative_button: {
text: { type: 'plain_text', text: 'Bad Response' },
accessibility_label: 'Submit negative feedback on this response',
value: 'bad-feedback',
},
}],
};
// Using the Text Streaming Helper
await streamer.stop({ blocks: [feedbackBlock] });
// Or, using the Text Streaming Method
await client.chat.stopStream({
blocks: [feedbackBlock],
channel: channelId,
ts: streamTs,
});
Milestone: https://github.com/slackapi/node-slack-sdk/milestone/147?closed=1 Full Changelog: https://github.com/slackapi/node-slack-sdk/compare/@slack/web-api@7.10.0...@slack/web-api@7.11.0 Package: https://www.npmjs.com/package/@slack/web-api/v/7.11.0
Milestone: https://github.com/slackapi/node-slack-sdk/milestone/149?closed=1 Full Changelog: https://github.com/slackapi/node-slack-sdk/compare/@slack/types@2.16.0...@slack/types@2.17.0 Package: https://www.npmjs.com/package/@slack/types/v/2.17.0
This release adds the version command to Slack CLI testing utilities for testing the output of the version command.
Package: https://www.npmjs.com/package/@slack/cli-test/v/2.2.0 Full Changelog: https://github.com/slackapi/node-slack-sdk/compare/@slack/cli-test@2.1.0+cli.2.32.2...@slack/cli-test@2.2.0+cli.2.32.2 Milestone: https://github.com/slackapi/node-slack-sdk/milestone/136?closed=1
This release updates internal dependencies to use more secure versions 🔏
Package: https://www.npmjs.com/package/@slack/rtm-api/v/7.0.4 Full Changelog: https://github.com/slackapi/node-slack-sdk/compare/@slack/rtm-api@7.0.3...@slack/rtm-api@7.0.4 Milestone: https://github.com/slackapi/node-slack-sdk/milestone/150?closed=1
This release updates internal dependencies to use more secure versions 🔏
Package: https://www.npmjs.com/package/@slack/socket-mode/v/2.0.5 Full Changelog: https://github.com/slackapi/node-slack-sdk/compare/@slack/oauth@3.0.4...@slack/socket-mode@2.0.5 Milestone: https://github.com/slackapi/node-slack-sdk/milestone/87?closed=1
This release removes unused dependencies and updates internal dependencies to use more secure versions 🔏
Package: https://www.npmjs.com/package/@slack/oauth/v/3.0.4 Full Changelog: https://github.com/slackapi/node-slack-sdk/compare/@slack/oauth@3.0.3...@slack/oauth@3.0.4 Milestone: https://github.com/slackapi/node-slack-sdk/milestone/121?closed=1
Messaging with markdown_text is supported in this release, alongside a few methods to feature workflows in channel:
const response = await client.chat.postMessage({
channel: "C0123456789",
markdown_text: "**bold**"
});
Package: https://www.npmjs.com/package/@slack/web-api/v/7.10.0 Full Changelog: https://github.com/slackapi/node-slack-sdk/compare/@slack/web-api@7.9.3...@slack/web-api@7.10.0 Milestone: https://github.com/slackapi/node-slack-sdk/milestone/144?closed=1
This release includes a security patch to internal dependencies. 🔏 ✨
Package: https://www.npmjs.com/package/@slack/webhook/v/7.0.6 Full Changelog: https://github.com/slackapi/node-slack-sdk/compare/@slack/webhook@7.0.5...@slack/webhook@7.0.6 Milestone: https://github.com/slackapi/node-slack-sdk/milestone/140?closed=1
The markdown block is now supported! Display formatted markdown in messages with this release:
const response = await client.chat.postMessage({
channel: "C0123456789",
text: "a bold message appears",
blocks: [
{
type: "markdown",
text: "**this is bold**",
},
],
});
Package: https://www.npmjs.com/package/@slack/types/v/2.16.0 Full Changelog: https://github.com/slackapi/node-slack-sdk/compare/@slack/types@2.15.0...@slack/types@2.16.0 Milestone: https://github.com/slackapi/node-slack-sdk/milestone/146?closed=1
This release redirects the link to the changelog to the wonderful pages of docs.slack.dev/changelog ✨
Milestone: https://github.com/slackapi/node-slack-sdk/milestone/101 Full Changelog: https://github.com/slackapi/node-slack-sdk/compare/@slack/cli-hooks@1.2.0...@slack/cli-hooks@1.2.1
assistant_thread to message event payload type in #2077 - Thanks @seratch!Milestone: https://github.com/slackapi/node-slack-sdk/milestone/145 Full Changelog: https://github.com/slackapi/node-slack-sdk/compare/@slack/types@2.14.0...@slack/types@2.15.0
This release has a few small updates to align with arguments of various Slack API methods.
Full Changelog: https://github.com/slackapi/node-slack-sdk/compare/@slack/web-api@7.9.2...@slack/web-api@7.9.3 Milestone: https://github.com/slackapi/node-slack-sdk/milestone/143
Full Changelog: https://github.com/slackapi/node-slack-sdk/compare/@slack/socket-mode@2.0.4...@slack/web-api@7.9.2 Milstone: https://github.com/slackapi/node-slack-sdk/milestone/141?closed=1
This release includes an update of @slack/web-api to bump internal dependencies to supported versions.
Full Changelog: https://github.com/slackapi/node-slack-sdk/compare/@slack/socket-mode@2.0.3...@slack/socket-mode@2.0.4 Milestone: https://github.com/slackapi/node-slack-sdk/milestone/133
This release includes an update of @slack/web-api to bump internal dependencies to supported versions.
Full Changelog: https://github.com/slackapi/node-slack-sdk/compare/@slack/rtm-api@7.0.2...@slack/rtm-api@7.0.3 Milestone: https://github.com/slackapi/node-slack-sdk/milestone/135
This release includes an update of @slack/web-api to bump internal dependencies to supported versions.
Full Changelog: https://github.com/slackapi/node-slack-sdk/compare/@slack/oauth@3.0.2...@slack/oauth@3.0.3 Milestone: https://github.com/slackapi/node-slack-sdk/milestone/134
This release fixes a bug where setting allowAbsoluteUrls to false caused the filesUploadV2 method to error when uploading files. Files can now be uploaded with allowAbsoluteUrls set to false.
Full Changelog: https://github.com/slackapi/node-slack-sdk/compare/@slack/web-api@7.9.0...@slack/web-api@7.9.1 Milestone: https://github.com/slackapi/node-slack-sdk/milestone/142
This release adds the allowAbsoluteUrls option to the WebClient constructor.
For code using dynamic method names with .apiCall, this will toggle if requests should be sent to absolute URLs provided:
const { WebClient } = require('@slack/web-api');
const web = new WebClient(token, {
allowAbsoluteUrls: false, // Default: true
});
const _response = await web.apiCall('https://example.com', { /* ... */ });
$ node index.js
[DEBUG] web-api:WebClient:0 http request url: https://slack.com/api/https://example.com
...
[WARN] web-api:WebClient:0 http request failed An HTTP protocol error occurred: statusCode = 404
The default allowAbsoluteUrls value is true to avoid a breaking change with this update, but we suggest deciding if this option should be applied to scripts and adjacent code.
Full Changelog: https://github.com/slackapi/node-slack-sdk/compare/@slack/web-api@7.8.0...@slack/web-api@7.9.0 Milestone: https://github.com/slackapi/node-slack-sdk/milestone/131
This patch release updates the axios dependency used to send webhooks with internal bug fixes.
Full Changelog: https://github.com/slackapi/node-slack-sdk/compare/@slack/webhook@7.0.4..@slack/webhook@7.0.5 Milestone: https://github.com/slackapi/node-slack-sdk/milestone/130
The slack run command now exits with the error code returned from the start hook and Node warnings were returned to verbose outputs:
$ slack run --verbose
...
[DEBUG] web-api:WebClient:0 initialized
...
AppInitializationError: You must provide an appToken when socketMode is set to true. To generate an appToken see: https://api.slack.com/apis/connections/socket#token
...
🚫 The 'start' hook exited with an error (sdk_hook_invocation_failed)
exit status 1 (local_app_run_error)
$ echo $?
1
Full Changelog: https://github.com/slackapi/node-slack-sdk/compare/@slack/cli-hooks@1.1.2...@slack/cli-hooks@1.2.0 Milestone: https://github.com/slackapi/node-slack-sdk/milestone/101?closed=1