Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
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/slackbot-skills-update.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@slack/web-api": minor
---

feat(web-api): add [`slackbot.skills.update`](https://docs.slack.dev/reference/methods/slackbot.skills.update) method
7 changes: 7 additions & 0 deletions packages/web-api/src/methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ import type {
SearchMessagesArguments,
SlackbotSkillsCreateArguments,
SlackbotSkillsInfoArguments,
SlackbotSkillsUpdateArguments,
SlackListsAccessDeleteArguments,
SlackListsAccessSetArguments,
SlackListsCreateArguments,
Expand Down Expand Up @@ -522,6 +523,7 @@ import type {
SearchMessagesResponse,
SlackbotSkillsCreateResponse,
SlackbotSkillsInfoResponse,
SlackbotSkillsUpdateResponse,
SlackListsAccessDeleteResponse,
SlackListsAccessSetResponse,
SlackListsCreateResponse,
Expand Down Expand Up @@ -2366,6 +2368,11 @@ export abstract class Methods extends EventEmitter<WebClientEvent> {
* @see {@link https://docs.slack.dev/reference/methods/slackbot.skills.info `slackbot.skills.info` API reference}.
*/
info: bindApiCall<SlackbotSkillsInfoArguments, SlackbotSkillsInfoResponse>(this, 'slackbot.skills.info'),
/**
* @description Changes a Slackbot skill's instructions or metadata.
* @see {@link https://docs.slack.dev/reference/methods/slackbot.skills.update `slackbot.skills.update` API reference}.
*/
update: bindApiCall<SlackbotSkillsUpdateArguments, SlackbotSkillsUpdateResponse>(this, 'slackbot.skills.update'),
},
};

Expand Down
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 @@ -294,6 +294,7 @@ export type {
export type {
SlackbotSkillsCreateArguments,
SlackbotSkillsInfoArguments,
SlackbotSkillsUpdateArguments,
} from './slackbot';
export type {
SlackListsAccessDeleteArguments,
Expand Down
35 changes: 35 additions & 0 deletions packages/web-api/src/types/request/slackbot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,38 @@ export interface SlackbotSkillsInfoArguments extends TokenOverridable {
/** @description Skill to fetch: a canvas file ID or a `builtin:` reference. */
skill_id: string;
}

// https://docs.slack.dev/reference/methods/slackbot.skills.update
export interface SlackbotSkillsUpdateArguments extends TokenOverridable {
/** @description Skill to change. */
skill_id: string;
/** @description Human-readable label. Max 255 characters. */
display_name?: string;
/** @description Markdown that replaces the whole document. */
instructions?: string;
/** @description When Slackbot should use the skill. Max 400 characters. Send an empty string to clear. */
description?: string;
/** @description One of the skill categories. Send an empty string to clear. */
category?:
Comment thread
zimeg marked this conversation as resolved.
Resolved
| 'communication'
| 'customer_support'
| 'data_and_analytics'
| 'engineering'
| 'other'
| 'product_management'
| 'productivity'
| 'professional_development'
| 'project_management'
| 'sales'
| 'system'
| 'team_management'
| '';
/** @description Max 200 characters. May contain `{skill}`. Send an empty string to clear. */
example_prompt?: string;
/** @description Apps the skill needs. Replaces the whole list; send `[]` to clear. */
mcp_servers?: {
service_type: string;
app_id?: string;
server_id?: string;
}[];
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/////////////////////////////////////////////////////////////////////////////////////////
// //
// !!! 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 SlackbotSkillsUpdateResponse = WebAPICallResult & {
error?: string;
invalid_mcp_servers?: InvalidmcpServer[];
needed?: string;
ok?: boolean;
provided?: string;
response_metadata?: ResponseMetadata;
skill?: Skill;
warning?: string;
};

export interface InvalidmcpServer {
app_id?: string;
server_id?: string;
service_type?: string;
}

export interface ResponseMetadata {
messages?: string[];
}

export interface Skill {
access?: string;
category?: string;
creator_id?: string;
date_created?: number;
date_updated?: number;
description?: string;
display_name?: string;
example_prompt?: string;
id?: string;
instructions?: string;
is_official?: boolean;
library_count?: number;
mcp_servers?: McpServer[];
name?: string;
permalink?: string;
type?: string;
usage_count?: number;
visibility?: string;
}

export interface McpServer {
app_id?: string;
display_name?: string;
is_available?: boolean;
server_id?: string;
service_type?: string;
}
1 change: 1 addition & 0 deletions packages/web-api/src/types/response/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ export { SearchFilesResponse } from './SearchFilesResponse';
export { SearchMessagesResponse } from './SearchMessagesResponse';
export { SlackbotSkillsCreateResponse } from './SlackbotSkillsCreateResponse';
export { SlackbotSkillsInfoResponse } from './SlackbotSkillsInfoResponse';
export { SlackbotSkillsUpdateResponse } from './SlackbotSkillsUpdateResponse';
export { SlackListsAccessDeleteResponse } from './SlackListsAccessDeleteResponse';
export { SlackListsAccessSetResponse } from './SlackListsAccessSetResponse';
export { SlackListsCreateResponse } from './SlackListsCreateResponse';
Expand Down
42 changes: 42 additions & 0 deletions packages/web-api/test/types/methods/slackbot.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,45 @@ expectAssignable<Parameters<typeof web.slackbot.skills.info>>([
skill_id: 'F1234',
},
]);

// slackbot.skills.update
// -- sad path
expectError(web.slackbot.skills.update()); // lacking argument
expectError(web.slackbot.skills.update({})); // empty argument
expectError(
web.slackbot.skills.update({
display_name: 'Daily priorities', // missing skill_id
}),
);
expectError(
web.slackbot.skills.update({
skill_id: 'F1234',
category: 'cooking', // invalid category
}),
);
// -- happy path
expectAssignable<Parameters<typeof web.slackbot.skills.update>>([
{
skill_id: 'F1234',
},
]);
expectAssignable<Parameters<typeof web.slackbot.skills.update>>([
{
skill_id: 'F1234',
description: '',
category: '',
example_prompt: '',
mcp_servers: [],
},
]);
expectAssignable<Parameters<typeof web.slackbot.skills.update>>([
{
skill_id: 'F1234',
display_name: 'Daily priorities',
instructions: '# Purpose\nSuggest the three most important things to work on today.',
description: 'Reviews information from Slack and your calendar to suggest priorities for the day.',
category: 'productivity',
example_prompt: 'Run {skill} for today',
mcp_servers: [{ service_type: 'app', app_id: 'A1234' }],
},
]);
Loading