Skip to content

Commit c523063

Browse files
authored
feat(web-api): add agents.conversations.* methods (#2748)
1 parent e22facd commit c523063

16 files changed

Lines changed: 756 additions & 1 deletion
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@slack/web-api": minor
3+
---
4+
5+
feat: add the `agents.conversations.*` methods for [Slack Code](https://docs.slack.dev/changelog/2026/08/20/slack-code) ([`create`](https://docs.slack.dev/reference/methods/agents.conversations.create), [`archive`](https://docs.slack.dev/reference/methods/agents.conversations.archive), [`setProperties`](https://docs.slack.dev/reference/methods/agents.conversations.setProperties), [`setView`](https://docs.slack.dev/reference/methods/agents.conversations.setView), [`setCommands`](https://docs.slack.dev/reference/methods/agents.conversations.setCommands), [`listViews`](https://docs.slack.dev/reference/methods/agents.conversations.listViews), [`removeView`](https://docs.slack.dev/reference/methods/agents.conversations.removeView), [`getCanvas`](https://docs.slack.dev/reference/methods/agents.conversations.getCanvas), [`setCanvasContent`](https://docs.slack.dev/reference/methods/agents.conversations.setCanvasContent)).

‎packages/web-api/src/methods.ts‎

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,15 @@ import type {
9898
AdminWorkflowsPermissionsLookupArguments,
9999
AdminWorkflowsSearchArguments,
100100
AdminWorkflowsUnpublishArguments,
101+
AgentsConversationsArchiveArguments,
102+
AgentsConversationsCreateArguments,
103+
AgentsConversationsGetCanvasArguments,
104+
AgentsConversationsListViewsArguments,
105+
AgentsConversationsRemoveViewArguments,
106+
AgentsConversationsSetCanvasContentArguments,
107+
AgentsConversationsSetCommandsArguments,
108+
AgentsConversationsSetPropertiesArguments,
109+
AgentsConversationsSetViewArguments,
101110
AgentsSessionsRenameArguments,
102111
AgentsSessionsSetStatusArguments,
103112
APITestArguments,
@@ -371,6 +380,15 @@ import type {
371380
AdminWorkflowsPermissionsLookupResponse,
372381
AdminWorkflowsSearchResponse,
373382
AdminWorkflowsUnpublishResponse,
383+
AgentsConversationsArchiveResponse,
384+
AgentsConversationsCreateResponse,
385+
AgentsConversationsGetCanvasResponse,
386+
AgentsConversationsListViewsResponse,
387+
AgentsConversationsRemoveViewResponse,
388+
AgentsConversationsSetCanvasContentResponse,
389+
AgentsConversationsSetCommandsResponse,
390+
AgentsConversationsSetPropertiesResponse,
391+
AgentsConversationsSetViewResponse,
374392
AgentsSessionsRenameResponse,
375393
AgentsSessionsSetStatusResponse,
376394
ApiTestResponse,
@@ -1381,6 +1399,80 @@ export abstract class Methods extends EventEmitter<WebClientEvent> {
13811399
};
13821400

13831401
public readonly agents = {
1402+
conversations: {
1403+
/**
1404+
* @description Archive a code channel.
1405+
* @see {@link https://docs.slack.dev/reference/methods/agents.conversations.archive `agents.conversations.archive` API reference}.
1406+
*/
1407+
archive: bindApiCall<AgentsConversationsArchiveArguments, AgentsConversationsArchiveResponse>(
1408+
this,
1409+
'agents.conversations.archive',
1410+
),
1411+
/**
1412+
* @description Create a dedicated code channel for an agent session.
1413+
* @see {@link https://docs.slack.dev/reference/methods/agents.conversations.create `agents.conversations.create` API reference}.
1414+
*/
1415+
create: bindApiCall<AgentsConversationsCreateArguments, AgentsConversationsCreateResponse>(
1416+
this,
1417+
'agents.conversations.create',
1418+
),
1419+
/**
1420+
* @description Fetch a canvas attached to a code channel.
1421+
* @see {@link https://docs.slack.dev/reference/methods/agents.conversations.getCanvas `agents.conversations.getCanvas` API reference}.
1422+
*/
1423+
getCanvas: bindApiCall<AgentsConversationsGetCanvasArguments, AgentsConversationsGetCanvasResponse>(
1424+
this,
1425+
'agents.conversations.getCanvas',
1426+
),
1427+
/**
1428+
* @description List the views currently attached to a code channel.
1429+
* @see {@link https://docs.slack.dev/reference/methods/agents.conversations.listViews `agents.conversations.listViews` API reference}.
1430+
*/
1431+
listViews: bindApiCall<AgentsConversationsListViewsArguments, AgentsConversationsListViewsResponse>(
1432+
this,
1433+
'agents.conversations.listViews',
1434+
),
1435+
/**
1436+
* @description Remove a view from a code channel.
1437+
* @see {@link https://docs.slack.dev/reference/methods/agents.conversations.removeView `agents.conversations.removeView` API reference}.
1438+
*/
1439+
removeView: bindApiCall<AgentsConversationsRemoveViewArguments, AgentsConversationsRemoveViewResponse>(
1440+
this,
1441+
'agents.conversations.removeView',
1442+
),
1443+
/**
1444+
* @description Replace the full markdown content of a plan canvas attached to a code channel.
1445+
* @see {@link https://docs.slack.dev/reference/methods/agents.conversations.setCanvasContent `agents.conversations.setCanvasContent` API reference}.
1446+
*/
1447+
setCanvasContent: bindApiCall<
1448+
AgentsConversationsSetCanvasContentArguments,
1449+
AgentsConversationsSetCanvasContentResponse
1450+
>(this, 'agents.conversations.setCanvasContent'),
1451+
/**
1452+
* @description Register the set of agent-defined slash commands for the calling agent in a code channel.
1453+
* @see {@link https://docs.slack.dev/reference/methods/agents.conversations.setCommands `agents.conversations.setCommands` API reference}.
1454+
*/
1455+
setCommands: bindApiCall<AgentsConversationsSetCommandsArguments, AgentsConversationsSetCommandsResponse>(
1456+
this,
1457+
'agents.conversations.setCommands',
1458+
),
1459+
/**
1460+
* @description Set properties on a code channel.
1461+
* @see {@link https://docs.slack.dev/reference/methods/agents.conversations.setProperties `agents.conversations.setProperties` API reference}.
1462+
*/
1463+
setProperties: bindApiCall<AgentsConversationsSetPropertiesArguments, AgentsConversationsSetPropertiesResponse>(
1464+
this,
1465+
'agents.conversations.setProperties',
1466+
),
1467+
/**
1468+
* @description Create or update a view in a code channel.
1469+
* @see {@link https://docs.slack.dev/reference/methods/agents.conversations.setView `agents.conversations.setView` API reference}.
1470+
*/
1471+
setView: bindApiCall<AgentsConversationsSetViewArguments, AgentsConversationsSetViewResponse>(
1472+
this,
1473+
'agents.conversations.setView',
1474+
),
1475+
},
13841476
sessions: {
13851477
/**
13861478
* @description Rename an agent session.

‎packages/web-api/src/types/request/agents.ts‎

Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,210 @@
1+
import type { Block, KnownBlock } from '@slack/types';
2+
13
import type { TokenOverridable } from './common';
24

5+
// https://docs.slack.dev/reference/methods/agents.conversations.archive
6+
export interface AgentsConversationsArchiveArguments extends TokenOverridable {
7+
/** @description ID of the code channel to archive. */
8+
channel_id: string;
9+
/**
10+
* @description Timestamp of a message in the code channel to share back as a thread reply on the origin message.
11+
* Requires the channel to have an `origin_link` set.
12+
*/
13+
summary_message_ts?: string;
14+
}
15+
16+
// https://docs.slack.dev/reference/methods/agents.conversations.create
17+
export interface AgentsConversationsCreateArguments extends TokenOverridable {
18+
/**
19+
* @description Encoded team ID to create the channel in. Required for org tokens when `origin_channel_id` is not
20+
* provided. When omitted, the workspace is derived from the origin channel.
21+
*/
22+
team_id?: string;
23+
/**
24+
* @description An opaque identifier for the agent session. When provided, the call is idempotent: if a channel already
25+
* exists for this `session_id`, it is returned instead of creating a new one.
26+
*/
27+
session_id?: string;
28+
/**
29+
* @description A friendly display name for the code channel. Optional when `origin_channel_id` and `origin_message_ts`
30+
* are provided — in that case the channel is named from the origin message and re-titled automatically. Required when no origin link is given.
31+
*/
32+
name: string;
33+
/** @description Create a private channel instead of a public one. */
34+
is_private?: boolean;
35+
/**
36+
* @description The channel ID where the agent session was initiated from. Must be provided together with
37+
* `origin_message_ts`. The channel must be accessible to the calling user and must not be externally shared (Slack Connect). When `team_id` is omitted with an org token, the channel is created in the same workspace as this origin channel.
38+
*/
39+
origin_channel_id?: string;
40+
/**
41+
* @description The message timestamp in the origin channel that started the agent session. Must be provided together
42+
* with `origin_channel_id`. The author of this message is automatically invited to the newly created code channel.
43+
*/
44+
origin_message_ts?: string;
45+
}
46+
47+
// https://docs.slack.dev/reference/methods/agents.conversations.getCanvas
48+
export interface AgentsConversationsGetCanvasArguments extends TokenOverridable {
49+
/** @description ID of the agent session channel the canvas belongs to. */
50+
channel: string;
51+
/** @description Encoded ID of the canvas to fetch. */
52+
canvas_id: string;
53+
/** @description Format to render the canvas content in. Defaults to `markdown`. */
54+
content_format?: string;
55+
/** @description Whether to include resolved comment threads in the response. Defaults to `false`. */
56+
include_resolved?: boolean;
57+
}
58+
59+
// https://docs.slack.dev/reference/methods/agents.conversations.listViews
60+
export interface AgentsConversationsListViewsArguments extends TokenOverridable {
61+
/** @description ID of the code channel to list views for. */
62+
channel_id: string;
63+
}
64+
65+
// https://docs.slack.dev/reference/methods/agents.conversations.removeView
66+
export interface AgentsConversationsRemoveViewArguments extends TokenOverridable {
67+
/** @description ID of the code channel to remove the view from. */
68+
channel_id: string;
69+
/** @description Agent-assigned key of the view to remove. Provide exactly one of `view_key` or `view_id`. */
70+
view_key?: string;
71+
/** @description Encoded channel tab ID of the view to remove. Provide exactly one of `view_key` or `view_id`. */
72+
view_id?: string;
73+
}
74+
75+
// https://docs.slack.dev/reference/methods/agents.conversations.setCanvasContent
76+
export interface AgentsConversationsSetCanvasContentArguments extends TokenOverridable {
77+
/** @description ID of the agent session channel the canvas is attached to. */
78+
channel: string;
79+
/** @description Encoded ID of the canvas whose content to replace. */
80+
canvas_id: string;
81+
/**
82+
* @description The full new canvas content as markdown. The server diffs this against the current content and applies
83+
* only the changed sections.
84+
*/
85+
content: string;
86+
}
87+
88+
// https://docs.slack.dev/reference/methods/agents.conversations.setCommands
89+
export interface AgentsConversationsSetCommandsArguments extends TokenOverridable {
90+
/** @description ID of the code channel to register commands for. */
91+
channel_id: string;
92+
/**
93+
* @description Full set of commands to register for the calling agent in this channel, replacing that agent's
94+
* previously registered set. Pass an empty array to clear the agent's commands. At most 10 commands may exist across all agents in the channel; names must be unique within the set and must not collide with builtin Slack commands.
95+
*/
96+
commands: {
97+
/** @description Command name, without a leading slash. 1-31 characters, unique within the set. */
98+
name: string;
99+
/** @description Short description of what the command does. */
100+
description?: string;
101+
/** @description Hint describing the command's arguments, shown in the typeahead. */
102+
argument_hint?: string;
103+
/**
104+
* @description When true, channel, user, and link references in the command's text are escaped/parsed before
105+
* being sent to the agent app, matching the slash-command `should_escape` behavior. Absent is treated as false.
106+
*/
107+
should_escape?: boolean;
108+
}[];
109+
}
110+
111+
// https://docs.slack.dev/reference/methods/agents.conversations.setProperties
112+
export interface AgentsConversationsSetPropertiesArguments extends TokenOverridable {
113+
/** @description ID of the code channel to update. */
114+
channel_id: string;
115+
/** @description Code channel properties to set. Only provided fields are updated. */
116+
code_channel?: {
117+
/** @description Items displayed in the channel context bar. Maximum 5 items. The array replaces the current set. */
118+
context_bar_items?: {
119+
/** @description Unique identifier for the item within the channel. Maximum 64 characters. */
120+
key: string;
121+
/** @description Display text. Maximum 128 characters. */
122+
label: string;
123+
/** @description Icon shown beside the label: `branch`, `folder`, `hierarchy`, `life-ring`, `link`, `globe`, `terminal`, `code`, `search`, or `lock`. */
124+
icon?: string;
125+
/** @description Makes the item a link to this URL. Maximum 2048 characters. */
126+
url?: string;
127+
/** @description `info` (default, informational) or `action` (interactive; clicking delivers a `code_channel_action` event). */
128+
item_type?: string;
129+
}[];
130+
/** @description Records which message in the channel represents the current session summary. */
131+
summary_message?: {
132+
/** @description Timestamp of the summary message in the code channel. */
133+
message_ts: string;
134+
/** @description Thread timestamp if the summary message is a thread reply. Clients need this to fetch the message via conversations.replies. */
135+
thread_ts?: string;
136+
};
137+
};
138+
/** @description Agent resource properties to set. Only provided fields are updated. */
139+
agent_resource?: {
140+
/** @description URL of the external resource. Maximum 2048 characters. */
141+
url?: string;
142+
/** @description Type of the external resource. Maximum 64 characters. */
143+
resource_type?: string;
144+
/** @description Display title of the external resource. Maximum 255 characters. */
145+
title?: string;
146+
/** @description Provider of the external resource. Maximum 64 characters. */
147+
provider?: string;
148+
};
149+
}
150+
151+
// https://docs.slack.dev/reference/methods/agents.conversations.setView
152+
export interface AgentsConversationsSetViewArguments extends TokenOverridable {
153+
/** @description ID of the code channel to render the view in. */
154+
channel_id: string;
155+
/**
156+
* @description The kind of view to create or update. Defaults to `html`. Determines which other arguments are
157+
* required: `html` and `diff` require `content`, `block_kit` requires `blocks`, `canvas` requires `canvas_id`,
158+
* `pull_request` requires `pr_url`.
159+
*/
160+
type?: string;
161+
/**
162+
* @description Agent-assigned stable identity for the view (e.g. the source file path on the agent's machine). Used as
163+
* the upsert key: calls with the same `view_key` update the same view. Required for html, block_kit, and canvas views; ignored for diff (a diff view is a per-channel singleton).
164+
*/
165+
view_key?: string;
166+
/**
167+
* @description View content. For `html`, a full self-contained HTML document; for `diff`, raw unified diff text.
168+
* Capped at 1,000,000 bytes — larger content returns content_too_large. The cap is enforced by the handler (not schema maxLength) so the documented error code actually surfaces instead of a generic argument-validation failure. Required when type is html or diff.
169+
*/
170+
content?: string;
171+
/** @description Block Kit blocks to render in the view tab. Required when `type` is `block_kit`; ignored otherwise. */
172+
blocks?: (KnownBlock | Block)[];
173+
/** @description Encoded ID of the canvas to attach as the view. Required when `type` is `canvas`; ignored otherwise. */
174+
canvas_id?: string;
175+
/**
176+
* @description For canvas views: access level granted to the channel for the canvas tab. Defaults to `write`. Use
177+
* `comment` to grant channel members comment access (read and comment, no editing) so the agent remains the sole author of the canvas text.
178+
*/
179+
access_level?: string;
180+
/**
181+
* @description For canvas views: hash of the canvas-derived markdown the agent last wrote, recorded so the agent can
182+
* later detect human edits to the canvas. Opaque to the server.
183+
*/
184+
agent_content_hash?: string;
185+
/** @description For pull_request views: the pull request's URL. Required when `type` is `pull_request`; ignored otherwise. */
186+
pr_url?: string;
187+
/** @description For diff views: base branch name for display purposes. */
188+
base_branch?: string;
189+
/** @description For diff views: head branch name for display purposes. */
190+
head_branch?: string;
191+
/**
192+
* @description Display label for the view tab (`name` wins if both are
193+
* supplied). Defaults to the last path segment of `view_key`, stripped of any .html/.htm extension.
194+
*/
195+
name?: string;
196+
/**
197+
* @description Content-Security-Policy domain declarations for the view. Domains are validated server-side
198+
* (https-only, no private/internal hosts) and persisted. Only resource_domains is honored at render time today; connect_domains is accepted and stored for forward-compatibility but NOT honored yet.
199+
*/
200+
csp?: {
201+
/** @description Origins the view may fetch()/XHR/WebSocket to. Accepted and stored, but not honored at render time yet. */
202+
connect_domains?: string[];
203+
/** @description Origins the view may load scripts/styles/fonts/images/media from, merged into the curated CDN allowlist at render time. */
204+
resource_domains?: string[];
205+
};
206+
}
207+
3208
// https://docs.slack.dev/reference/methods/agents.sessions.rename
4209
export interface AgentsSessionsRenameArguments extends TokenOverridable {
5210
/** @description ID of the channel containing the agent session. */

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,19 @@ export type {
118118
AdminWorkflowsSearchArguments,
119119
AdminWorkflowsUnpublishArguments,
120120
} from './admin/workflows';
121-
export type { AgentsSessionsRenameArguments, AgentsSessionsSetStatusArguments } from './agents';
121+
export type {
122+
AgentsConversationsArchiveArguments,
123+
AgentsConversationsCreateArguments,
124+
AgentsConversationsGetCanvasArguments,
125+
AgentsConversationsListViewsArguments,
126+
AgentsConversationsRemoveViewArguments,
127+
AgentsConversationsSetCanvasContentArguments,
128+
AgentsConversationsSetCommandsArguments,
129+
AgentsConversationsSetPropertiesArguments,
130+
AgentsConversationsSetViewArguments,
131+
AgentsSessionsRenameArguments,
132+
AgentsSessionsSetStatusArguments,
133+
} from './agents';
122134
export type { APITestArguments } from './api';
123135
export type {
124136
AppsConnectionsOpenArguments,
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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 AgentsConversationsArchiveResponse = WebAPICallResult & {
12+
error?: string;
13+
needed?: string;
14+
ok?: boolean;
15+
provided?: string;
16+
warning?: string;
17+
};
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 AgentsConversationsCreateResponse = WebAPICallResult & {
12+
channel_id?: string;
13+
error?: string;
14+
needed?: string;
15+
ok?: boolean;
16+
provided?: string;
17+
warning?: string;
18+
};

0 commit comments

Comments
 (0)