Skip to content

Commit

Permalink
Update say and setSuggestedPrompts utility usage (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
misscoded authored Nov 1, 2024
1 parent 3a99b6c commit 8ac8450
Show file tree
Hide file tree
Showing 3 changed files with 1,160 additions and 2,067 deletions.
10 changes: 5 additions & 5 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,9 @@ const assistant = new Assistant({
// track of the context of the conversation to better assist the user. Sending an initial
// message to the user with context metadata facilitates this, and allows us to update it
// whenever the user changes context (via the `assistant_thread_context_changed` event).
// The `say` utility sends this metadata along automatically behind the scenes.
// !! Please note: this is only intended for development and demonstrative purposes.
await say({
text: 'Hi, how can I help?',
metadata: { event_type: 'assistant_thread_context', event_payload: context },
});
await say('Hi, how can I help?');

await saveThreadContext();

Expand All @@ -74,9 +72,11 @@ const assistant = new Assistant({

/**
* Provide the user up to 4 optional, preset prompts to choose from.
* The optional `title` prop serves as a label above the prompts. If
* not, provided, 'Try these prompts:' will be displayed.
* https://api.slack.com/methods/assistant.threads.setSuggestedPrompts
*/
await setSuggestedPrompts({ prompts });
await setSuggestedPrompts({ prompts, title: 'Here are some suggested options:' });
} catch (e) {
console.error(e);
}
Expand Down
Loading

0 comments on commit 8ac8450

Please sign in to comment.