feat(web-api): add agents.sessions.rename and agents.sessions.setStat… · slackapi/node-slack-sdk@4322e14 · GitHub
Skip to content

Commit 4322e14

Browse files
authored
feat(web-api): add agents.sessions.rename and agents.sessions.setStatus (#2703)
1 parent bff3398 commit 4322e14

7 files changed

Lines changed: 123 additions & 0 deletions

File tree

Lines changed: 5 additions & 0 deletions

packages/web-api/src/methods.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ import type {
9898
AdminWorkflowsPermissionsLookupArguments,
9999
AdminWorkflowsSearchArguments,
100100
AdminWorkflowsUnpublishArguments,
101+
AgentsSessionsRenameArguments,
102+
AgentsSessionsSetStatusArguments,
101103
APITestArguments,
102104
AppsConnectionsOpenArguments,
103105
AppsEventAuthorizationsListArguments,
@@ -368,6 +370,8 @@ import type {
368370
AdminWorkflowsPermissionsLookupResponse,
369371
AdminWorkflowsSearchResponse,
370372
AdminWorkflowsUnpublishResponse,
373+
AgentsSessionsRenameResponse,
374+
AgentsSessionsSetStatusResponse,
371375
ApiTestResponse,
372376
AppsConnectionsOpenResponse,
373377
AppsEventAuthorizationsListResponse,
@@ -1374,6 +1378,24 @@ export abstract class Methods extends EventEmitter<WebClientEvent> {
13741378
},
13751379
};
13761380

1381+
public readonly agents = {
1382+
sessions: {
1383+
/**
1384+
* @description Rename an agent session.
1385+
* @see {@link https://docs.slack.dev/reference/methods/agents.sessions.rename `agents.sessions.rename` API reference}.
1386+
*/
1387+
rename: bindApiCall<AgentsSessionsRenameArguments, AgentsSessionsRenameResponse>(this, 'agents.sessions.rename'),
1388+
/**
1389+
* @description Set an agent session's lifecycle status, creating the session if needed.
1390+
* @see {@link https://docs.slack.dev/reference/methods/agents.sessions.setStatus `agents.sessions.setStatus` API reference}.
1391+
*/
1392+
setStatus: bindApiCall<AgentsSessionsSetStatusArguments, AgentsSessionsSetStatusResponse>(
1393+
this,
1394+
'agents.sessions.setStatus',
1395+
),
1396+
},
1397+
};
1398+
13771399
public readonly api = {
13781400
/**
13791401
* @description Checks API calling code.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import type { TokenOverridable } from './common';
2+
3+
// https://docs.slack.dev/reference/methods/agents.sessions.rename
4+
export interface AgentsSessionsRenameArguments extends TokenOverridable {
5+
/** @description ID of the channel containing the agent session. */
6+
channel_id: string;
7+
/** @description New title for the agent session (1-200 characters). For a session channel, this also renames the channel. */
8+
title: string;
9+
/**
10+
* @description Timestamp of the thread root message the session is scoped to. Required for thread-based sessions in
11+
* regular channels and DMs. Must be omitted for session channels.
12+
*/
13+
thread_ts?: string;
14+
}
15+
16+
// https://docs.slack.dev/reference/methods/agents.sessions.setStatus
17+
export interface AgentsSessionsSetStatusArguments extends TokenOverridable {
18+
/** @description ID of the channel containing the agent session. */
19+
channel_id: string;
20+
/** @description The lifecycle status to set. Acceptable values: `active`, `processing`, `suspended`, `closed`. */
21+
status: string;
22+
/**
23+
* @description Timestamp of the thread root message the session is scoped to. Required for thread-based sessions in
24+
* regular channels and DMs. Must be omitted for session channels.
25+
*/
26+
thread_ts?: string;
27+
/**
28+
* @description Title for the agent session (max 200 characters). Only used when creating a new session; ignored if
29+
* the session already exists. To rename an existing session, use `agents.sessions.rename`.
30+
*/
31+
title?: string;
32+
/**
33+
* @description The user who initiated the session. Only used when creating a new session; ignored if the session
34+
* already exists. Must be a member of the channel.
35+
*/
36+
initiator_user_id?: string;
37+
/**
38+
* @description Emoji to use as the agent's icon. Takes priority over `icon_url`. Remains in effect until you clear it
39+
* (pass `null`) or set a new value. Requires the `chat:write.customize` scope.
40+
* @example :chart_with_upwards_trend:
41+
*/
42+
icon_emoji?: string;
43+
/**
44+
* @description URL to an image to use as the agent's icon. Remains in effect until you clear it (pass `null`) or set
45+
* a new value. Requires the `chat:write.customize` scope.
46+
* @example http://lorempixel.com/48/48
47+
*/
48+
icon_url?: string;
49+
/**
50+
* @description Display name override for the agent (max 200 characters). Remains in effect until you clear it (pass
51+
* `null`) or set a new value. Requires the `chat:write.customize` scope.
52+
* @example My Bot
53+
*/
54+
username?: string;
55+
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ export type {
118118
AdminWorkflowsSearchArguments,
119119
AdminWorkflowsUnpublishArguments,
120120
} from './admin/workflows';
121+
export type { AgentsSessionsRenameArguments, AgentsSessionsSetStatusArguments } from './agents';
121122
export type { APITestArguments } from './api';
122123
export type {
123124
AppsConnectionsOpenArguments,
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/////////////////////////////////////////////////////////////////////////////////////////
2+
// //
3+
// !!! DO NOT EDIT THIS FILE !!! //
4+
// //
5+
// This file is auto-generated by scripts/generate-web-api-types.sh in the repository. //
6+
// Please refer to the script code to learn how to update the source data. //
7+
// //
8+
/////////////////////////////////////////////////////////////////////////////////////////
9+
10+
import type { WebAPICallResult } from '../../WebClient';
11+
export type AgentsSessionsRenameResponse = WebAPICallResult & {
12+
error?: string;
13+
needed?: string;
14+
ok?: boolean;
15+
provided?: string;
16+
title?: string;
17+
warning?: string;
18+
};
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/////////////////////////////////////////////////////////////////////////////////////////
2+
// //
3+
// !!! DO NOT EDIT THIS FILE !!! //
4+
// //
5+
// This file is auto-generated by scripts/generate-web-api-types.sh in the repository. //
6+
// Please refer to the script code to learn how to update the source data. //
7+
// //
8+
/////////////////////////////////////////////////////////////////////////////////////////
9+
10+
import type { WebAPICallResult } from '../../WebClient';
11+
export type AgentsSessionsSetStatusResponse = WebAPICallResult & {
12+
agent_status?: string;
13+
error?: string;
14+
needed?: string;
15+
ok?: boolean;
16+
provided?: string;
17+
status?: string;
18+
title?: string;
19+
warning?: string;
20+
};

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

Lines changed: 2 additions & 0 deletions

0 commit comments

Comments
 (0)