Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/agents-sessions-methods.md
Original file line number Diff line number Diff line change
@@ -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)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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)
feat: 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)

📚 note: Changesets are added to this package without needing redundencies.

22 changes: 22 additions & 0 deletions packages/web-api/src/methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ import type {
AdminWorkflowsPermissionsLookupArguments,
AdminWorkflowsSearchArguments,
AdminWorkflowsUnpublishArguments,
AgentsSessionsRenameArguments,
AgentsSessionsSetStatusArguments,
APITestArguments,
AppsConnectionsOpenArguments,
AppsEventAuthorizationsListArguments,
Expand Down Expand Up @@ -368,6 +370,8 @@ import type {
AdminWorkflowsPermissionsLookupResponse,
AdminWorkflowsSearchResponse,
AdminWorkflowsUnpublishResponse,
AgentsSessionsRenameResponse,
AgentsSessionsSetStatusResponse,
ApiTestResponse,
AppsConnectionsOpenResponse,
AppsEventAuthorizationsListResponse,
Expand Down Expand Up @@ -1374,6 +1378,24 @@ export abstract class Methods extends EventEmitter<WebClientEvent> {
},
};

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<AgentsSessionsRenameArguments, AgentsSessionsRenameResponse>(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<AgentsSessionsSetStatusArguments, AgentsSessionsSetStatusResponse>(
this,
'agents.sessions.setStatus',
),
},
};

public readonly api = {
/**
* @description Checks API calling code.
Expand Down
55 changes: 55 additions & 0 deletions packages/web-api/src/types/request/agents.ts
Original file line number Diff line number Diff line change
@@ -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;
}
1 change: 1 addition & 0 deletions packages/web-api/src/types/request/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
};
Original file line number Diff line number Diff line change
@@ -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;
};
2 changes: 2 additions & 0 deletions packages/web-api/src/types/response/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down