From 47553972a9250efeba452a95e668b0f9dbc291eb Mon Sep 17 00:00:00 2001 From: Eden Zimbelman Date: Thu, 20 Aug 2026 06:35:23 -0700 Subject: [PATCH 1/2] feat(web-api): add agents.sessions.rename and agents.sessions.setStatus Mirror the Python SDK (slackapi/python-slack-sdk#1942) for the two agents.sessions methods: - agents.sessions.rename Rename an agent session. - agents.sessions.setStatus Set an agent session's lifecycle status, creating the session if needed. Adds the client.agents.sessions.{rename,setStatus} bindings, the request argument types, and the response types. The response types are generated from the java-slack-sdk API sample logs via scripts/generate-web-api-types.sh; the samples land in slackapi/java-slack-sdk#1633, so the generator must be re-run against java-slack-sdk main once that ships to pick up the final response shape. Co-Authored-By: Claude --- packages/web-api/src/methods.ts | 22 ++++++++ packages/web-api/src/types/request/agents.ts | 55 +++++++++++++++++++ packages/web-api/src/types/request/index.ts | 1 + .../response/AgentsSessionsRenameResponse.ts | 18 ++++++ .../AgentsSessionsSetStatusResponse.ts | 20 +++++++ packages/web-api/src/types/response/index.ts | 2 + 6 files changed, 118 insertions(+) create mode 100644 packages/web-api/src/types/request/agents.ts create mode 100644 packages/web-api/src/types/response/AgentsSessionsRenameResponse.ts create mode 100644 packages/web-api/src/types/response/AgentsSessionsSetStatusResponse.ts diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index 5a23001d8..c7d2bc5b0 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -98,6 +98,8 @@ import type { AdminWorkflowsPermissionsLookupArguments, AdminWorkflowsSearchArguments, AdminWorkflowsUnpublishArguments, + AgentsSessionsRenameArguments, + AgentsSessionsSetStatusArguments, APITestArguments, AppsConnectionsOpenArguments, AppsEventAuthorizationsListArguments, @@ -368,6 +370,8 @@ import type { AdminWorkflowsPermissionsLookupResponse, AdminWorkflowsSearchResponse, AdminWorkflowsUnpublishResponse, + AgentsSessionsRenameResponse, + AgentsSessionsSetStatusResponse, ApiTestResponse, AppsConnectionsOpenResponse, AppsEventAuthorizationsListResponse, @@ -1374,6 +1378,24 @@ export abstract class Methods extends EventEmitter { }, }; + public readonly agents = { + sessions: { + /** + * @description Rename an agent session. + * @see {@link https://docs.slack.dev/reference/methods/agents.sessions.rename `agents.sessions.rename` API reference}. + */ + rename: bindApiCall(this, 'agents.sessions.rename'), + /** + * @description Set an agent session's lifecycle status, creating the session if needed. + * @see {@link https://docs.slack.dev/reference/methods/agents.sessions.setStatus `agents.sessions.setStatus` API reference}. + */ + setStatus: bindApiCall( + this, + 'agents.sessions.setStatus', + ), + }, + }; + public readonly api = { /** * @description Checks API calling code. diff --git a/packages/web-api/src/types/request/agents.ts b/packages/web-api/src/types/request/agents.ts new file mode 100644 index 000000000..1d05f52c3 --- /dev/null +++ b/packages/web-api/src/types/request/agents.ts @@ -0,0 +1,55 @@ +import type { TokenOverridable } from './common'; + +// https://docs.slack.dev/reference/methods/agents.sessions.rename +export interface AgentsSessionsRenameArguments extends TokenOverridable { + /** @description ID of the channel containing the agent session. */ + channel_id: string; + /** @description New title for the agent session (1-200 characters). For a session channel, this also renames the channel. */ + title: string; + /** + * @description Timestamp of the thread root message the session is scoped to. Required for thread-based sessions in + * regular channels and DMs. Must be omitted for session channels. + */ + thread_ts?: string; +} + +// https://docs.slack.dev/reference/methods/agents.sessions.setStatus +export interface AgentsSessionsSetStatusArguments extends TokenOverridable { + /** @description ID of the channel containing the agent session. */ + channel_id: string; + /** @description The lifecycle status to set. Acceptable values: `active`, `processing`, `suspended`, `closed`. */ + status: string; + /** + * @description Timestamp of the thread root message the session is scoped to. Required for thread-based sessions in + * regular channels and DMs. Must be omitted for session channels. + */ + thread_ts?: string; + /** + * @description Title for the agent session (max 200 characters). Only used when creating a new session; ignored if + * the session already exists. To rename an existing session, use `agents.sessions.rename`. + */ + title?: string; + /** + * @description The user who initiated the session. Only used when creating a new session; ignored if the session + * already exists. Must be a member of the channel. + */ + initiator_user_id?: string; + /** + * @description Emoji to use as the agent's icon. Takes priority over `icon_url`. Remains in effect until you clear it + * (pass `null`) or set a new value. Requires the `chat:write.customize` scope. + * @example :chart_with_upwards_trend: + */ + icon_emoji?: string; + /** + * @description URL to an image to use as the agent's icon. Remains in effect until you clear it (pass `null`) or set + * a new value. Requires the `chat:write.customize` scope. + * @example http://lorempixel.com/48/48 + */ + icon_url?: string; + /** + * @description Display name override for the agent (max 200 characters). Remains in effect until you clear it (pass + * `null`) or set a new value. Requires the `chat:write.customize` scope. + * @example My Bot + */ + username?: string; +} diff --git a/packages/web-api/src/types/request/index.ts b/packages/web-api/src/types/request/index.ts index 44f1fa877..0c0f1eab9 100644 --- a/packages/web-api/src/types/request/index.ts +++ b/packages/web-api/src/types/request/index.ts @@ -118,6 +118,7 @@ export type { AdminWorkflowsSearchArguments, AdminWorkflowsUnpublishArguments, } from './admin/workflows'; +export type { AgentsSessionsRenameArguments, AgentsSessionsSetStatusArguments } from './agents'; export type { APITestArguments } from './api'; export type { AppsConnectionsOpenArguments, diff --git a/packages/web-api/src/types/response/AgentsSessionsRenameResponse.ts b/packages/web-api/src/types/response/AgentsSessionsRenameResponse.ts new file mode 100644 index 000000000..d2086d868 --- /dev/null +++ b/packages/web-api/src/types/response/AgentsSessionsRenameResponse.ts @@ -0,0 +1,18 @@ +///////////////////////////////////////////////////////////////////////////////////////// +// // +// !!! DO NOT EDIT THIS FILE !!! // +// // +// This file is auto-generated by scripts/generate-web-api-types.sh in the repository. // +// Please refer to the script code to learn how to update the source data. // +// // +///////////////////////////////////////////////////////////////////////////////////////// + +import type { WebAPICallResult } from '../../WebClient'; +export type AgentsSessionsRenameResponse = WebAPICallResult & { + error?: string; + needed?: string; + ok?: boolean; + provided?: string; + title?: string; + warning?: string; +}; diff --git a/packages/web-api/src/types/response/AgentsSessionsSetStatusResponse.ts b/packages/web-api/src/types/response/AgentsSessionsSetStatusResponse.ts new file mode 100644 index 000000000..191566f05 --- /dev/null +++ b/packages/web-api/src/types/response/AgentsSessionsSetStatusResponse.ts @@ -0,0 +1,20 @@ +///////////////////////////////////////////////////////////////////////////////////////// +// // +// !!! DO NOT EDIT THIS FILE !!! // +// // +// This file is auto-generated by scripts/generate-web-api-types.sh in the repository. // +// Please refer to the script code to learn how to update the source data. // +// // +///////////////////////////////////////////////////////////////////////////////////////// + +import type { WebAPICallResult } from '../../WebClient'; +export type AgentsSessionsSetStatusResponse = WebAPICallResult & { + agent_status?: string; + error?: string; + needed?: string; + ok?: boolean; + provided?: string; + status?: string; + title?: string; + warning?: string; +}; diff --git a/packages/web-api/src/types/response/index.ts b/packages/web-api/src/types/response/index.ts index 3f395d8b4..d9fadef37 100644 --- a/packages/web-api/src/types/response/index.ts +++ b/packages/web-api/src/types/response/index.ts @@ -102,6 +102,8 @@ export { AdminWorkflowsCollaboratorsRemoveResponse } from './AdminWorkflowsColla export { AdminWorkflowsPermissionsLookupResponse } from './AdminWorkflowsPermissionsLookupResponse'; export { AdminWorkflowsSearchResponse } from './AdminWorkflowsSearchResponse'; export { AdminWorkflowsUnpublishResponse } from './AdminWorkflowsUnpublishResponse'; +export { AgentsSessionsRenameResponse } from './AgentsSessionsRenameResponse'; +export { AgentsSessionsSetStatusResponse } from './AgentsSessionsSetStatusResponse'; export { ApiTestResponse } from './ApiTestResponse'; export { AppsConnectionsOpenResponse } from './AppsConnectionsOpenResponse'; export { AppsEventAuthorizationsListResponse } from './AppsEventAuthorizationsListResponse'; From c85faef86be064c36aa10894e91c7630e8c57f18 Mon Sep 17 00:00:00 2001 From: Eden Zimbelman Date: Fri, 21 Aug 2026 17:06:17 -0700 Subject: [PATCH 2/2] docs(web-api): add changeset for agents.sessions methods Co-Authored-By: Claude --- .changeset/agents-sessions-methods.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/agents-sessions-methods.md diff --git a/.changeset/agents-sessions-methods.md b/.changeset/agents-sessions-methods.md new file mode 100644 index 000000000..3a08416aa --- /dev/null +++ b/.changeset/agents-sessions-methods.md @@ -0,0 +1,5 @@ +--- +"@slack/web-api": minor +--- + +feat(web-api): add [`agents.sessions.rename`](https://docs.slack.dev/reference/methods/agents.sessions.rename) and [`agents.sessions.setStatus`](https://docs.slack.dev/reference/methods/agents.sessions.setStatus)