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) 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';