Skip to content

Commit

Permalink
update assistant doc
Browse files Browse the repository at this point in the history
  • Loading branch information
lukegalbraithrussell committed Nov 1, 2024
1 parent a5785c4 commit afc9ef6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,24 +64,22 @@ Be sure to give the [assistants reference docs](/reference#assistants) a look!

When the user opens a new thread with your assistant, the [`assistant_thread_started`](https://api.slack.com/events/assistant_thread_started) event will be sent to your app. Capture this with the `threadStarted` handler to allow your app to respond.

In the example below, the app is sending a message — containing thread context [message metadata](https://api.slack.com/metadata/using) — to the user, along with a single [prompt](https://api.slack.com/methods/assistant.threads.setSuggestedPrompts).
In the example below, the app is sending a message — containing thread context [message metadata](https://api.slack.com/metadata/using) behind the scenes — to the user, along with a single [prompt](https://api.slack.com/methods/assistant.threads.setSuggestedPrompts).

```js
...
threadStarted: async ({ event, say, setSuggestedPrompts, saveThreadContext }) => {
const { context } = event.assistant_thread;

await say({
text: 'Hi, how can I help?',
});
await say('Hi, how can I help?');

const prompts = [{
title: 'Fun Slack fact',
message: 'Give me a fun fact about Slack, please!',
}];

// Provide the user up to 4 optional, preset prompts to choose from.
await setSuggestedPrompts({ prompts });
await setSuggestedPrompts({ prompts, title: 'Here are some suggested options:' });
},
...
```
Expand Down Expand Up @@ -160,7 +158,7 @@ The following example uses the [OpenAI API client](https://platform.openai.com/d
console.error(e);

// Send message to advise user and clear processing status if a failure occurs
await say({ text: 'Sorry, something went wrong!' });
await say('Sorry, something went wrong!');
}
},
});
Expand Down
2 changes: 1 addition & 1 deletion docs/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const sidebars = {
'concepts/publishing-views',
],
},
'concepts/app-assistant',
'concepts/assistant',
'concepts/custom-steps',
{
type: 'category',
Expand Down

0 comments on commit afc9ef6

Please sign in to comment.