Skip to content

Commit 01a7c92

Browse files
committed
feat(web-api): add authorship arguments to assistant threads and chat stream
1 parent bb284c6 commit 01a7c92

File tree

4 files changed

+50
-0
lines changed

4 files changed

+50
-0
lines changed

packages/web-api/src/types/request/assistant.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,14 @@ export interface AssistantThreadsSetStatusArguments extends TokenOverridable {
88
status: string;
99
/** @description Message timestamp of the thread. */
1010
thread_ts: string;
11+
/** @description Emoji to use as the icon for this message. Overrides `icon_url`. */
12+
icon_emoji?: string;
13+
/** @description URL to an image to use as the icon for this message. The `icon_emoji` field takes precendence over this field. */
14+
icon_url?: string;
1115
/** @description The list of messages to rotate through as a loading indicator. */
1216
loading_messages?: string[];
17+
/** @description Set your bot's username. */
18+
username?: string;
1319
}
1420

1521
// https://docs.slack.dev/reference/methods/assistant.threads.setSuggestedPrompts

packages/web-api/src/types/request/chat.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,14 @@ export type ChatScheduledMessagesListArguments = OptionalArgument<
233233
>;
234234

235235
export interface ChatStartStreamArguments extends TokenOverridable, Channel, Partial<MarkdownText>, ThreadTS {
236+
/**
237+
* @description Emoji to use as the icon for this message. Overrides `icon_url`.
238+
*/
239+
icon_emoji?: string;
240+
/**
241+
* @description URL to an image to use as the icon for this message. The `icon_emoji` field takes precendence over this field.
242+
*/
243+
icon_url?: string;
236244
/**
237245
* @description The ID of the team that is associated with `recipient_user_id`.
238246
* This is required when starting a streaming conversation outside of a DM.
@@ -243,6 +251,10 @@ export interface ChatStartStreamArguments extends TokenOverridable, Channel, Par
243251
* This is required when starting a streaming conversation outside of a DM.
244252
*/
245253
recipient_user_id?: string;
254+
/**
255+
* @description Set your bot's username.
256+
*/
257+
username?: string;
246258
}
247259

248260
export type ChatStopStreamArguments = TokenOverridable &

packages/web-api/test/types/methods/assistant.test-d.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,23 @@ expectAssignable<Parameters<typeof web.assistant.threads.setStatus>>([
4646
loading_messages: ['counting sheep...', 'moving bricks...'],
4747
},
4848
]);
49+
expectAssignable<Parameters<typeof web.assistant.threads.setStatus>>([
50+
{
51+
channel_id: 'C1234',
52+
thread_ts: '123.123',
53+
status: 'counting...',
54+
username: 'Abacus',
55+
icon_emoji: 'abacus',
56+
},
57+
]);
58+
expectAssignable<Parameters<typeof web.assistant.threads.setStatus>>([
59+
{
60+
channel_id: 'C1234',
61+
thread_ts: '123.123',
62+
status: 'dreaming...',
63+
icon_url: 'https://example.com/clouds-square.png',
64+
},
65+
]);
4966

5067
// assistant.threads.setSuggestedPrompts
5168
// -- sad path

packages/web-api/test/types/methods/chat.test-d.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,21 @@ expectAssignable<Parameters<typeof web.chat.startStream>>([
640640
recipient_user_id: 'U1234',
641641
},
642642
]);
643+
expectAssignable<Parameters<typeof web.chat.startStream>>([
644+
{
645+
channel: 'C1234',
646+
thread_ts: '1234.56',
647+
username: 'Abacus',
648+
icon_emoji: 'abacus',
649+
},
650+
]);
651+
expectAssignable<Parameters<typeof web.chat.startStream>>([
652+
{
653+
channel: 'C1234',
654+
thread_ts: '1234.56',
655+
icon_url: 'https://example.com/clouds-square.png',
656+
},
657+
]);
643658

644659
// chat.stopStream
645660
// -- sad path

0 commit comments

Comments
 (0)