Skip to content

Commit e69a76d

Browse files
authored
feat (web-api): Add support for assistant.* API (#2042)
1 parent e62f9e9 commit e69a76d

File tree

5 files changed

+131
-0
lines changed

5 files changed

+131
-0
lines changed

packages/web-api/src/methods.ts

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ import {
9090
AppsManifestUpdateResponse,
9191
AppsManifestValidateResponse,
9292
AppsUninstallResponse,
93+
AssistantThreadsSetStatusResponse,
94+
AssistantThreadsSetSuggestedPromptsResponse,
95+
AssistantThreadsSetTitleResponse,
9396
AuthRevokeResponse,
9497
AuthTeamsListResponse,
9598
AuthTestResponse,
@@ -553,6 +556,35 @@ export abstract class Methods extends EventEmitter<WebClientEvent> {
553556
uninstall: bindApiCall<AppsUninstallArguments, AppsUninstallResponse>(this, 'apps.uninstall'),
554557
};
555558

559+
public readonly assistant = {
560+
threads: {
561+
/**
562+
* @description Set loading status to indicate that the app is building a response.
563+
* @see {@link https://api.slack.com/methods/assistant.threads.setStatus `assistant.threads.setStatus` API reference}.
564+
*/
565+
setStatus: bindApiCall<AssistantThreadsSetStatusArguments, AssistantThreadsSetStatusResponse>(
566+
this,
567+
'assistant.threads.setStatus',
568+
),
569+
/**
570+
* @description Set suggested prompts for the user. Can suggest up to four prompts.
571+
* @see {@link https://api.slack.com/methods/assistant.threads.setSuggestedPrompts `assistant.threads.setSuggestedPrompts` API reference}.
572+
*/
573+
setSuggestedPrompts: bindApiCall<
574+
AssistantThreadsSetSuggestedPromptsArguments,
575+
AssistantThreadsSetSuggestedPromptsResponse
576+
>(this, 'assistant.threads.setSuggestedPrompts'),
577+
/**
578+
* @description Set the title of the thread. This is shown when a user views the app's chat history.
579+
* @see {@link https://api.slack.com/methods/assistant.threads.setTitle `assistant.threads.setTitle` API reference}.
580+
*/
581+
setTitle: bindApiCall<AssistantThreadsSetTitleArguments, AssistantThreadsSetTitleResponse>(
582+
this,
583+
'assistant.threads.setTitle',
584+
),
585+
},
586+
};
587+
556588
public readonly auth = {
557589
revoke: bindApiCall<AuthRevokeArguments, AuthRevokeResponse>(this, 'auth.revoke'),
558590
teams: {
@@ -1456,6 +1488,48 @@ export interface AppsUninstallArguments extends WebAPICallOptions {
14561488
client_secret: string;
14571489
}
14581490

1491+
/*
1492+
* `assistant.*`
1493+
*/
1494+
// https://api.slack.com/methods/assistant.threads.setStatus
1495+
export interface AssistantThreadsSetStatusArguments extends WebAPICallOptions, TokenOverridable {
1496+
/** @description Channel ID containing the assistant thread. */
1497+
channel_id: string;
1498+
/** @description Status of the assistant (e.g. 'is thinking...') */
1499+
status: string;
1500+
/** @description Message timestamp of the thread. */
1501+
thread_ts: string;
1502+
}
1503+
1504+
// https://api.slack.com/methods/assistant.threads.setSuggestedPrompts
1505+
export interface AssistantThreadsSetSuggestedPromptsArguments extends WebAPICallOptions, TokenOverridable {
1506+
/** @description Channel ID containing the assistant thread. */
1507+
channel_id: string;
1508+
/** @description Prompt suggestions that appear when opening assistant thread. */
1509+
prompts: [AssistantPrompt, ...AssistantPrompt[]];
1510+
/** @description Message timestamp of the thread. */
1511+
thread_ts: string;
1512+
/** @description Title for the prompts. */
1513+
title?: string;
1514+
}
1515+
1516+
interface AssistantPrompt {
1517+
/** @description Title of the prompt. */
1518+
title: string;
1519+
/** @description Message of the prompt. */
1520+
message: string;
1521+
}
1522+
1523+
// https://api.slack.com/methods/assistant.threads.setTitle
1524+
export interface AssistantThreadsSetTitleArguments extends WebAPICallOptions, TokenOverridable {
1525+
/** @description Channel ID containing the assistant thread. */
1526+
channel_id: string;
1527+
/** @description Message timestamp of the thread. */
1528+
thread_ts: string;
1529+
/** @description Title of the thread. */
1530+
title: string;
1531+
}
1532+
14591533
/*
14601534
* `auth.*`
14611535
*/
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/* eslint-disable */
2+
/////////////////////////////////////////////////////////////////////////////////////////
3+
// //
4+
// !!! DO NOT EDIT THIS FILE !!! //
5+
// //
6+
// This file is auto-generated by scripts/generate-web-api-types.sh in the repository. //
7+
// Please refer to the script code to learn how to update the source data. //
8+
// //
9+
/////////////////////////////////////////////////////////////////////////////////////////
10+
11+
import { WebAPICallResult } from '../WebClient';
12+
export type AssistantThreadsSetStatusResponse = WebAPICallResult & {
13+
error?: string;
14+
needed?: string;
15+
ok?: boolean;
16+
provided?: string;
17+
warning?: string;
18+
};
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/* eslint-disable */
2+
/////////////////////////////////////////////////////////////////////////////////////////
3+
// //
4+
// !!! DO NOT EDIT THIS FILE !!! //
5+
// //
6+
// This file is auto-generated by scripts/generate-web-api-types.sh in the repository. //
7+
// Please refer to the script code to learn how to update the source data. //
8+
// //
9+
/////////////////////////////////////////////////////////////////////////////////////////
10+
11+
import { WebAPICallResult } from '../WebClient';
12+
export type AssistantThreadsSetSuggestedPromptsResponse = WebAPICallResult & {
13+
error?: string;
14+
needed?: string;
15+
ok?: boolean;
16+
provided?: string;
17+
warning?: string;
18+
};
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/* eslint-disable */
2+
/////////////////////////////////////////////////////////////////////////////////////////
3+
// //
4+
// !!! DO NOT EDIT THIS FILE !!! //
5+
// //
6+
// This file is auto-generated by scripts/generate-web-api-types.sh in the repository. //
7+
// Please refer to the script code to learn how to update the source data. //
8+
// //
9+
/////////////////////////////////////////////////////////////////////////////////////////
10+
11+
import { WebAPICallResult } from '../WebClient';
12+
export type AssistantThreadsSetTitleResponse = WebAPICallResult & {
13+
error?: string;
14+
needed?: string;
15+
ok?: boolean;
16+
provided?: string;
17+
warning?: string;
18+
};

packages/web-api/src/response/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ export { AppsPermissionsScopesListResponse } from './AppsPermissionsScopesListRe
111111
export { AppsPermissionsUsersListResponse } from './AppsPermissionsUsersListResponse';
112112
export { AppsPermissionsUsersRequestResponse } from './AppsPermissionsUsersRequestResponse';
113113
export { AppsUninstallResponse } from './AppsUninstallResponse';
114+
export { AssistantThreadsSetStatusResponse } from './AssistantThreadsSetStatusResponse';
115+
export { AssistantThreadsSetSuggestedPromptsResponse } from './AssistantThreadsSetSuggestedPromptsResponse';
116+
export { AssistantThreadsSetTitleResponse } from './AssistantThreadsSetTitleResponse';
114117
export { AuthRevokeResponse } from './AuthRevokeResponse';
115118
export { AuthTeamsListResponse } from './AuthTeamsListResponse';
116119
export { AuthTestResponse } from './AuthTestResponse';

0 commit comments

Comments
 (0)