From 1c5afec456abb1603cabe8ce24783a185a65562e Mon Sep 17 00:00:00 2001 From: Eden Zimbelman Date: Wed, 19 Aug 2026 15:13:07 -0700 Subject: [PATCH 01/11] feat(web-api): add agents.sessions.setStatus and agents.sessions.rename Co-Authored-By: Claude --- slack_sdk/web/async_client.py | 52 +++++++++++++++++++ slack_sdk/web/client.py | 52 +++++++++++++++++++ slack_sdk/web/legacy_client.py | 52 +++++++++++++++++++ .../web/test_web_client_coverage.py | 10 +++- 4 files changed, 164 insertions(+), 2 deletions(-) diff --git a/slack_sdk/web/async_client.py b/slack_sdk/web/async_client.py index 0458b14c4..c69fb4fc6 100644 --- a/slack_sdk/web/async_client.py +++ b/slack_sdk/web/async_client.py @@ -2113,6 +2113,58 @@ async def assistant_threads_setStatus( kwargs = _remove_none_values(kwargs) return await self.api_call("assistant.threads.setStatus", json=kwargs) + async def agents_sessions_rename( + self, + *, + channel_id: str, + title: str, + thread_ts: Optional[str] = None, + **kwargs, + ) -> AsyncSlackResponse: + """Renames an agent session. + https://docs.slack.dev/reference/methods/agents.sessions.rename + """ + kwargs.update( + { + "channel_id": channel_id, + "title": title, + "thread_ts": thread_ts, + } + ) + kwargs = _remove_none_values(kwargs) + return await self.api_call("agents.sessions.rename", json=kwargs) + + async def agents_sessions_setStatus( + self, + *, + channel_id: str, + status: str, + thread_ts: Optional[str] = None, + title: Optional[str] = None, + initiator_user_id: Optional[str] = None, + icon_emoji: Optional[str] = None, + icon_url: Optional[str] = None, + username: Optional[str] = None, + **kwargs, + ) -> AsyncSlackResponse: + """Sets the lifecycle status of an agent session, creating the session if it does not already exist. + https://docs.slack.dev/reference/methods/agents.sessions.setStatus + """ + kwargs.update( + { + "channel_id": channel_id, + "status": status, + "thread_ts": thread_ts, + "title": title, + "initiator_user_id": initiator_user_id, + "icon_emoji": icon_emoji, + "icon_url": icon_url, + "username": username, + } + ) + kwargs = _remove_none_values(kwargs) + return await self.api_call("agents.sessions.setStatus", json=kwargs) + async def assistant_threads_setTitle( self, *, diff --git a/slack_sdk/web/client.py b/slack_sdk/web/client.py index 967713b4e..d908ec080 100644 --- a/slack_sdk/web/client.py +++ b/slack_sdk/web/client.py @@ -2103,6 +2103,58 @@ def assistant_threads_setStatus( kwargs = _remove_none_values(kwargs) return self.api_call("assistant.threads.setStatus", json=kwargs) + def agents_sessions_rename( + self, + *, + channel_id: str, + title: str, + thread_ts: Optional[str] = None, + **kwargs, + ) -> SlackResponse: + """Renames an agent session. + https://docs.slack.dev/reference/methods/agents.sessions.rename + """ + kwargs.update( + { + "channel_id": channel_id, + "title": title, + "thread_ts": thread_ts, + } + ) + kwargs = _remove_none_values(kwargs) + return self.api_call("agents.sessions.rename", json=kwargs) + + def agents_sessions_setStatus( + self, + *, + channel_id: str, + status: str, + thread_ts: Optional[str] = None, + title: Optional[str] = None, + initiator_user_id: Optional[str] = None, + icon_emoji: Optional[str] = None, + icon_url: Optional[str] = None, + username: Optional[str] = None, + **kwargs, + ) -> SlackResponse: + """Sets the lifecycle status of an agent session, creating the session if it does not already exist. + https://docs.slack.dev/reference/methods/agents.sessions.setStatus + """ + kwargs.update( + { + "channel_id": channel_id, + "status": status, + "thread_ts": thread_ts, + "title": title, + "initiator_user_id": initiator_user_id, + "icon_emoji": icon_emoji, + "icon_url": icon_url, + "username": username, + } + ) + kwargs = _remove_none_values(kwargs) + return self.api_call("agents.sessions.setStatus", json=kwargs) + def assistant_threads_setTitle( self, *, diff --git a/slack_sdk/web/legacy_client.py b/slack_sdk/web/legacy_client.py index ccbd09666..c247280f7 100644 --- a/slack_sdk/web/legacy_client.py +++ b/slack_sdk/web/legacy_client.py @@ -2114,6 +2114,58 @@ def assistant_threads_setStatus( kwargs = _remove_none_values(kwargs) return self.api_call("assistant.threads.setStatus", json=kwargs) + def agents_sessions_rename( + self, + *, + channel_id: str, + title: str, + thread_ts: Optional[str] = None, + **kwargs, + ) -> Union[Future, SlackResponse]: + """Renames an agent session. + https://docs.slack.dev/reference/methods/agents.sessions.rename + """ + kwargs.update( + { + "channel_id": channel_id, + "title": title, + "thread_ts": thread_ts, + } + ) + kwargs = _remove_none_values(kwargs) + return self.api_call("agents.sessions.rename", json=kwargs) + + def agents_sessions_setStatus( + self, + *, + channel_id: str, + status: str, + thread_ts: Optional[str] = None, + title: Optional[str] = None, + initiator_user_id: Optional[str] = None, + icon_emoji: Optional[str] = None, + icon_url: Optional[str] = None, + username: Optional[str] = None, + **kwargs, + ) -> Union[Future, SlackResponse]: + """Sets the lifecycle status of an agent session, creating the session if it does not already exist. + https://docs.slack.dev/reference/methods/agents.sessions.setStatus + """ + kwargs.update( + { + "channel_id": channel_id, + "status": status, + "thread_ts": thread_ts, + "title": title, + "initiator_user_id": initiator_user_id, + "icon_emoji": icon_emoji, + "icon_url": icon_url, + "username": username, + } + ) + kwargs = _remove_none_values(kwargs) + return self.api_call("agents.sessions.setStatus", json=kwargs) + def assistant_threads_setTitle( self, *, diff --git a/tests/slack_sdk_async/web/test_web_client_coverage.py b/tests/slack_sdk_async/web/test_web_client_coverage.py index 7a16ee61a..337b3e914 100644 --- a/tests/slack_sdk_async/web/test_web_client_coverage.py +++ b/tests/slack_sdk_async/web/test_web_client_coverage.py @@ -13,9 +13,9 @@ class TestWebClientCoverage(unittest.TestCase): - # 306 endpoints as of February 19, 2025 + # 308 endpoints as of August 19, 2026 # Can be fetched by running `var methodNames = [].slice.call(document.getElementsByClassName('apiReferenceFilterableList__listItemLink')).map(e => e.href.replace("https://api.slack.com/methods/", ""));console.log(methodNames.toString());console.log(methodNames.length);` on https://api.slack.com/methods - all_api_methods = "admin.analytics.getFile,admin.apps.activities.list,admin.apps.approve,admin.apps.clearResolution,admin.apps.restrict,admin.apps.uninstall,admin.apps.approved.list,admin.apps.config.lookup,admin.apps.config.set,admin.apps.requests.cancel,admin.apps.requests.list,admin.apps.restricted.list,admin.audit.anomaly.allow.getItem,admin.audit.anomaly.allow.updateItem,admin.auth.policy.assignEntities,admin.auth.policy.getEntities,admin.auth.policy.removeEntities,admin.barriers.create,admin.barriers.delete,admin.barriers.list,admin.barriers.update,admin.conversations.archive,admin.conversations.bulkArchive,admin.conversations.bulkDelete,admin.conversations.bulkMove,admin.conversations.convertToPrivate,admin.conversations.convertToPublic,admin.conversations.create,admin.conversations.createForObjects,admin.conversations.delete,admin.conversations.disconnectShared,admin.conversations.getConversationPrefs,admin.conversations.getCustomRetention,admin.conversations.getTeams,admin.conversations.invite,admin.conversations.linkObjects,admin.conversations.lookup,admin.conversations.removeCustomRetention,admin.conversations.rename,admin.conversations.search,admin.conversations.setConversationPrefs,admin.conversations.setCustomRetention,admin.conversations.setTeams,admin.conversations.unarchive,admin.conversations.unlinkObjects,admin.conversations.ekm.listOriginalConnectedChannelInfo,admin.conversations.restrictAccess.addGroup,admin.conversations.restrictAccess.listGroups,admin.conversations.restrictAccess.removeGroup,admin.emoji.add,admin.emoji.addAlias,admin.emoji.list,admin.emoji.remove,admin.emoji.rename,admin.functions.list,admin.functions.permissions.lookup,admin.functions.permissions.set,admin.inviteRequests.approve,admin.inviteRequests.deny,admin.inviteRequests.list,admin.inviteRequests.approved.list,admin.inviteRequests.denied.list,admin.roles.addAssignments,admin.roles.listAssignments,admin.roles.removeAssignments,admin.teams.admins.list,admin.teams.create,admin.teams.list,admin.teams.owners.list,admin.teams.settings.info,admin.teams.settings.setDefaultChannels,admin.teams.settings.setDescription,admin.teams.settings.setDiscoverability,admin.teams.settings.setIcon,admin.teams.settings.setName,admin.usergroups.addChannels,admin.usergroups.addTeams,admin.usergroups.listChannels,admin.usergroups.removeChannels,admin.users.assign,admin.users.invite,admin.users.list,admin.users.remove,admin.users.setAdmin,admin.users.setExpiration,admin.users.setOwner,admin.users.setRegular,admin.users.session.clearSettings,admin.users.session.getSettings,admin.users.session.invalidate,admin.users.session.list,admin.users.session.reset,admin.users.session.resetBulk,admin.users.session.setSettings,admin.users.unsupportedVersions.export,admin.workflows.collaborators.add,admin.workflows.collaborators.remove,admin.workflows.permissions.lookup,admin.workflows.search,admin.workflows.unpublish,api.test,apps.activities.list,apps.auth.external.delete,apps.auth.external.get,apps.connections.open,apps.uninstall,apps.datastore.bulkDelete,apps.datastore.bulkGet,apps.datastore.bulkPut,apps.datastore.count,apps.datastore.delete,apps.datastore.get,apps.datastore.put,apps.datastore.query,apps.datastore.update,apps.event.authorizations.list,apps.manifest.create,apps.manifest.delete,apps.manifest.export,apps.manifest.update,apps.manifest.validate,apps.user.connection.update,assistant.search.context,assistant.threads.setStatus,assistant.threads.setSuggestedPrompts,assistant.threads.setTitle,auth.revoke,auth.test,auth.teams.list,bookmarks.add,bookmarks.edit,bookmarks.list,bookmarks.remove,bots.info,calls.add,calls.end,calls.info,calls.update,calls.participants.add,calls.participants.remove,canvases.access.delete,canvases.access.set,canvases.create,canvases.delete,canvases.edit,canvases.sections.lookup,channels.mark,chat.appendStream,chat.delete,chat.deleteScheduledMessage,chat.getPermalink,chat.meMessage,chat.postEphemeral,chat.postMessage,chat.scheduleMessage,chat.startStream,chat.stopStream,chat.unfurl,chat.update,chat.scheduledMessages.list,conversations.acceptSharedInvite,conversations.approveSharedInvite,conversations.archive,conversations.close,conversations.create,conversations.declineSharedInvite,conversations.history,conversations.info,conversations.invite,conversations.inviteShared,conversations.join,conversations.kick,conversations.leave,conversations.list,conversations.listConnectInvites,conversations.mark,conversations.members,conversations.open,conversations.rename,conversations.replies,conversations.setPurpose,conversations.setTopic,conversations.unarchive,conversations.canvases.create,conversations.externalInvitePermissions.set,conversations.requestSharedInvite.approve,conversations.requestSharedInvite.deny,conversations.requestSharedInvite.list,dialog.open,dnd.endDnd,dnd.endSnooze,dnd.info,dnd.setSnooze,dnd.teamInfo,emoji.list,files.completeUploadExternal,files.delete,files.getUploadURLExternal,files.info,files.list,files.revokePublicURL,files.sharedPublicURL,files.upload,files.comments.delete,files.remote.add,files.remote.info,files.remote.list,files.remote.remove,files.remote.share,files.remote.update,functions.completeError,functions.completeSuccess,functions.distributions.permissions.add,functions.distributions.permissions.list,functions.distributions.permissions.remove,functions.distributions.permissions.set,functions.workflows.steps.list,functions.workflows.steps.responses.export,groups.mark,migration.exchange,oauth.access,oauth.v2.access,oauth.v2.exchange,openid.connect.token,openid.connect.userInfo,pins.add,pins.list,pins.remove,reactions.add,reactions.get,reactions.list,reactions.remove,reminders.add,reminders.complete,reminders.delete,reminders.info,reminders.list,rtm.connect,rtm.start,search.all,search.files,search.messages,slackLists.access.delete,slackLists.access.set,slackLists.create,slackLists.update,slackLists.download.get,slackLists.download.start,slackLists.items.create,slackLists.items.delete,slackLists.items.deleteMultiple,slackLists.items.info,slackLists.items.list,slackLists.items.update,stars.add,stars.list,stars.remove,team.accessLogs,team.billableInfo,team.info,team.integrationLogs,team.billing.info,team.externalTeams.disconnect,team.externalTeams.list,team.preferences.list,team.profile.get,tooling.tokens.rotate,usergroups.create,usergroups.disable,usergroups.enable,usergroups.list,usergroups.update,usergroups.users.list,usergroups.users.update,users.conversations,users.deletePhoto,users.getPresence,users.identity,users.info,users.list,users.lookupByEmail,users.setActive,users.setPhoto,users.setPresence,users.discoverableContacts.lookup,users.profile.get,users.profile.set,views.open,views.publish,views.push,views.update,workflows.stepCompleted,workflows.stepFailed,workflows.updateStep,workflows.featured.add,workflows.featured.list,workflows.featured.remove,workflows.featured.set,workflows.triggers.permissions.add,workflows.triggers.permissions.list,workflows.triggers.permissions.remove,workflows.triggers.permissions.set,im.list,im.mark,mpim.list,mpim.mark".split( + all_api_methods = "admin.analytics.getFile,admin.apps.activities.list,admin.apps.approve,admin.apps.clearResolution,admin.apps.restrict,admin.apps.uninstall,admin.apps.approved.list,admin.apps.config.lookup,admin.apps.config.set,admin.apps.requests.cancel,admin.apps.requests.list,admin.apps.restricted.list,admin.audit.anomaly.allow.getItem,admin.audit.anomaly.allow.updateItem,admin.auth.policy.assignEntities,admin.auth.policy.getEntities,admin.auth.policy.removeEntities,admin.barriers.create,admin.barriers.delete,admin.barriers.list,admin.barriers.update,admin.conversations.archive,admin.conversations.bulkArchive,admin.conversations.bulkDelete,admin.conversations.bulkMove,admin.conversations.convertToPrivate,admin.conversations.convertToPublic,admin.conversations.create,admin.conversations.createForObjects,admin.conversations.delete,admin.conversations.disconnectShared,admin.conversations.getConversationPrefs,admin.conversations.getCustomRetention,admin.conversations.getTeams,admin.conversations.invite,admin.conversations.linkObjects,admin.conversations.lookup,admin.conversations.removeCustomRetention,admin.conversations.rename,admin.conversations.search,admin.conversations.setConversationPrefs,admin.conversations.setCustomRetention,admin.conversations.setTeams,admin.conversations.unarchive,admin.conversations.unlinkObjects,admin.conversations.ekm.listOriginalConnectedChannelInfo,admin.conversations.restrictAccess.addGroup,admin.conversations.restrictAccess.listGroups,admin.conversations.restrictAccess.removeGroup,admin.emoji.add,admin.emoji.addAlias,admin.emoji.list,admin.emoji.remove,admin.emoji.rename,admin.functions.list,admin.functions.permissions.lookup,admin.functions.permissions.set,admin.inviteRequests.approve,admin.inviteRequests.deny,admin.inviteRequests.list,admin.inviteRequests.approved.list,admin.inviteRequests.denied.list,admin.roles.addAssignments,admin.roles.listAssignments,admin.roles.removeAssignments,admin.teams.admins.list,admin.teams.create,admin.teams.list,admin.teams.owners.list,admin.teams.settings.info,admin.teams.settings.setDefaultChannels,admin.teams.settings.setDescription,admin.teams.settings.setDiscoverability,admin.teams.settings.setIcon,admin.teams.settings.setName,admin.usergroups.addChannels,admin.usergroups.addTeams,admin.usergroups.listChannels,admin.usergroups.removeChannels,admin.users.assign,admin.users.invite,admin.users.list,admin.users.remove,admin.users.setAdmin,admin.users.setExpiration,admin.users.setOwner,admin.users.setRegular,admin.users.session.clearSettings,admin.users.session.getSettings,admin.users.session.invalidate,admin.users.session.list,admin.users.session.reset,admin.users.session.resetBulk,admin.users.session.setSettings,admin.users.unsupportedVersions.export,admin.workflows.collaborators.add,admin.workflows.collaborators.remove,admin.workflows.permissions.lookup,admin.workflows.search,admin.workflows.unpublish,api.test,apps.activities.list,apps.auth.external.delete,apps.auth.external.get,apps.connections.open,apps.uninstall,apps.datastore.bulkDelete,apps.datastore.bulkGet,apps.datastore.bulkPut,apps.datastore.count,apps.datastore.delete,apps.datastore.get,apps.datastore.put,apps.datastore.query,apps.datastore.update,apps.event.authorizations.list,apps.manifest.create,apps.manifest.delete,apps.manifest.export,apps.manifest.update,apps.manifest.validate,apps.user.connection.update,agents.sessions.rename,agents.sessions.setStatus,assistant.search.context,assistant.threads.setStatus,assistant.threads.setSuggestedPrompts,assistant.threads.setTitle,auth.revoke,auth.test,auth.teams.list,bookmarks.add,bookmarks.edit,bookmarks.list,bookmarks.remove,bots.info,calls.add,calls.end,calls.info,calls.update,calls.participants.add,calls.participants.remove,canvases.access.delete,canvases.access.set,canvases.create,canvases.delete,canvases.edit,canvases.sections.lookup,channels.mark,chat.appendStream,chat.delete,chat.deleteScheduledMessage,chat.getPermalink,chat.meMessage,chat.postEphemeral,chat.postMessage,chat.scheduleMessage,chat.startStream,chat.stopStream,chat.unfurl,chat.update,chat.scheduledMessages.list,conversations.acceptSharedInvite,conversations.approveSharedInvite,conversations.archive,conversations.close,conversations.create,conversations.declineSharedInvite,conversations.history,conversations.info,conversations.invite,conversations.inviteShared,conversations.join,conversations.kick,conversations.leave,conversations.list,conversations.listConnectInvites,conversations.mark,conversations.members,conversations.open,conversations.rename,conversations.replies,conversations.setPurpose,conversations.setTopic,conversations.unarchive,conversations.canvases.create,conversations.externalInvitePermissions.set,conversations.requestSharedInvite.approve,conversations.requestSharedInvite.deny,conversations.requestSharedInvite.list,dialog.open,dnd.endDnd,dnd.endSnooze,dnd.info,dnd.setSnooze,dnd.teamInfo,emoji.list,files.completeUploadExternal,files.delete,files.getUploadURLExternal,files.info,files.list,files.revokePublicURL,files.sharedPublicURL,files.upload,files.comments.delete,files.remote.add,files.remote.info,files.remote.list,files.remote.remove,files.remote.share,files.remote.update,functions.completeError,functions.completeSuccess,functions.distributions.permissions.add,functions.distributions.permissions.list,functions.distributions.permissions.remove,functions.distributions.permissions.set,functions.workflows.steps.list,functions.workflows.steps.responses.export,groups.mark,migration.exchange,oauth.access,oauth.v2.access,oauth.v2.exchange,openid.connect.token,openid.connect.userInfo,pins.add,pins.list,pins.remove,reactions.add,reactions.get,reactions.list,reactions.remove,reminders.add,reminders.complete,reminders.delete,reminders.info,reminders.list,rtm.connect,rtm.start,search.all,search.files,search.messages,slackLists.access.delete,slackLists.access.set,slackLists.create,slackLists.update,slackLists.download.get,slackLists.download.start,slackLists.items.create,slackLists.items.delete,slackLists.items.deleteMultiple,slackLists.items.info,slackLists.items.list,slackLists.items.update,stars.add,stars.list,stars.remove,team.accessLogs,team.billableInfo,team.info,team.integrationLogs,team.billing.info,team.externalTeams.disconnect,team.externalTeams.list,team.preferences.list,team.profile.get,tooling.tokens.rotate,usergroups.create,usergroups.disable,usergroups.enable,usergroups.list,usergroups.update,usergroups.users.list,usergroups.users.update,users.conversations,users.deletePhoto,users.getPresence,users.identity,users.info,users.list,users.lookupByEmail,users.setActive,users.setPhoto,users.setPresence,users.discoverableContacts.lookup,users.profile.get,users.profile.set,views.open,views.publish,views.push,views.update,workflows.stepCompleted,workflows.stepFailed,workflows.updateStep,workflows.featured.add,workflows.featured.list,workflows.featured.remove,workflows.featured.set,workflows.triggers.permissions.add,workflows.triggers.permissions.list,workflows.triggers.permissions.remove,workflows.triggers.permissions.set,im.list,im.mark,mpim.list,mpim.mark".split( "," ) @@ -1163,6 +1163,12 @@ async def run_method(self, method_name, method, async_method): elif method_name == "users_discoverableContacts_lookup": self.api_methods_to_call.remove(method(email="foo@example.com")["method"]) await async_method(email="foo@example.com") + elif method_name == "agents_sessions_rename": + self.api_methods_to_call.remove(method(channel_id="C123", title="New title")["method"]) + await async_method(channel_id="C123", title="New title") + elif method_name == "agents_sessions_setStatus": + self.api_methods_to_call.remove(method(channel_id="C123", status="processing")["method"]) + await async_method(channel_id="C123", status="processing") else: self.api_methods_to_call.remove(method(*{})["method"]) await async_method(*{}) From 5ac795164020ce3a3ef9e2749a00793b07361f0b Mon Sep 17 00:00:00 2001 From: Eden Zimbelman Date: Wed, 19 Aug 2026 15:16:13 -0700 Subject: [PATCH 02/11] feat(web-api): add codeChannels.* methods Add the codeChannels.* Web API methods (archive, create, getCanvas, listViews, removeView, rename, setCanvasContent, setCommands, setProperties, setView) with arguments aligned to the API reference, alphabetized, and registered in the method coverage test. Stacked on the agents.sessions.* methods. Co-Authored-By: Claude --- slack_sdk/web/async_client.py | 198 ++++++++++++++++++ slack_sdk/web/client.py | 198 ++++++++++++++++++ slack_sdk/web/legacy_client.py | 198 ++++++++++++++++++ .../web/test_web_client_coverage.py | 36 +++- 4 files changed, 628 insertions(+), 2 deletions(-) diff --git a/slack_sdk/web/async_client.py b/slack_sdk/web/async_client.py index c69fb4fc6..9ab005c83 100644 --- a/slack_sdk/web/async_client.py +++ b/slack_sdk/web/async_client.py @@ -2165,6 +2165,204 @@ async def agents_sessions_setStatus( kwargs = _remove_none_values(kwargs) return await self.api_call("agents.sessions.setStatus", json=kwargs) + async def codeChannels_archive( + self, + *, + channel_id: str, + summary_message_ts: Optional[str] = None, + **kwargs, + ) -> AsyncSlackResponse: + """Archives a code channel, optionally recording a summary message on the channel. + https://docs.slack.dev/reference/methods/codeChannels.archive + """ + kwargs.update({"channel_id": channel_id, "summary_message_ts": summary_message_ts}) + kwargs = _remove_none_values(kwargs) + return await self.api_call("codeChannels.archive", json=kwargs) + + async def codeChannels_create( + self, + *, + name: str, + team_id: Optional[str] = None, + session_id: Optional[str] = None, + is_private: Optional[bool] = None, + origin_channel_id: Optional[str] = None, + origin_message_ts: Optional[str] = None, + **kwargs, + ) -> AsyncSlackResponse: + """Creates a dedicated code channel for an agent session. + https://docs.slack.dev/reference/methods/codeChannels.create + """ + kwargs.update( + { + "name": name, + "team_id": team_id, + "session_id": session_id, + "is_private": is_private, + "origin_channel_id": origin_channel_id, + "origin_message_ts": origin_message_ts, + } + ) + kwargs = _remove_none_values(kwargs) + return await self.api_call("codeChannels.create", json=kwargs) + + async def codeChannels_getCanvas( + self, + *, + channel_id: str, + canvas_id: str, + content_format: Optional[str] = None, + include_resolved: Optional[bool] = None, + **kwargs, + ) -> AsyncSlackResponse: + """Fetches a canvas attached to a code channel — full content plus comment threads — in a single round-trip. + https://docs.slack.dev/reference/methods/codeChannels.getCanvas + """ + kwargs.update( + { + "channel_id": channel_id, + "canvas_id": canvas_id, + "content_format": content_format, + "include_resolved": include_resolved, + } + ) + kwargs = _remove_none_values(kwargs) + return await self.api_call("codeChannels.getCanvas", json=kwargs) + + async def codeChannels_listViews( + self, + *, + channel_id: str, + **kwargs, + ) -> AsyncSlackResponse: + """Lists the views currently attached to a code channel. + https://docs.slack.dev/reference/methods/codeChannels.listViews + """ + kwargs.update({"channel_id": channel_id}) + kwargs = _remove_none_values(kwargs) + return await self.api_call("codeChannels.listViews", json=kwargs) + + async def codeChannels_removeView( + self, + *, + channel_id: str, + view_key: Optional[str] = None, + view_id: Optional[str] = None, + **kwargs, + ) -> AsyncSlackResponse: + """Removes a view from a code channel (provide exactly one of view_key or view_id). + https://docs.slack.dev/reference/methods/codeChannels.removeView + """ + kwargs.update({"channel_id": channel_id, "view_key": view_key, "view_id": view_id}) + kwargs = _remove_none_values(kwargs) + return await self.api_call("codeChannels.removeView", json=kwargs) + + async def codeChannels_rename( + self, + *, + channel_id: str, + name: str, + **kwargs, + ) -> AsyncSlackResponse: + """Renames a code channel. + https://docs.slack.dev/reference/methods/codeChannels.rename + """ + kwargs.update({"channel_id": channel_id, "name": name}) + kwargs = _remove_none_values(kwargs) + return await self.api_call("codeChannels.rename", json=kwargs) + + async def codeChannels_setCanvasContent( + self, + *, + channel_id: str, + canvas_id: str, + content: str, + **kwargs, + ) -> AsyncSlackResponse: + """Replaces the full markdown content of a canvas attached to a code channel, preserving the + comment threads on the sections your agent didn't change. + https://docs.slack.dev/reference/methods/codeChannels.setCanvasContent + """ + kwargs.update({"channel_id": channel_id, "canvas_id": canvas_id, "content": content}) + kwargs = _remove_none_values(kwargs) + return await self.api_call("codeChannels.setCanvasContent", json=kwargs) + + async def codeChannels_setCommands( + self, + *, + channel_id: str, + commands: List[Dict[str, Any]], + **kwargs, + ) -> AsyncSlackResponse: + """Registers the set of slash commands your agent offers in a code channel. + https://docs.slack.dev/reference/methods/codeChannels.setCommands + """ + kwargs.update({"channel_id": channel_id, "commands": commands}) + kwargs = _remove_none_values(kwargs) + return await self.api_call("codeChannels.setCommands", json=kwargs) + + async def codeChannels_setProperties( + self, + *, + channel_id: str, + code_channel: Optional[Dict[str, Any]] = None, + agent_resource: Optional[Dict[str, Any]] = None, + **kwargs, + ) -> AsyncSlackResponse: + """Sets properties on a code channel: context bar items and external resource details. + https://docs.slack.dev/reference/methods/codeChannels.setProperties + """ + kwargs.update( + { + "channel_id": channel_id, + "code_channel": code_channel, + "agent_resource": agent_resource, + } + ) + kwargs = _remove_none_values(kwargs) + return await self.api_call("codeChannels.setProperties", json=kwargs) + + async def codeChannels_setView( + self, + *, + channel_id: str, + type: Optional[str] = None, + view_key: Optional[str] = None, + content: Optional[str] = None, + blocks: Optional[List[Dict[str, Any]]] = None, + canvas_id: Optional[str] = None, + access_level: Optional[str] = None, + base_branch: Optional[str] = None, + head_branch: Optional[str] = None, + name: Optional[str] = None, + label: Optional[str] = None, + csp: Optional[Dict[str, Any]] = None, + **kwargs, + ) -> AsyncSlackResponse: + """Creates or updates a view in a code channel. Views can render HTML, diffs, Block Kit, or + canvases as tabs alongside the conversation. + https://docs.slack.dev/reference/methods/codeChannels.setView + """ + kwargs.update( + { + "channel_id": channel_id, + "type": type, + "view_key": view_key, + "content": content, + "blocks": blocks, + "canvas_id": canvas_id, + "access_level": access_level, + "base_branch": base_branch, + "head_branch": head_branch, + "name": name, + "label": label, + "csp": csp, + } + ) + kwargs = _remove_none_values(kwargs) + return await self.api_call("codeChannels.setView", json=kwargs) + return await self.api_call("codeChannels.setView", json=kwargs) + async def assistant_threads_setTitle( self, *, diff --git a/slack_sdk/web/client.py b/slack_sdk/web/client.py index d908ec080..b76fde034 100644 --- a/slack_sdk/web/client.py +++ b/slack_sdk/web/client.py @@ -2155,6 +2155,204 @@ def agents_sessions_setStatus( kwargs = _remove_none_values(kwargs) return self.api_call("agents.sessions.setStatus", json=kwargs) + def codeChannels_archive( + self, + *, + channel_id: str, + summary_message_ts: Optional[str] = None, + **kwargs, + ) -> SlackResponse: + """Archives a code channel, optionally recording a summary message on the channel. + https://docs.slack.dev/reference/methods/codeChannels.archive + """ + kwargs.update({"channel_id": channel_id, "summary_message_ts": summary_message_ts}) + kwargs = _remove_none_values(kwargs) + return self.api_call("codeChannels.archive", json=kwargs) + + def codeChannels_create( + self, + *, + name: str, + team_id: Optional[str] = None, + session_id: Optional[str] = None, + is_private: Optional[bool] = None, + origin_channel_id: Optional[str] = None, + origin_message_ts: Optional[str] = None, + **kwargs, + ) -> SlackResponse: + """Creates a dedicated code channel for an agent session. + https://docs.slack.dev/reference/methods/codeChannels.create + """ + kwargs.update( + { + "name": name, + "team_id": team_id, + "session_id": session_id, + "is_private": is_private, + "origin_channel_id": origin_channel_id, + "origin_message_ts": origin_message_ts, + } + ) + kwargs = _remove_none_values(kwargs) + return self.api_call("codeChannels.create", json=kwargs) + + def codeChannels_getCanvas( + self, + *, + channel_id: str, + canvas_id: str, + content_format: Optional[str] = None, + include_resolved: Optional[bool] = None, + **kwargs, + ) -> SlackResponse: + """Fetches a canvas attached to a code channel — full content plus comment threads — in a single round-trip. + https://docs.slack.dev/reference/methods/codeChannels.getCanvas + """ + kwargs.update( + { + "channel_id": channel_id, + "canvas_id": canvas_id, + "content_format": content_format, + "include_resolved": include_resolved, + } + ) + kwargs = _remove_none_values(kwargs) + return self.api_call("codeChannels.getCanvas", json=kwargs) + + def codeChannels_listViews( + self, + *, + channel_id: str, + **kwargs, + ) -> SlackResponse: + """Lists the views currently attached to a code channel. + https://docs.slack.dev/reference/methods/codeChannels.listViews + """ + kwargs.update({"channel_id": channel_id}) + kwargs = _remove_none_values(kwargs) + return self.api_call("codeChannels.listViews", json=kwargs) + + def codeChannels_removeView( + self, + *, + channel_id: str, + view_key: Optional[str] = None, + view_id: Optional[str] = None, + **kwargs, + ) -> SlackResponse: + """Removes a view from a code channel (provide exactly one of view_key or view_id). + https://docs.slack.dev/reference/methods/codeChannels.removeView + """ + kwargs.update({"channel_id": channel_id, "view_key": view_key, "view_id": view_id}) + kwargs = _remove_none_values(kwargs) + return self.api_call("codeChannels.removeView", json=kwargs) + + def codeChannels_rename( + self, + *, + channel_id: str, + name: str, + **kwargs, + ) -> SlackResponse: + """Renames a code channel. + https://docs.slack.dev/reference/methods/codeChannels.rename + """ + kwargs.update({"channel_id": channel_id, "name": name}) + kwargs = _remove_none_values(kwargs) + return self.api_call("codeChannels.rename", json=kwargs) + + def codeChannels_setCanvasContent( + self, + *, + channel_id: str, + canvas_id: str, + content: str, + **kwargs, + ) -> SlackResponse: + """Replaces the full markdown content of a canvas attached to a code channel, preserving the + comment threads on the sections your agent didn't change. + https://docs.slack.dev/reference/methods/codeChannels.setCanvasContent + """ + kwargs.update({"channel_id": channel_id, "canvas_id": canvas_id, "content": content}) + kwargs = _remove_none_values(kwargs) + return self.api_call("codeChannels.setCanvasContent", json=kwargs) + + def codeChannels_setCommands( + self, + *, + channel_id: str, + commands: List[Dict[str, Any]], + **kwargs, + ) -> SlackResponse: + """Registers the set of slash commands your agent offers in a code channel. + https://docs.slack.dev/reference/methods/codeChannels.setCommands + """ + kwargs.update({"channel_id": channel_id, "commands": commands}) + kwargs = _remove_none_values(kwargs) + return self.api_call("codeChannels.setCommands", json=kwargs) + + def codeChannels_setProperties( + self, + *, + channel_id: str, + code_channel: Optional[Dict[str, Any]] = None, + agent_resource: Optional[Dict[str, Any]] = None, + **kwargs, + ) -> SlackResponse: + """Sets properties on a code channel: context bar items and external resource details. + https://docs.slack.dev/reference/methods/codeChannels.setProperties + """ + kwargs.update( + { + "channel_id": channel_id, + "code_channel": code_channel, + "agent_resource": agent_resource, + } + ) + kwargs = _remove_none_values(kwargs) + return self.api_call("codeChannels.setProperties", json=kwargs) + + def codeChannels_setView( + self, + *, + channel_id: str, + type: Optional[str] = None, + view_key: Optional[str] = None, + content: Optional[str] = None, + blocks: Optional[List[Dict[str, Any]]] = None, + canvas_id: Optional[str] = None, + access_level: Optional[str] = None, + base_branch: Optional[str] = None, + head_branch: Optional[str] = None, + name: Optional[str] = None, + label: Optional[str] = None, + csp: Optional[Dict[str, Any]] = None, + **kwargs, + ) -> SlackResponse: + """Creates or updates a view in a code channel. Views can render HTML, diffs, Block Kit, or + canvases as tabs alongside the conversation. + https://docs.slack.dev/reference/methods/codeChannels.setView + """ + kwargs.update( + { + "channel_id": channel_id, + "type": type, + "view_key": view_key, + "content": content, + "blocks": blocks, + "canvas_id": canvas_id, + "access_level": access_level, + "base_branch": base_branch, + "head_branch": head_branch, + "name": name, + "label": label, + "csp": csp, + } + ) + kwargs = _remove_none_values(kwargs) + return self.api_call("codeChannels.setView", json=kwargs) + return self.api_call("codeChannels.setView", json=kwargs) + def assistant_threads_setTitle( self, *, diff --git a/slack_sdk/web/legacy_client.py b/slack_sdk/web/legacy_client.py index c247280f7..d32519ffd 100644 --- a/slack_sdk/web/legacy_client.py +++ b/slack_sdk/web/legacy_client.py @@ -2166,6 +2166,204 @@ def agents_sessions_setStatus( kwargs = _remove_none_values(kwargs) return self.api_call("agents.sessions.setStatus", json=kwargs) + def codeChannels_archive( + self, + *, + channel_id: str, + summary_message_ts: Optional[str] = None, + **kwargs, + ) -> Union[Future, SlackResponse]: + """Archives a code channel, optionally recording a summary message on the channel. + https://docs.slack.dev/reference/methods/codeChannels.archive + """ + kwargs.update({"channel_id": channel_id, "summary_message_ts": summary_message_ts}) + kwargs = _remove_none_values(kwargs) + return self.api_call("codeChannels.archive", json=kwargs) + + def codeChannels_create( + self, + *, + name: str, + team_id: Optional[str] = None, + session_id: Optional[str] = None, + is_private: Optional[bool] = None, + origin_channel_id: Optional[str] = None, + origin_message_ts: Optional[str] = None, + **kwargs, + ) -> Union[Future, SlackResponse]: + """Creates a dedicated code channel for an agent session. + https://docs.slack.dev/reference/methods/codeChannels.create + """ + kwargs.update( + { + "name": name, + "team_id": team_id, + "session_id": session_id, + "is_private": is_private, + "origin_channel_id": origin_channel_id, + "origin_message_ts": origin_message_ts, + } + ) + kwargs = _remove_none_values(kwargs) + return self.api_call("codeChannels.create", json=kwargs) + + def codeChannels_getCanvas( + self, + *, + channel_id: str, + canvas_id: str, + content_format: Optional[str] = None, + include_resolved: Optional[bool] = None, + **kwargs, + ) -> Union[Future, SlackResponse]: + """Fetches a canvas attached to a code channel — full content plus comment threads — in a single round-trip. + https://docs.slack.dev/reference/methods/codeChannels.getCanvas + """ + kwargs.update( + { + "channel_id": channel_id, + "canvas_id": canvas_id, + "content_format": content_format, + "include_resolved": include_resolved, + } + ) + kwargs = _remove_none_values(kwargs) + return self.api_call("codeChannels.getCanvas", json=kwargs) + + def codeChannels_listViews( + self, + *, + channel_id: str, + **kwargs, + ) -> Union[Future, SlackResponse]: + """Lists the views currently attached to a code channel. + https://docs.slack.dev/reference/methods/codeChannels.listViews + """ + kwargs.update({"channel_id": channel_id}) + kwargs = _remove_none_values(kwargs) + return self.api_call("codeChannels.listViews", json=kwargs) + + def codeChannels_removeView( + self, + *, + channel_id: str, + view_key: Optional[str] = None, + view_id: Optional[str] = None, + **kwargs, + ) -> Union[Future, SlackResponse]: + """Removes a view from a code channel (provide exactly one of view_key or view_id). + https://docs.slack.dev/reference/methods/codeChannels.removeView + """ + kwargs.update({"channel_id": channel_id, "view_key": view_key, "view_id": view_id}) + kwargs = _remove_none_values(kwargs) + return self.api_call("codeChannels.removeView", json=kwargs) + + def codeChannels_rename( + self, + *, + channel_id: str, + name: str, + **kwargs, + ) -> Union[Future, SlackResponse]: + """Renames a code channel. + https://docs.slack.dev/reference/methods/codeChannels.rename + """ + kwargs.update({"channel_id": channel_id, "name": name}) + kwargs = _remove_none_values(kwargs) + return self.api_call("codeChannels.rename", json=kwargs) + + def codeChannels_setCanvasContent( + self, + *, + channel_id: str, + canvas_id: str, + content: str, + **kwargs, + ) -> Union[Future, SlackResponse]: + """Replaces the full markdown content of a canvas attached to a code channel, preserving the + comment threads on the sections your agent didn't change. + https://docs.slack.dev/reference/methods/codeChannels.setCanvasContent + """ + kwargs.update({"channel_id": channel_id, "canvas_id": canvas_id, "content": content}) + kwargs = _remove_none_values(kwargs) + return self.api_call("codeChannels.setCanvasContent", json=kwargs) + + def codeChannels_setCommands( + self, + *, + channel_id: str, + commands: List[Dict[str, Any]], + **kwargs, + ) -> Union[Future, SlackResponse]: + """Registers the set of slash commands your agent offers in a code channel. + https://docs.slack.dev/reference/methods/codeChannels.setCommands + """ + kwargs.update({"channel_id": channel_id, "commands": commands}) + kwargs = _remove_none_values(kwargs) + return self.api_call("codeChannels.setCommands", json=kwargs) + + def codeChannels_setProperties( + self, + *, + channel_id: str, + code_channel: Optional[Dict[str, Any]] = None, + agent_resource: Optional[Dict[str, Any]] = None, + **kwargs, + ) -> Union[Future, SlackResponse]: + """Sets properties on a code channel: context bar items and external resource details. + https://docs.slack.dev/reference/methods/codeChannels.setProperties + """ + kwargs.update( + { + "channel_id": channel_id, + "code_channel": code_channel, + "agent_resource": agent_resource, + } + ) + kwargs = _remove_none_values(kwargs) + return self.api_call("codeChannels.setProperties", json=kwargs) + + def codeChannels_setView( + self, + *, + channel_id: str, + type: Optional[str] = None, + view_key: Optional[str] = None, + content: Optional[str] = None, + blocks: Optional[List[Dict[str, Any]]] = None, + canvas_id: Optional[str] = None, + access_level: Optional[str] = None, + base_branch: Optional[str] = None, + head_branch: Optional[str] = None, + name: Optional[str] = None, + label: Optional[str] = None, + csp: Optional[Dict[str, Any]] = None, + **kwargs, + ) -> Union[Future, SlackResponse]: + """Creates or updates a view in a code channel. Views can render HTML, diffs, Block Kit, or + canvases as tabs alongside the conversation. + https://docs.slack.dev/reference/methods/codeChannels.setView + """ + kwargs.update( + { + "channel_id": channel_id, + "type": type, + "view_key": view_key, + "content": content, + "blocks": blocks, + "canvas_id": canvas_id, + "access_level": access_level, + "base_branch": base_branch, + "head_branch": head_branch, + "name": name, + "label": label, + "csp": csp, + } + ) + kwargs = _remove_none_values(kwargs) + return self.api_call("codeChannels.setView", json=kwargs) + return self.api_call("codeChannels.setView", json=kwargs) + def assistant_threads_setTitle( self, *, diff --git a/tests/slack_sdk_async/web/test_web_client_coverage.py b/tests/slack_sdk_async/web/test_web_client_coverage.py index 337b3e914..e5e035623 100644 --- a/tests/slack_sdk_async/web/test_web_client_coverage.py +++ b/tests/slack_sdk_async/web/test_web_client_coverage.py @@ -13,9 +13,9 @@ class TestWebClientCoverage(unittest.TestCase): - # 308 endpoints as of August 19, 2026 + # 318 endpoints as of August 19, 2026 # Can be fetched by running `var methodNames = [].slice.call(document.getElementsByClassName('apiReferenceFilterableList__listItemLink')).map(e => e.href.replace("https://api.slack.com/methods/", ""));console.log(methodNames.toString());console.log(methodNames.length);` on https://api.slack.com/methods - all_api_methods = "admin.analytics.getFile,admin.apps.activities.list,admin.apps.approve,admin.apps.clearResolution,admin.apps.restrict,admin.apps.uninstall,admin.apps.approved.list,admin.apps.config.lookup,admin.apps.config.set,admin.apps.requests.cancel,admin.apps.requests.list,admin.apps.restricted.list,admin.audit.anomaly.allow.getItem,admin.audit.anomaly.allow.updateItem,admin.auth.policy.assignEntities,admin.auth.policy.getEntities,admin.auth.policy.removeEntities,admin.barriers.create,admin.barriers.delete,admin.barriers.list,admin.barriers.update,admin.conversations.archive,admin.conversations.bulkArchive,admin.conversations.bulkDelete,admin.conversations.bulkMove,admin.conversations.convertToPrivate,admin.conversations.convertToPublic,admin.conversations.create,admin.conversations.createForObjects,admin.conversations.delete,admin.conversations.disconnectShared,admin.conversations.getConversationPrefs,admin.conversations.getCustomRetention,admin.conversations.getTeams,admin.conversations.invite,admin.conversations.linkObjects,admin.conversations.lookup,admin.conversations.removeCustomRetention,admin.conversations.rename,admin.conversations.search,admin.conversations.setConversationPrefs,admin.conversations.setCustomRetention,admin.conversations.setTeams,admin.conversations.unarchive,admin.conversations.unlinkObjects,admin.conversations.ekm.listOriginalConnectedChannelInfo,admin.conversations.restrictAccess.addGroup,admin.conversations.restrictAccess.listGroups,admin.conversations.restrictAccess.removeGroup,admin.emoji.add,admin.emoji.addAlias,admin.emoji.list,admin.emoji.remove,admin.emoji.rename,admin.functions.list,admin.functions.permissions.lookup,admin.functions.permissions.set,admin.inviteRequests.approve,admin.inviteRequests.deny,admin.inviteRequests.list,admin.inviteRequests.approved.list,admin.inviteRequests.denied.list,admin.roles.addAssignments,admin.roles.listAssignments,admin.roles.removeAssignments,admin.teams.admins.list,admin.teams.create,admin.teams.list,admin.teams.owners.list,admin.teams.settings.info,admin.teams.settings.setDefaultChannels,admin.teams.settings.setDescription,admin.teams.settings.setDiscoverability,admin.teams.settings.setIcon,admin.teams.settings.setName,admin.usergroups.addChannels,admin.usergroups.addTeams,admin.usergroups.listChannels,admin.usergroups.removeChannels,admin.users.assign,admin.users.invite,admin.users.list,admin.users.remove,admin.users.setAdmin,admin.users.setExpiration,admin.users.setOwner,admin.users.setRegular,admin.users.session.clearSettings,admin.users.session.getSettings,admin.users.session.invalidate,admin.users.session.list,admin.users.session.reset,admin.users.session.resetBulk,admin.users.session.setSettings,admin.users.unsupportedVersions.export,admin.workflows.collaborators.add,admin.workflows.collaborators.remove,admin.workflows.permissions.lookup,admin.workflows.search,admin.workflows.unpublish,api.test,apps.activities.list,apps.auth.external.delete,apps.auth.external.get,apps.connections.open,apps.uninstall,apps.datastore.bulkDelete,apps.datastore.bulkGet,apps.datastore.bulkPut,apps.datastore.count,apps.datastore.delete,apps.datastore.get,apps.datastore.put,apps.datastore.query,apps.datastore.update,apps.event.authorizations.list,apps.manifest.create,apps.manifest.delete,apps.manifest.export,apps.manifest.update,apps.manifest.validate,apps.user.connection.update,agents.sessions.rename,agents.sessions.setStatus,assistant.search.context,assistant.threads.setStatus,assistant.threads.setSuggestedPrompts,assistant.threads.setTitle,auth.revoke,auth.test,auth.teams.list,bookmarks.add,bookmarks.edit,bookmarks.list,bookmarks.remove,bots.info,calls.add,calls.end,calls.info,calls.update,calls.participants.add,calls.participants.remove,canvases.access.delete,canvases.access.set,canvases.create,canvases.delete,canvases.edit,canvases.sections.lookup,channels.mark,chat.appendStream,chat.delete,chat.deleteScheduledMessage,chat.getPermalink,chat.meMessage,chat.postEphemeral,chat.postMessage,chat.scheduleMessage,chat.startStream,chat.stopStream,chat.unfurl,chat.update,chat.scheduledMessages.list,conversations.acceptSharedInvite,conversations.approveSharedInvite,conversations.archive,conversations.close,conversations.create,conversations.declineSharedInvite,conversations.history,conversations.info,conversations.invite,conversations.inviteShared,conversations.join,conversations.kick,conversations.leave,conversations.list,conversations.listConnectInvites,conversations.mark,conversations.members,conversations.open,conversations.rename,conversations.replies,conversations.setPurpose,conversations.setTopic,conversations.unarchive,conversations.canvases.create,conversations.externalInvitePermissions.set,conversations.requestSharedInvite.approve,conversations.requestSharedInvite.deny,conversations.requestSharedInvite.list,dialog.open,dnd.endDnd,dnd.endSnooze,dnd.info,dnd.setSnooze,dnd.teamInfo,emoji.list,files.completeUploadExternal,files.delete,files.getUploadURLExternal,files.info,files.list,files.revokePublicURL,files.sharedPublicURL,files.upload,files.comments.delete,files.remote.add,files.remote.info,files.remote.list,files.remote.remove,files.remote.share,files.remote.update,functions.completeError,functions.completeSuccess,functions.distributions.permissions.add,functions.distributions.permissions.list,functions.distributions.permissions.remove,functions.distributions.permissions.set,functions.workflows.steps.list,functions.workflows.steps.responses.export,groups.mark,migration.exchange,oauth.access,oauth.v2.access,oauth.v2.exchange,openid.connect.token,openid.connect.userInfo,pins.add,pins.list,pins.remove,reactions.add,reactions.get,reactions.list,reactions.remove,reminders.add,reminders.complete,reminders.delete,reminders.info,reminders.list,rtm.connect,rtm.start,search.all,search.files,search.messages,slackLists.access.delete,slackLists.access.set,slackLists.create,slackLists.update,slackLists.download.get,slackLists.download.start,slackLists.items.create,slackLists.items.delete,slackLists.items.deleteMultiple,slackLists.items.info,slackLists.items.list,slackLists.items.update,stars.add,stars.list,stars.remove,team.accessLogs,team.billableInfo,team.info,team.integrationLogs,team.billing.info,team.externalTeams.disconnect,team.externalTeams.list,team.preferences.list,team.profile.get,tooling.tokens.rotate,usergroups.create,usergroups.disable,usergroups.enable,usergroups.list,usergroups.update,usergroups.users.list,usergroups.users.update,users.conversations,users.deletePhoto,users.getPresence,users.identity,users.info,users.list,users.lookupByEmail,users.setActive,users.setPhoto,users.setPresence,users.discoverableContacts.lookup,users.profile.get,users.profile.set,views.open,views.publish,views.push,views.update,workflows.stepCompleted,workflows.stepFailed,workflows.updateStep,workflows.featured.add,workflows.featured.list,workflows.featured.remove,workflows.featured.set,workflows.triggers.permissions.add,workflows.triggers.permissions.list,workflows.triggers.permissions.remove,workflows.triggers.permissions.set,im.list,im.mark,mpim.list,mpim.mark".split( + all_api_methods = "admin.analytics.getFile,admin.apps.activities.list,admin.apps.approve,admin.apps.clearResolution,admin.apps.restrict,admin.apps.uninstall,admin.apps.approved.list,admin.apps.config.lookup,admin.apps.config.set,admin.apps.requests.cancel,admin.apps.requests.list,admin.apps.restricted.list,admin.audit.anomaly.allow.getItem,admin.audit.anomaly.allow.updateItem,admin.auth.policy.assignEntities,admin.auth.policy.getEntities,admin.auth.policy.removeEntities,admin.barriers.create,admin.barriers.delete,admin.barriers.list,admin.barriers.update,admin.conversations.archive,admin.conversations.bulkArchive,admin.conversations.bulkDelete,admin.conversations.bulkMove,admin.conversations.convertToPrivate,admin.conversations.convertToPublic,admin.conversations.create,admin.conversations.createForObjects,admin.conversations.delete,admin.conversations.disconnectShared,admin.conversations.getConversationPrefs,admin.conversations.getCustomRetention,admin.conversations.getTeams,admin.conversations.invite,admin.conversations.linkObjects,admin.conversations.lookup,admin.conversations.removeCustomRetention,admin.conversations.rename,admin.conversations.search,admin.conversations.setConversationPrefs,admin.conversations.setCustomRetention,admin.conversations.setTeams,admin.conversations.unarchive,admin.conversations.unlinkObjects,admin.conversations.ekm.listOriginalConnectedChannelInfo,admin.conversations.restrictAccess.addGroup,admin.conversations.restrictAccess.listGroups,admin.conversations.restrictAccess.removeGroup,admin.emoji.add,admin.emoji.addAlias,admin.emoji.list,admin.emoji.remove,admin.emoji.rename,admin.functions.list,admin.functions.permissions.lookup,admin.functions.permissions.set,admin.inviteRequests.approve,admin.inviteRequests.deny,admin.inviteRequests.list,admin.inviteRequests.approved.list,admin.inviteRequests.denied.list,admin.roles.addAssignments,admin.roles.listAssignments,admin.roles.removeAssignments,admin.teams.admins.list,admin.teams.create,admin.teams.list,admin.teams.owners.list,admin.teams.settings.info,admin.teams.settings.setDefaultChannels,admin.teams.settings.setDescription,admin.teams.settings.setDiscoverability,admin.teams.settings.setIcon,admin.teams.settings.setName,admin.usergroups.addChannels,admin.usergroups.addTeams,admin.usergroups.listChannels,admin.usergroups.removeChannels,admin.users.assign,admin.users.invite,admin.users.list,admin.users.remove,admin.users.setAdmin,admin.users.setExpiration,admin.users.setOwner,admin.users.setRegular,admin.users.session.clearSettings,admin.users.session.getSettings,admin.users.session.invalidate,admin.users.session.list,admin.users.session.reset,admin.users.session.resetBulk,admin.users.session.setSettings,admin.users.unsupportedVersions.export,admin.workflows.collaborators.add,admin.workflows.collaborators.remove,admin.workflows.permissions.lookup,admin.workflows.search,admin.workflows.unpublish,api.test,apps.activities.list,apps.auth.external.delete,apps.auth.external.get,apps.connections.open,apps.uninstall,apps.datastore.bulkDelete,apps.datastore.bulkGet,apps.datastore.bulkPut,apps.datastore.count,apps.datastore.delete,apps.datastore.get,apps.datastore.put,apps.datastore.query,apps.datastore.update,apps.event.authorizations.list,apps.manifest.create,apps.manifest.delete,apps.manifest.export,apps.manifest.update,apps.manifest.validate,apps.user.connection.update,agents.sessions.rename,agents.sessions.setStatus,assistant.search.context,assistant.threads.setStatus,assistant.threads.setSuggestedPrompts,assistant.threads.setTitle,auth.revoke,auth.test,auth.teams.list,bookmarks.add,bookmarks.edit,bookmarks.list,bookmarks.remove,bots.info,calls.add,calls.end,calls.info,calls.update,calls.participants.add,calls.participants.remove,canvases.access.delete,canvases.access.set,canvases.create,canvases.delete,canvases.edit,canvases.sections.lookup,channels.mark,codeChannels.archive,codeChannels.create,codeChannels.getCanvas,codeChannels.listViews,codeChannels.removeView,codeChannels.rename,codeChannels.setCanvasContent,codeChannels.setCommands,codeChannels.setProperties,codeChannels.setView,chat.appendStream,chat.delete,chat.deleteScheduledMessage,chat.getPermalink,chat.meMessage,chat.postEphemeral,chat.postMessage,chat.scheduleMessage,chat.startStream,chat.stopStream,chat.unfurl,chat.update,chat.scheduledMessages.list,conversations.acceptSharedInvite,conversations.approveSharedInvite,conversations.archive,conversations.close,conversations.create,conversations.declineSharedInvite,conversations.history,conversations.info,conversations.invite,conversations.inviteShared,conversations.join,conversations.kick,conversations.leave,conversations.list,conversations.listConnectInvites,conversations.mark,conversations.members,conversations.open,conversations.rename,conversations.replies,conversations.setPurpose,conversations.setTopic,conversations.unarchive,conversations.canvases.create,conversations.externalInvitePermissions.set,conversations.requestSharedInvite.approve,conversations.requestSharedInvite.deny,conversations.requestSharedInvite.list,dialog.open,dnd.endDnd,dnd.endSnooze,dnd.info,dnd.setSnooze,dnd.teamInfo,emoji.list,files.completeUploadExternal,files.delete,files.getUploadURLExternal,files.info,files.list,files.revokePublicURL,files.sharedPublicURL,files.upload,files.comments.delete,files.remote.add,files.remote.info,files.remote.list,files.remote.remove,files.remote.share,files.remote.update,functions.completeError,functions.completeSuccess,functions.distributions.permissions.add,functions.distributions.permissions.list,functions.distributions.permissions.remove,functions.distributions.permissions.set,functions.workflows.steps.list,functions.workflows.steps.responses.export,groups.mark,migration.exchange,oauth.access,oauth.v2.access,oauth.v2.exchange,openid.connect.token,openid.connect.userInfo,pins.add,pins.list,pins.remove,reactions.add,reactions.get,reactions.list,reactions.remove,reminders.add,reminders.complete,reminders.delete,reminders.info,reminders.list,rtm.connect,rtm.start,search.all,search.files,search.messages,slackLists.access.delete,slackLists.access.set,slackLists.create,slackLists.update,slackLists.download.get,slackLists.download.start,slackLists.items.create,slackLists.items.delete,slackLists.items.deleteMultiple,slackLists.items.info,slackLists.items.list,slackLists.items.update,stars.add,stars.list,stars.remove,team.accessLogs,team.billableInfo,team.info,team.integrationLogs,team.billing.info,team.externalTeams.disconnect,team.externalTeams.list,team.preferences.list,team.profile.get,tooling.tokens.rotate,usergroups.create,usergroups.disable,usergroups.enable,usergroups.list,usergroups.update,usergroups.users.list,usergroups.users.update,users.conversations,users.deletePhoto,users.getPresence,users.identity,users.info,users.list,users.lookupByEmail,users.setActive,users.setPhoto,users.setPresence,users.discoverableContacts.lookup,users.profile.get,users.profile.set,views.open,views.publish,views.push,views.update,workflows.stepCompleted,workflows.stepFailed,workflows.updateStep,workflows.featured.add,workflows.featured.list,workflows.featured.remove,workflows.featured.set,workflows.triggers.permissions.add,workflows.triggers.permissions.list,workflows.triggers.permissions.remove,workflows.triggers.permissions.set,im.list,im.mark,mpim.list,mpim.mark".split( "," ) @@ -1169,6 +1169,38 @@ async def run_method(self, method_name, method, async_method): elif method_name == "agents_sessions_setStatus": self.api_methods_to_call.remove(method(channel_id="C123", status="processing")["method"]) await async_method(channel_id="C123", status="processing") + elif method_name == "codeChannels_archive": + self.api_methods_to_call.remove(method(channel_id="C123")["method"]) + await async_method(channel_id="C123") + elif method_name == "codeChannels_create": + self.api_methods_to_call.remove( + method(name="Fix flaky test", origin_channel_id="C123", origin_message_ts="1717171717.123456")["method"] + ) + await async_method(name="Fix flaky test", origin_channel_id="C123", origin_message_ts="1717171717.123456") + elif method_name == "codeChannels_getCanvas": + self.api_methods_to_call.remove(method(channel_id="C123", canvas_id="F123")["method"]) + await async_method(channel_id="C123", canvas_id="F123") + elif method_name == "codeChannels_listViews": + self.api_methods_to_call.remove(method(channel_id="C123")["method"]) + await async_method(channel_id="C123") + elif method_name == "codeChannels_removeView": + self.api_methods_to_call.remove(method(channel_id="C123", view_id="V123")["method"]) + await async_method(channel_id="C123", view_id="V123") + elif method_name == "codeChannels_rename": + self.api_methods_to_call.remove(method(channel_id="C123", name="new-name")["method"]) + await async_method(channel_id="C123", name="new-name") + elif method_name == "codeChannels_setCanvasContent": + self.api_methods_to_call.remove(method(channel_id="C123", canvas_id="F123", content="# Plan")["method"]) + await async_method(channel_id="C123", canvas_id="F123", content="# Plan") + elif method_name == "codeChannels_setCommands": + self.api_methods_to_call.remove(method(channel_id="C123", commands=[])["method"]) + await async_method(channel_id="C123", commands=[]) + elif method_name == "codeChannels_setProperties": + self.api_methods_to_call.remove(method(channel_id="C123")["method"]) + await async_method(channel_id="C123") + elif method_name == "codeChannels_setView": + self.api_methods_to_call.remove(method(channel_id="C123", type="diff")["method"]) + await async_method(channel_id="C123", type="diff") else: self.api_methods_to_call.remove(method(*{})["method"]) await async_method(*{}) From c8a816839617ea9057c7b6936b6a97ff088234f5 Mon Sep 17 00:00:00 2001 From: Eden Zimbelman Date: Wed, 23 Sep 2026 13:23:39 -0700 Subject: [PATCH 03/11] feat(web-api): rename Slack Code methods to agents.conversations.* (no legacy names) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Renames the 9 Slack Code Web API methods from the legacy codeChannels.* names to the agents.conversations.* family, per the 2026-09-23 decision to ship only the new names (no legacy aliases). Drops codeChannels.rename entirely — agents.sessions.rename already covers it. Methods now use **kwargs passthrough with rich docstrings enumerating each arg (name / type / required) drawn from the docs #816 schemas, plus the canonical doc URL. getCanvas and setCanvasContent take `channel` (not `channel_id`) per the API. All 9 require the code_channels:manage scope (vs chat:write for agents.sessions.*). async_client.py and legacy_client.py are regenerated from client.py via scripts/codegen.py. Coverage test updated to the new names. Co-Authored-By: Claude Co-Authored-By: Claude Opus 4.8 (1M context) --- slack_sdk/web/async_client.py | 291 +++++++++--------- slack_sdk/web/client.py | 291 +++++++++--------- slack_sdk/web/legacy_client.py | 290 +++++++++-------- .../web/test_web_client_coverage.py | 31 +- 4 files changed, 427 insertions(+), 476 deletions(-) diff --git a/slack_sdk/web/async_client.py b/slack_sdk/web/async_client.py index 9ab005c83..f9c9409e4 100644 --- a/slack_sdk/web/async_client.py +++ b/slack_sdk/web/async_client.py @@ -2165,203 +2165,188 @@ async def agents_sessions_setStatus( kwargs = _remove_none_values(kwargs) return await self.api_call("agents.sessions.setStatus", json=kwargs) - async def codeChannels_archive( + async def agents_conversations_archive( self, - *, - channel_id: str, - summary_message_ts: Optional[str] = None, **kwargs, ) -> AsyncSlackResponse: - """Archives a code channel, optionally recording a summary message on the channel. - https://docs.slack.dev/reference/methods/codeChannels.archive - """ - kwargs.update({"channel_id": channel_id, "summary_message_ts": summary_message_ts}) - kwargs = _remove_none_values(kwargs) - return await self.api_call("codeChannels.archive", json=kwargs) + """Archive a code channel. Requires the ``code_channels:manage`` scope. - async def codeChannels_create( - self, - *, - name: str, - team_id: Optional[str] = None, - session_id: Optional[str] = None, - is_private: Optional[bool] = None, - origin_channel_id: Optional[str] = None, - origin_message_ts: Optional[str] = None, - **kwargs, - ) -> AsyncSlackResponse: - """Creates a dedicated code channel for an agent session. - https://docs.slack.dev/reference/methods/codeChannels.create + Args: + channel_id (str, optional): ID of the code channel to archive. + summary_message_ts (str, optional): Timestamp of a message in the code channel to + share back as a thread reply on the origin message. Requires the channel to have + an origin link. + https://docs.slack.dev/reference/methods/agents.conversations.archive """ - kwargs.update( - { - "name": name, - "team_id": team_id, - "session_id": session_id, - "is_private": is_private, - "origin_channel_id": origin_channel_id, - "origin_message_ts": origin_message_ts, - } - ) - kwargs = _remove_none_values(kwargs) - return await self.api_call("codeChannels.create", json=kwargs) + return await self.api_call("agents.conversations.archive", json=kwargs) - async def codeChannels_getCanvas( + async def agents_conversations_create( self, - *, - channel_id: str, - canvas_id: str, - content_format: Optional[str] = None, - include_resolved: Optional[bool] = None, **kwargs, ) -> AsyncSlackResponse: - """Fetches a canvas attached to a code channel — full content plus comment threads — in a single round-trip. - https://docs.slack.dev/reference/methods/codeChannels.getCanvas + """Create a dedicated code channel for an agent session. Requires the + ``code_channels:manage`` scope. + + Args: + team_id (str, optional): Encoded team id to create the channel in. Required for org + tokens when ``origin_channel_id`` is not provided. When omitted, the workspace is + derived from context. + session_id (str, optional): An opaque identifier for the agent session. When provided, + the call is idempotent: if a channel already exists for this ``session_id``, it is + returned instead of creating a new one. + name (str, optional): A friendly display name for the code channel. Optional when + ``origin_channel_id`` and ``origin_message_ts`` are provided — in that case the + channel is named from context. + is_private (bool, optional): Create a private channel instead of a public one. + origin_channel_id (str, optional): The channel ID where the agent session was initiated + from. Must be provided together with ``origin_message_ts``. The channel must be + accessible. + origin_message_ts (str, optional): The message timestamp in the origin channel that + started the agent session. Must be provided together with ``origin_channel_id``. + https://docs.slack.dev/reference/methods/agents.conversations.create """ - kwargs.update( - { - "channel_id": channel_id, - "canvas_id": canvas_id, - "content_format": content_format, - "include_resolved": include_resolved, - } - ) - kwargs = _remove_none_values(kwargs) - return await self.api_call("codeChannels.getCanvas", json=kwargs) + return await self.api_call("agents.conversations.create", json=kwargs) - async def codeChannels_listViews( + async def agents_conversations_getCanvas( self, - *, - channel_id: str, **kwargs, ) -> AsyncSlackResponse: - """Lists the views currently attached to a code channel. - https://docs.slack.dev/reference/methods/codeChannels.listViews + """Fetch a canvas attached to a code channel. Requires the ``code_channels:manage`` scope. + + Args: + channel (str, required): ID of the agent session channel the canvas belongs to. Note + this method takes ``channel``, not ``channel_id``. + canvas_id (str, required): Encoded ID of the canvas to fetch. + content_format (str, optional): Format to render the canvas content in. Defaults to + markdown. + include_resolved (bool, optional): Whether to include resolved comment threads in the + response. Defaults to false. + https://docs.slack.dev/reference/methods/agents.conversations.getCanvas """ - kwargs.update({"channel_id": channel_id}) - kwargs = _remove_none_values(kwargs) - return await self.api_call("codeChannels.listViews", json=kwargs) + return await self.api_call("agents.conversations.getCanvas", json=kwargs) - async def codeChannels_removeView( + async def agents_conversations_listViews( self, - *, - channel_id: str, - view_key: Optional[str] = None, - view_id: Optional[str] = None, **kwargs, ) -> AsyncSlackResponse: - """Removes a view from a code channel (provide exactly one of view_key or view_id). - https://docs.slack.dev/reference/methods/codeChannels.removeView + """List the views currently attached to a code channel. Requires the + ``code_channels:manage`` scope. + + Args: + channel_id (str, optional): ID of the code channel to list views for. + https://docs.slack.dev/reference/methods/agents.conversations.listViews """ - kwargs.update({"channel_id": channel_id, "view_key": view_key, "view_id": view_id}) - kwargs = _remove_none_values(kwargs) - return await self.api_call("codeChannels.removeView", json=kwargs) + return await self.api_call("agents.conversations.listViews", json=kwargs) - async def codeChannels_rename( + async def agents_conversations_removeView( self, - *, - channel_id: str, - name: str, **kwargs, ) -> AsyncSlackResponse: - """Renames a code channel. - https://docs.slack.dev/reference/methods/codeChannels.rename + """Remove a view from a code channel. Requires the ``code_channels:manage`` scope. + + Args: + channel_id (str, optional): ID of the code channel to remove the view from. + view_key (str, optional): Agent-assigned key of the view to remove. Provide exactly one + of ``view_key`` or ``view_id``. + view_id (str, optional): Encoded channel tab ID of the view to remove. Provide exactly + one of ``view_key`` or ``view_id``. + https://docs.slack.dev/reference/methods/agents.conversations.removeView """ - kwargs.update({"channel_id": channel_id, "name": name}) - kwargs = _remove_none_values(kwargs) - return await self.api_call("codeChannels.rename", json=kwargs) + return await self.api_call("agents.conversations.removeView", json=kwargs) - async def codeChannels_setCanvasContent( + async def agents_conversations_setCanvasContent( self, - *, - channel_id: str, - canvas_id: str, - content: str, **kwargs, ) -> AsyncSlackResponse: - """Replaces the full markdown content of a canvas attached to a code channel, preserving the - comment threads on the sections your agent didn't change. - https://docs.slack.dev/reference/methods/codeChannels.setCanvasContent + """Replace the full markdown content of a plan canvas attached to a code channel. Requires + the ``code_channels:manage`` scope. + + Args: + channel (str, required): ID of the agent session channel the canvas is attached to. + Note this method takes ``channel``, not ``channel_id``. + canvas_id (str, required): Encoded ID of the canvas whose content to replace. + content (str, required): The full new canvas content as markdown. The server diffs this + against the current content and applies only the changed sections. + https://docs.slack.dev/reference/methods/agents.conversations.setCanvasContent """ - kwargs.update({"channel_id": channel_id, "canvas_id": canvas_id, "content": content}) - kwargs = _remove_none_values(kwargs) - return await self.api_call("codeChannels.setCanvasContent", json=kwargs) + return await self.api_call("agents.conversations.setCanvasContent", json=kwargs) - async def codeChannels_setCommands( + async def agents_conversations_setCommands( self, - *, - channel_id: str, - commands: List[Dict[str, Any]], **kwargs, ) -> AsyncSlackResponse: - """Registers the set of slash commands your agent offers in a code channel. - https://docs.slack.dev/reference/methods/codeChannels.setCommands + """Register the set of agent-defined slash commands for the calling agent in a code channel. + Requires the ``code_channels:manage`` scope. + + Args: + channel_id (str, optional): ID of the code channel to register commands for. + commands (array, required): Full set of commands to register for the calling agent in + this channel, replacing that agent's previously registered set. Pass an empty array + to clear them. + https://docs.slack.dev/reference/methods/agents.conversations.setCommands """ - kwargs.update({"channel_id": channel_id, "commands": commands}) - kwargs = _remove_none_values(kwargs) - return await self.api_call("codeChannels.setCommands", json=kwargs) + return await self.api_call("agents.conversations.setCommands", json=kwargs) - async def codeChannels_setProperties( + async def agents_conversations_setProperties( self, - *, - channel_id: str, - code_channel: Optional[Dict[str, Any]] = None, - agent_resource: Optional[Dict[str, Any]] = None, **kwargs, ) -> AsyncSlackResponse: - """Sets properties on a code channel: context bar items and external resource details. - https://docs.slack.dev/reference/methods/codeChannels.setProperties + """Set properties on a code channel. Requires the ``code_channels:manage`` scope. + + Args: + channel_id (str, optional): ID of the code channel to update. + title (str, optional): New display title for the agent session. + status (str, optional): New status for the agent session. + code_channel (object, optional): Code channel properties to set. Only provided fields + are updated. + agent_resource (object, optional): Agent resource properties to set. Only provided + fields are updated. + https://docs.slack.dev/reference/methods/agents.conversations.setProperties """ - kwargs.update( - { - "channel_id": channel_id, - "code_channel": code_channel, - "agent_resource": agent_resource, - } - ) - kwargs = _remove_none_values(kwargs) - return await self.api_call("codeChannels.setProperties", json=kwargs) + return await self.api_call("agents.conversations.setProperties", json=kwargs) - async def codeChannels_setView( + async def agents_conversations_setView( self, - *, - channel_id: str, - type: Optional[str] = None, - view_key: Optional[str] = None, - content: Optional[str] = None, - blocks: Optional[List[Dict[str, Any]]] = None, - canvas_id: Optional[str] = None, - access_level: Optional[str] = None, - base_branch: Optional[str] = None, - head_branch: Optional[str] = None, - name: Optional[str] = None, - label: Optional[str] = None, - csp: Optional[Dict[str, Any]] = None, **kwargs, ) -> AsyncSlackResponse: - """Creates or updates a view in a code channel. Views can render HTML, diffs, Block Kit, or - canvases as tabs alongside the conversation. - https://docs.slack.dev/reference/methods/codeChannels.setView - """ - kwargs.update( - { - "channel_id": channel_id, - "type": type, - "view_key": view_key, - "content": content, - "blocks": blocks, - "canvas_id": canvas_id, - "access_level": access_level, - "base_branch": base_branch, - "head_branch": head_branch, - "name": name, - "label": label, - "csp": csp, - } - ) - kwargs = _remove_none_values(kwargs) - return await self.api_call("codeChannels.setView", json=kwargs) - return await self.api_call("codeChannels.setView", json=kwargs) + """Create or update a view in a code channel. Requires the ``code_channels:manage`` scope. + + Args: + channel_id (str, optional): ID of the code channel to render the view in. + type (str, optional): The kind of view to create or update. Defaults to html. + Determines which other arguments are required: html and diff require content, + block_kit requires blocks, canvas requires canvas_id, pull_request requires pr_url. + view_key (str, optional): Agent-assigned stable identity for the view (e.g. the source + file path on the agent's machine). Used as the upsert key: calls with the same + view_key update the existing view. + content (str, optional): View content. For html, a full self-contained HTML document; + for diff, raw unified diff text. Capped at 1,000,000 bytes — larger content returns + an error. + blocks (array, optional): Block Kit blocks to render in the view tab. Required when type + is block_kit; ignored otherwise. + canvas_id (str, optional): Encoded ID of the canvas to attach as the view. Required when + type is canvas; ignored otherwise. + access_level (str, optional): For canvas views: access level granted to the channel for + the canvas tab. Defaults to write. Use 'comment' to grant channel members comment + access. + agent_content_hash (str, optional): For canvas views: hash of the canvas-derived + markdown the agent last wrote, recorded so the agent can later detect human edits to + the canvas. + pr_url (str, optional): For pull_request views: the pull request's URL. Required when + type is pull_request; ignored otherwise. + base_branch (str, optional): For diff views: base branch name for display purposes. + head_branch (str, optional): For diff views: head branch name for display purposes. + name (str, optional): Display label for the view tab. Preferred over the legacy 'label' + argument (name wins if both are supplied). Defaults to the last path segment of + view_key. + label (str, optional): Deprecated alias for 'name'. Display label for the view tab. + Defaults to the last path segment of view_key, stripped of any .html/.htm extension. + csp (object, optional): Content-Security-Policy domain declarations for the view. + Domains are validated server-side (https-only, no private/internal hosts) and + persisted. + https://docs.slack.dev/reference/methods/agents.conversations.setView + """ + return await self.api_call("agents.conversations.setView", json=kwargs) async def assistant_threads_setTitle( self, diff --git a/slack_sdk/web/client.py b/slack_sdk/web/client.py index b76fde034..5b4a4d2ff 100644 --- a/slack_sdk/web/client.py +++ b/slack_sdk/web/client.py @@ -2155,203 +2155,188 @@ def agents_sessions_setStatus( kwargs = _remove_none_values(kwargs) return self.api_call("agents.sessions.setStatus", json=kwargs) - def codeChannels_archive( + def agents_conversations_archive( self, - *, - channel_id: str, - summary_message_ts: Optional[str] = None, **kwargs, ) -> SlackResponse: - """Archives a code channel, optionally recording a summary message on the channel. - https://docs.slack.dev/reference/methods/codeChannels.archive - """ - kwargs.update({"channel_id": channel_id, "summary_message_ts": summary_message_ts}) - kwargs = _remove_none_values(kwargs) - return self.api_call("codeChannels.archive", json=kwargs) + """Archive a code channel. Requires the ``code_channels:manage`` scope. - def codeChannels_create( - self, - *, - name: str, - team_id: Optional[str] = None, - session_id: Optional[str] = None, - is_private: Optional[bool] = None, - origin_channel_id: Optional[str] = None, - origin_message_ts: Optional[str] = None, - **kwargs, - ) -> SlackResponse: - """Creates a dedicated code channel for an agent session. - https://docs.slack.dev/reference/methods/codeChannels.create + Args: + channel_id (str, optional): ID of the code channel to archive. + summary_message_ts (str, optional): Timestamp of a message in the code channel to + share back as a thread reply on the origin message. Requires the channel to have + an origin link. + https://docs.slack.dev/reference/methods/agents.conversations.archive """ - kwargs.update( - { - "name": name, - "team_id": team_id, - "session_id": session_id, - "is_private": is_private, - "origin_channel_id": origin_channel_id, - "origin_message_ts": origin_message_ts, - } - ) - kwargs = _remove_none_values(kwargs) - return self.api_call("codeChannels.create", json=kwargs) + return self.api_call("agents.conversations.archive", json=kwargs) - def codeChannels_getCanvas( + def agents_conversations_create( self, - *, - channel_id: str, - canvas_id: str, - content_format: Optional[str] = None, - include_resolved: Optional[bool] = None, **kwargs, ) -> SlackResponse: - """Fetches a canvas attached to a code channel — full content plus comment threads — in a single round-trip. - https://docs.slack.dev/reference/methods/codeChannels.getCanvas + """Create a dedicated code channel for an agent session. Requires the + ``code_channels:manage`` scope. + + Args: + team_id (str, optional): Encoded team id to create the channel in. Required for org + tokens when ``origin_channel_id`` is not provided. When omitted, the workspace is + derived from context. + session_id (str, optional): An opaque identifier for the agent session. When provided, + the call is idempotent: if a channel already exists for this ``session_id``, it is + returned instead of creating a new one. + name (str, optional): A friendly display name for the code channel. Optional when + ``origin_channel_id`` and ``origin_message_ts`` are provided — in that case the + channel is named from context. + is_private (bool, optional): Create a private channel instead of a public one. + origin_channel_id (str, optional): The channel ID where the agent session was initiated + from. Must be provided together with ``origin_message_ts``. The channel must be + accessible. + origin_message_ts (str, optional): The message timestamp in the origin channel that + started the agent session. Must be provided together with ``origin_channel_id``. + https://docs.slack.dev/reference/methods/agents.conversations.create """ - kwargs.update( - { - "channel_id": channel_id, - "canvas_id": canvas_id, - "content_format": content_format, - "include_resolved": include_resolved, - } - ) - kwargs = _remove_none_values(kwargs) - return self.api_call("codeChannels.getCanvas", json=kwargs) + return self.api_call("agents.conversations.create", json=kwargs) - def codeChannels_listViews( + def agents_conversations_getCanvas( self, - *, - channel_id: str, **kwargs, ) -> SlackResponse: - """Lists the views currently attached to a code channel. - https://docs.slack.dev/reference/methods/codeChannels.listViews + """Fetch a canvas attached to a code channel. Requires the ``code_channels:manage`` scope. + + Args: + channel (str, required): ID of the agent session channel the canvas belongs to. Note + this method takes ``channel``, not ``channel_id``. + canvas_id (str, required): Encoded ID of the canvas to fetch. + content_format (str, optional): Format to render the canvas content in. Defaults to + markdown. + include_resolved (bool, optional): Whether to include resolved comment threads in the + response. Defaults to false. + https://docs.slack.dev/reference/methods/agents.conversations.getCanvas """ - kwargs.update({"channel_id": channel_id}) - kwargs = _remove_none_values(kwargs) - return self.api_call("codeChannels.listViews", json=kwargs) + return self.api_call("agents.conversations.getCanvas", json=kwargs) - def codeChannels_removeView( + def agents_conversations_listViews( self, - *, - channel_id: str, - view_key: Optional[str] = None, - view_id: Optional[str] = None, **kwargs, ) -> SlackResponse: - """Removes a view from a code channel (provide exactly one of view_key or view_id). - https://docs.slack.dev/reference/methods/codeChannels.removeView + """List the views currently attached to a code channel. Requires the + ``code_channels:manage`` scope. + + Args: + channel_id (str, optional): ID of the code channel to list views for. + https://docs.slack.dev/reference/methods/agents.conversations.listViews """ - kwargs.update({"channel_id": channel_id, "view_key": view_key, "view_id": view_id}) - kwargs = _remove_none_values(kwargs) - return self.api_call("codeChannels.removeView", json=kwargs) + return self.api_call("agents.conversations.listViews", json=kwargs) - def codeChannels_rename( + def agents_conversations_removeView( self, - *, - channel_id: str, - name: str, **kwargs, ) -> SlackResponse: - """Renames a code channel. - https://docs.slack.dev/reference/methods/codeChannels.rename + """Remove a view from a code channel. Requires the ``code_channels:manage`` scope. + + Args: + channel_id (str, optional): ID of the code channel to remove the view from. + view_key (str, optional): Agent-assigned key of the view to remove. Provide exactly one + of ``view_key`` or ``view_id``. + view_id (str, optional): Encoded channel tab ID of the view to remove. Provide exactly + one of ``view_key`` or ``view_id``. + https://docs.slack.dev/reference/methods/agents.conversations.removeView """ - kwargs.update({"channel_id": channel_id, "name": name}) - kwargs = _remove_none_values(kwargs) - return self.api_call("codeChannels.rename", json=kwargs) + return self.api_call("agents.conversations.removeView", json=kwargs) - def codeChannels_setCanvasContent( + def agents_conversations_setCanvasContent( self, - *, - channel_id: str, - canvas_id: str, - content: str, **kwargs, ) -> SlackResponse: - """Replaces the full markdown content of a canvas attached to a code channel, preserving the - comment threads on the sections your agent didn't change. - https://docs.slack.dev/reference/methods/codeChannels.setCanvasContent + """Replace the full markdown content of a plan canvas attached to a code channel. Requires + the ``code_channels:manage`` scope. + + Args: + channel (str, required): ID of the agent session channel the canvas is attached to. + Note this method takes ``channel``, not ``channel_id``. + canvas_id (str, required): Encoded ID of the canvas whose content to replace. + content (str, required): The full new canvas content as markdown. The server diffs this + against the current content and applies only the changed sections. + https://docs.slack.dev/reference/methods/agents.conversations.setCanvasContent """ - kwargs.update({"channel_id": channel_id, "canvas_id": canvas_id, "content": content}) - kwargs = _remove_none_values(kwargs) - return self.api_call("codeChannels.setCanvasContent", json=kwargs) + return self.api_call("agents.conversations.setCanvasContent", json=kwargs) - def codeChannels_setCommands( + def agents_conversations_setCommands( self, - *, - channel_id: str, - commands: List[Dict[str, Any]], **kwargs, ) -> SlackResponse: - """Registers the set of slash commands your agent offers in a code channel. - https://docs.slack.dev/reference/methods/codeChannels.setCommands + """Register the set of agent-defined slash commands for the calling agent in a code channel. + Requires the ``code_channels:manage`` scope. + + Args: + channel_id (str, optional): ID of the code channel to register commands for. + commands (array, required): Full set of commands to register for the calling agent in + this channel, replacing that agent's previously registered set. Pass an empty array + to clear them. + https://docs.slack.dev/reference/methods/agents.conversations.setCommands """ - kwargs.update({"channel_id": channel_id, "commands": commands}) - kwargs = _remove_none_values(kwargs) - return self.api_call("codeChannels.setCommands", json=kwargs) + return self.api_call("agents.conversations.setCommands", json=kwargs) - def codeChannels_setProperties( + def agents_conversations_setProperties( self, - *, - channel_id: str, - code_channel: Optional[Dict[str, Any]] = None, - agent_resource: Optional[Dict[str, Any]] = None, **kwargs, ) -> SlackResponse: - """Sets properties on a code channel: context bar items and external resource details. - https://docs.slack.dev/reference/methods/codeChannels.setProperties + """Set properties on a code channel. Requires the ``code_channels:manage`` scope. + + Args: + channel_id (str, optional): ID of the code channel to update. + title (str, optional): New display title for the agent session. + status (str, optional): New status for the agent session. + code_channel (object, optional): Code channel properties to set. Only provided fields + are updated. + agent_resource (object, optional): Agent resource properties to set. Only provided + fields are updated. + https://docs.slack.dev/reference/methods/agents.conversations.setProperties """ - kwargs.update( - { - "channel_id": channel_id, - "code_channel": code_channel, - "agent_resource": agent_resource, - } - ) - kwargs = _remove_none_values(kwargs) - return self.api_call("codeChannels.setProperties", json=kwargs) + return self.api_call("agents.conversations.setProperties", json=kwargs) - def codeChannels_setView( + def agents_conversations_setView( self, - *, - channel_id: str, - type: Optional[str] = None, - view_key: Optional[str] = None, - content: Optional[str] = None, - blocks: Optional[List[Dict[str, Any]]] = None, - canvas_id: Optional[str] = None, - access_level: Optional[str] = None, - base_branch: Optional[str] = None, - head_branch: Optional[str] = None, - name: Optional[str] = None, - label: Optional[str] = None, - csp: Optional[Dict[str, Any]] = None, **kwargs, ) -> SlackResponse: - """Creates or updates a view in a code channel. Views can render HTML, diffs, Block Kit, or - canvases as tabs alongside the conversation. - https://docs.slack.dev/reference/methods/codeChannels.setView - """ - kwargs.update( - { - "channel_id": channel_id, - "type": type, - "view_key": view_key, - "content": content, - "blocks": blocks, - "canvas_id": canvas_id, - "access_level": access_level, - "base_branch": base_branch, - "head_branch": head_branch, - "name": name, - "label": label, - "csp": csp, - } - ) - kwargs = _remove_none_values(kwargs) - return self.api_call("codeChannels.setView", json=kwargs) - return self.api_call("codeChannels.setView", json=kwargs) + """Create or update a view in a code channel. Requires the ``code_channels:manage`` scope. + + Args: + channel_id (str, optional): ID of the code channel to render the view in. + type (str, optional): The kind of view to create or update. Defaults to html. + Determines which other arguments are required: html and diff require content, + block_kit requires blocks, canvas requires canvas_id, pull_request requires pr_url. + view_key (str, optional): Agent-assigned stable identity for the view (e.g. the source + file path on the agent's machine). Used as the upsert key: calls with the same + view_key update the existing view. + content (str, optional): View content. For html, a full self-contained HTML document; + for diff, raw unified diff text. Capped at 1,000,000 bytes — larger content returns + an error. + blocks (array, optional): Block Kit blocks to render in the view tab. Required when type + is block_kit; ignored otherwise. + canvas_id (str, optional): Encoded ID of the canvas to attach as the view. Required when + type is canvas; ignored otherwise. + access_level (str, optional): For canvas views: access level granted to the channel for + the canvas tab. Defaults to write. Use 'comment' to grant channel members comment + access. + agent_content_hash (str, optional): For canvas views: hash of the canvas-derived + markdown the agent last wrote, recorded so the agent can later detect human edits to + the canvas. + pr_url (str, optional): For pull_request views: the pull request's URL. Required when + type is pull_request; ignored otherwise. + base_branch (str, optional): For diff views: base branch name for display purposes. + head_branch (str, optional): For diff views: head branch name for display purposes. + name (str, optional): Display label for the view tab. Preferred over the legacy 'label' + argument (name wins if both are supplied). Defaults to the last path segment of + view_key. + label (str, optional): Deprecated alias for 'name'. Display label for the view tab. + Defaults to the last path segment of view_key, stripped of any .html/.htm extension. + csp (object, optional): Content-Security-Policy domain declarations for the view. + Domains are validated server-side (https-only, no private/internal hosts) and + persisted. + https://docs.slack.dev/reference/methods/agents.conversations.setView + """ + return self.api_call("agents.conversations.setView", json=kwargs) def assistant_threads_setTitle( self, diff --git a/slack_sdk/web/legacy_client.py b/slack_sdk/web/legacy_client.py index d32519ffd..ff17f8c23 100644 --- a/slack_sdk/web/legacy_client.py +++ b/slack_sdk/web/legacy_client.py @@ -9,7 +9,6 @@ # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! from asyncio import Future - """A Python module for interacting with Slack's Web API.""" import json @@ -2166,203 +2165,188 @@ def agents_sessions_setStatus( kwargs = _remove_none_values(kwargs) return self.api_call("agents.sessions.setStatus", json=kwargs) - def codeChannels_archive( + def agents_conversations_archive( self, - *, - channel_id: str, - summary_message_ts: Optional[str] = None, **kwargs, ) -> Union[Future, SlackResponse]: - """Archives a code channel, optionally recording a summary message on the channel. - https://docs.slack.dev/reference/methods/codeChannels.archive - """ - kwargs.update({"channel_id": channel_id, "summary_message_ts": summary_message_ts}) - kwargs = _remove_none_values(kwargs) - return self.api_call("codeChannels.archive", json=kwargs) + """Archive a code channel. Requires the ``code_channels:manage`` scope. - def codeChannels_create( - self, - *, - name: str, - team_id: Optional[str] = None, - session_id: Optional[str] = None, - is_private: Optional[bool] = None, - origin_channel_id: Optional[str] = None, - origin_message_ts: Optional[str] = None, - **kwargs, - ) -> Union[Future, SlackResponse]: - """Creates a dedicated code channel for an agent session. - https://docs.slack.dev/reference/methods/codeChannels.create + Args: + channel_id (str, optional): ID of the code channel to archive. + summary_message_ts (str, optional): Timestamp of a message in the code channel to + share back as a thread reply on the origin message. Requires the channel to have + an origin link. + https://docs.slack.dev/reference/methods/agents.conversations.archive """ - kwargs.update( - { - "name": name, - "team_id": team_id, - "session_id": session_id, - "is_private": is_private, - "origin_channel_id": origin_channel_id, - "origin_message_ts": origin_message_ts, - } - ) - kwargs = _remove_none_values(kwargs) - return self.api_call("codeChannels.create", json=kwargs) + return self.api_call("agents.conversations.archive", json=kwargs) - def codeChannels_getCanvas( + def agents_conversations_create( self, - *, - channel_id: str, - canvas_id: str, - content_format: Optional[str] = None, - include_resolved: Optional[bool] = None, **kwargs, ) -> Union[Future, SlackResponse]: - """Fetches a canvas attached to a code channel — full content plus comment threads — in a single round-trip. - https://docs.slack.dev/reference/methods/codeChannels.getCanvas + """Create a dedicated code channel for an agent session. Requires the + ``code_channels:manage`` scope. + + Args: + team_id (str, optional): Encoded team id to create the channel in. Required for org + tokens when ``origin_channel_id`` is not provided. When omitted, the workspace is + derived from context. + session_id (str, optional): An opaque identifier for the agent session. When provided, + the call is idempotent: if a channel already exists for this ``session_id``, it is + returned instead of creating a new one. + name (str, optional): A friendly display name for the code channel. Optional when + ``origin_channel_id`` and ``origin_message_ts`` are provided — in that case the + channel is named from context. + is_private (bool, optional): Create a private channel instead of a public one. + origin_channel_id (str, optional): The channel ID where the agent session was initiated + from. Must be provided together with ``origin_message_ts``. The channel must be + accessible. + origin_message_ts (str, optional): The message timestamp in the origin channel that + started the agent session. Must be provided together with ``origin_channel_id``. + https://docs.slack.dev/reference/methods/agents.conversations.create """ - kwargs.update( - { - "channel_id": channel_id, - "canvas_id": canvas_id, - "content_format": content_format, - "include_resolved": include_resolved, - } - ) - kwargs = _remove_none_values(kwargs) - return self.api_call("codeChannels.getCanvas", json=kwargs) + return self.api_call("agents.conversations.create", json=kwargs) - def codeChannels_listViews( + def agents_conversations_getCanvas( self, - *, - channel_id: str, **kwargs, ) -> Union[Future, SlackResponse]: - """Lists the views currently attached to a code channel. - https://docs.slack.dev/reference/methods/codeChannels.listViews + """Fetch a canvas attached to a code channel. Requires the ``code_channels:manage`` scope. + + Args: + channel (str, required): ID of the agent session channel the canvas belongs to. Note + this method takes ``channel``, not ``channel_id``. + canvas_id (str, required): Encoded ID of the canvas to fetch. + content_format (str, optional): Format to render the canvas content in. Defaults to + markdown. + include_resolved (bool, optional): Whether to include resolved comment threads in the + response. Defaults to false. + https://docs.slack.dev/reference/methods/agents.conversations.getCanvas """ - kwargs.update({"channel_id": channel_id}) - kwargs = _remove_none_values(kwargs) - return self.api_call("codeChannels.listViews", json=kwargs) + return self.api_call("agents.conversations.getCanvas", json=kwargs) - def codeChannels_removeView( + def agents_conversations_listViews( self, - *, - channel_id: str, - view_key: Optional[str] = None, - view_id: Optional[str] = None, **kwargs, ) -> Union[Future, SlackResponse]: - """Removes a view from a code channel (provide exactly one of view_key or view_id). - https://docs.slack.dev/reference/methods/codeChannels.removeView + """List the views currently attached to a code channel. Requires the + ``code_channels:manage`` scope. + + Args: + channel_id (str, optional): ID of the code channel to list views for. + https://docs.slack.dev/reference/methods/agents.conversations.listViews """ - kwargs.update({"channel_id": channel_id, "view_key": view_key, "view_id": view_id}) - kwargs = _remove_none_values(kwargs) - return self.api_call("codeChannels.removeView", json=kwargs) + return self.api_call("agents.conversations.listViews", json=kwargs) - def codeChannels_rename( + def agents_conversations_removeView( self, - *, - channel_id: str, - name: str, **kwargs, ) -> Union[Future, SlackResponse]: - """Renames a code channel. - https://docs.slack.dev/reference/methods/codeChannels.rename + """Remove a view from a code channel. Requires the ``code_channels:manage`` scope. + + Args: + channel_id (str, optional): ID of the code channel to remove the view from. + view_key (str, optional): Agent-assigned key of the view to remove. Provide exactly one + of ``view_key`` or ``view_id``. + view_id (str, optional): Encoded channel tab ID of the view to remove. Provide exactly + one of ``view_key`` or ``view_id``. + https://docs.slack.dev/reference/methods/agents.conversations.removeView """ - kwargs.update({"channel_id": channel_id, "name": name}) - kwargs = _remove_none_values(kwargs) - return self.api_call("codeChannels.rename", json=kwargs) + return self.api_call("agents.conversations.removeView", json=kwargs) - def codeChannels_setCanvasContent( + def agents_conversations_setCanvasContent( self, - *, - channel_id: str, - canvas_id: str, - content: str, **kwargs, ) -> Union[Future, SlackResponse]: - """Replaces the full markdown content of a canvas attached to a code channel, preserving the - comment threads on the sections your agent didn't change. - https://docs.slack.dev/reference/methods/codeChannels.setCanvasContent + """Replace the full markdown content of a plan canvas attached to a code channel. Requires + the ``code_channels:manage`` scope. + + Args: + channel (str, required): ID of the agent session channel the canvas is attached to. + Note this method takes ``channel``, not ``channel_id``. + canvas_id (str, required): Encoded ID of the canvas whose content to replace. + content (str, required): The full new canvas content as markdown. The server diffs this + against the current content and applies only the changed sections. + https://docs.slack.dev/reference/methods/agents.conversations.setCanvasContent """ - kwargs.update({"channel_id": channel_id, "canvas_id": canvas_id, "content": content}) - kwargs = _remove_none_values(kwargs) - return self.api_call("codeChannels.setCanvasContent", json=kwargs) + return self.api_call("agents.conversations.setCanvasContent", json=kwargs) - def codeChannels_setCommands( + def agents_conversations_setCommands( self, - *, - channel_id: str, - commands: List[Dict[str, Any]], **kwargs, ) -> Union[Future, SlackResponse]: - """Registers the set of slash commands your agent offers in a code channel. - https://docs.slack.dev/reference/methods/codeChannels.setCommands + """Register the set of agent-defined slash commands for the calling agent in a code channel. + Requires the ``code_channels:manage`` scope. + + Args: + channel_id (str, optional): ID of the code channel to register commands for. + commands (array, required): Full set of commands to register for the calling agent in + this channel, replacing that agent's previously registered set. Pass an empty array + to clear them. + https://docs.slack.dev/reference/methods/agents.conversations.setCommands """ - kwargs.update({"channel_id": channel_id, "commands": commands}) - kwargs = _remove_none_values(kwargs) - return self.api_call("codeChannels.setCommands", json=kwargs) + return self.api_call("agents.conversations.setCommands", json=kwargs) - def codeChannels_setProperties( + def agents_conversations_setProperties( self, - *, - channel_id: str, - code_channel: Optional[Dict[str, Any]] = None, - agent_resource: Optional[Dict[str, Any]] = None, **kwargs, ) -> Union[Future, SlackResponse]: - """Sets properties on a code channel: context bar items and external resource details. - https://docs.slack.dev/reference/methods/codeChannels.setProperties + """Set properties on a code channel. Requires the ``code_channels:manage`` scope. + + Args: + channel_id (str, optional): ID of the code channel to update. + title (str, optional): New display title for the agent session. + status (str, optional): New status for the agent session. + code_channel (object, optional): Code channel properties to set. Only provided fields + are updated. + agent_resource (object, optional): Agent resource properties to set. Only provided + fields are updated. + https://docs.slack.dev/reference/methods/agents.conversations.setProperties """ - kwargs.update( - { - "channel_id": channel_id, - "code_channel": code_channel, - "agent_resource": agent_resource, - } - ) - kwargs = _remove_none_values(kwargs) - return self.api_call("codeChannels.setProperties", json=kwargs) + return self.api_call("agents.conversations.setProperties", json=kwargs) - def codeChannels_setView( + def agents_conversations_setView( self, - *, - channel_id: str, - type: Optional[str] = None, - view_key: Optional[str] = None, - content: Optional[str] = None, - blocks: Optional[List[Dict[str, Any]]] = None, - canvas_id: Optional[str] = None, - access_level: Optional[str] = None, - base_branch: Optional[str] = None, - head_branch: Optional[str] = None, - name: Optional[str] = None, - label: Optional[str] = None, - csp: Optional[Dict[str, Any]] = None, **kwargs, ) -> Union[Future, SlackResponse]: - """Creates or updates a view in a code channel. Views can render HTML, diffs, Block Kit, or - canvases as tabs alongside the conversation. - https://docs.slack.dev/reference/methods/codeChannels.setView + """Create or update a view in a code channel. Requires the ``code_channels:manage`` scope. + + Args: + channel_id (str, optional): ID of the code channel to render the view in. + type (str, optional): The kind of view to create or update. Defaults to html. + Determines which other arguments are required: html and diff require content, + block_kit requires blocks, canvas requires canvas_id, pull_request requires pr_url. + view_key (str, optional): Agent-assigned stable identity for the view (e.g. the source + file path on the agent's machine). Used as the upsert key: calls with the same + view_key update the existing view. + content (str, optional): View content. For html, a full self-contained HTML document; + for diff, raw unified diff text. Capped at 1,000,000 bytes — larger content returns + an error. + blocks (array, optional): Block Kit blocks to render in the view tab. Required when type + is block_kit; ignored otherwise. + canvas_id (str, optional): Encoded ID of the canvas to attach as the view. Required when + type is canvas; ignored otherwise. + access_level (str, optional): For canvas views: access level granted to the channel for + the canvas tab. Defaults to write. Use 'comment' to grant channel members comment + access. + agent_content_hash (str, optional): For canvas views: hash of the canvas-derived + markdown the agent last wrote, recorded so the agent can later detect human edits to + the canvas. + pr_url (str, optional): For pull_request views: the pull request's URL. Required when + type is pull_request; ignored otherwise. + base_branch (str, optional): For diff views: base branch name for display purposes. + head_branch (str, optional): For diff views: head branch name for display purposes. + name (str, optional): Display label for the view tab. Preferred over the legacy 'label' + argument (name wins if both are supplied). Defaults to the last path segment of + view_key. + label (str, optional): Deprecated alias for 'name'. Display label for the view tab. + Defaults to the last path segment of view_key, stripped of any .html/.htm extension. + csp (object, optional): Content-Security-Policy domain declarations for the view. + Domains are validated server-side (https-only, no private/internal hosts) and + persisted. + https://docs.slack.dev/reference/methods/agents.conversations.setView """ - kwargs.update( - { - "channel_id": channel_id, - "type": type, - "view_key": view_key, - "content": content, - "blocks": blocks, - "canvas_id": canvas_id, - "access_level": access_level, - "base_branch": base_branch, - "head_branch": head_branch, - "name": name, - "label": label, - "csp": csp, - } - ) - kwargs = _remove_none_values(kwargs) - return self.api_call("codeChannels.setView", json=kwargs) - return self.api_call("codeChannels.setView", json=kwargs) + return self.api_call("agents.conversations.setView", json=kwargs) def assistant_threads_setTitle( self, diff --git a/tests/slack_sdk_async/web/test_web_client_coverage.py b/tests/slack_sdk_async/web/test_web_client_coverage.py index e5e035623..66e071a44 100644 --- a/tests/slack_sdk_async/web/test_web_client_coverage.py +++ b/tests/slack_sdk_async/web/test_web_client_coverage.py @@ -15,7 +15,7 @@ class TestWebClientCoverage(unittest.TestCase): # 318 endpoints as of August 19, 2026 # Can be fetched by running `var methodNames = [].slice.call(document.getElementsByClassName('apiReferenceFilterableList__listItemLink')).map(e => e.href.replace("https://api.slack.com/methods/", ""));console.log(methodNames.toString());console.log(methodNames.length);` on https://api.slack.com/methods - all_api_methods = "admin.analytics.getFile,admin.apps.activities.list,admin.apps.approve,admin.apps.clearResolution,admin.apps.restrict,admin.apps.uninstall,admin.apps.approved.list,admin.apps.config.lookup,admin.apps.config.set,admin.apps.requests.cancel,admin.apps.requests.list,admin.apps.restricted.list,admin.audit.anomaly.allow.getItem,admin.audit.anomaly.allow.updateItem,admin.auth.policy.assignEntities,admin.auth.policy.getEntities,admin.auth.policy.removeEntities,admin.barriers.create,admin.barriers.delete,admin.barriers.list,admin.barriers.update,admin.conversations.archive,admin.conversations.bulkArchive,admin.conversations.bulkDelete,admin.conversations.bulkMove,admin.conversations.convertToPrivate,admin.conversations.convertToPublic,admin.conversations.create,admin.conversations.createForObjects,admin.conversations.delete,admin.conversations.disconnectShared,admin.conversations.getConversationPrefs,admin.conversations.getCustomRetention,admin.conversations.getTeams,admin.conversations.invite,admin.conversations.linkObjects,admin.conversations.lookup,admin.conversations.removeCustomRetention,admin.conversations.rename,admin.conversations.search,admin.conversations.setConversationPrefs,admin.conversations.setCustomRetention,admin.conversations.setTeams,admin.conversations.unarchive,admin.conversations.unlinkObjects,admin.conversations.ekm.listOriginalConnectedChannelInfo,admin.conversations.restrictAccess.addGroup,admin.conversations.restrictAccess.listGroups,admin.conversations.restrictAccess.removeGroup,admin.emoji.add,admin.emoji.addAlias,admin.emoji.list,admin.emoji.remove,admin.emoji.rename,admin.functions.list,admin.functions.permissions.lookup,admin.functions.permissions.set,admin.inviteRequests.approve,admin.inviteRequests.deny,admin.inviteRequests.list,admin.inviteRequests.approved.list,admin.inviteRequests.denied.list,admin.roles.addAssignments,admin.roles.listAssignments,admin.roles.removeAssignments,admin.teams.admins.list,admin.teams.create,admin.teams.list,admin.teams.owners.list,admin.teams.settings.info,admin.teams.settings.setDefaultChannels,admin.teams.settings.setDescription,admin.teams.settings.setDiscoverability,admin.teams.settings.setIcon,admin.teams.settings.setName,admin.usergroups.addChannels,admin.usergroups.addTeams,admin.usergroups.listChannels,admin.usergroups.removeChannels,admin.users.assign,admin.users.invite,admin.users.list,admin.users.remove,admin.users.setAdmin,admin.users.setExpiration,admin.users.setOwner,admin.users.setRegular,admin.users.session.clearSettings,admin.users.session.getSettings,admin.users.session.invalidate,admin.users.session.list,admin.users.session.reset,admin.users.session.resetBulk,admin.users.session.setSettings,admin.users.unsupportedVersions.export,admin.workflows.collaborators.add,admin.workflows.collaborators.remove,admin.workflows.permissions.lookup,admin.workflows.search,admin.workflows.unpublish,api.test,apps.activities.list,apps.auth.external.delete,apps.auth.external.get,apps.connections.open,apps.uninstall,apps.datastore.bulkDelete,apps.datastore.bulkGet,apps.datastore.bulkPut,apps.datastore.count,apps.datastore.delete,apps.datastore.get,apps.datastore.put,apps.datastore.query,apps.datastore.update,apps.event.authorizations.list,apps.manifest.create,apps.manifest.delete,apps.manifest.export,apps.manifest.update,apps.manifest.validate,apps.user.connection.update,agents.sessions.rename,agents.sessions.setStatus,assistant.search.context,assistant.threads.setStatus,assistant.threads.setSuggestedPrompts,assistant.threads.setTitle,auth.revoke,auth.test,auth.teams.list,bookmarks.add,bookmarks.edit,bookmarks.list,bookmarks.remove,bots.info,calls.add,calls.end,calls.info,calls.update,calls.participants.add,calls.participants.remove,canvases.access.delete,canvases.access.set,canvases.create,canvases.delete,canvases.edit,canvases.sections.lookup,channels.mark,codeChannels.archive,codeChannels.create,codeChannels.getCanvas,codeChannels.listViews,codeChannels.removeView,codeChannels.rename,codeChannels.setCanvasContent,codeChannels.setCommands,codeChannels.setProperties,codeChannels.setView,chat.appendStream,chat.delete,chat.deleteScheduledMessage,chat.getPermalink,chat.meMessage,chat.postEphemeral,chat.postMessage,chat.scheduleMessage,chat.startStream,chat.stopStream,chat.unfurl,chat.update,chat.scheduledMessages.list,conversations.acceptSharedInvite,conversations.approveSharedInvite,conversations.archive,conversations.close,conversations.create,conversations.declineSharedInvite,conversations.history,conversations.info,conversations.invite,conversations.inviteShared,conversations.join,conversations.kick,conversations.leave,conversations.list,conversations.listConnectInvites,conversations.mark,conversations.members,conversations.open,conversations.rename,conversations.replies,conversations.setPurpose,conversations.setTopic,conversations.unarchive,conversations.canvases.create,conversations.externalInvitePermissions.set,conversations.requestSharedInvite.approve,conversations.requestSharedInvite.deny,conversations.requestSharedInvite.list,dialog.open,dnd.endDnd,dnd.endSnooze,dnd.info,dnd.setSnooze,dnd.teamInfo,emoji.list,files.completeUploadExternal,files.delete,files.getUploadURLExternal,files.info,files.list,files.revokePublicURL,files.sharedPublicURL,files.upload,files.comments.delete,files.remote.add,files.remote.info,files.remote.list,files.remote.remove,files.remote.share,files.remote.update,functions.completeError,functions.completeSuccess,functions.distributions.permissions.add,functions.distributions.permissions.list,functions.distributions.permissions.remove,functions.distributions.permissions.set,functions.workflows.steps.list,functions.workflows.steps.responses.export,groups.mark,migration.exchange,oauth.access,oauth.v2.access,oauth.v2.exchange,openid.connect.token,openid.connect.userInfo,pins.add,pins.list,pins.remove,reactions.add,reactions.get,reactions.list,reactions.remove,reminders.add,reminders.complete,reminders.delete,reminders.info,reminders.list,rtm.connect,rtm.start,search.all,search.files,search.messages,slackLists.access.delete,slackLists.access.set,slackLists.create,slackLists.update,slackLists.download.get,slackLists.download.start,slackLists.items.create,slackLists.items.delete,slackLists.items.deleteMultiple,slackLists.items.info,slackLists.items.list,slackLists.items.update,stars.add,stars.list,stars.remove,team.accessLogs,team.billableInfo,team.info,team.integrationLogs,team.billing.info,team.externalTeams.disconnect,team.externalTeams.list,team.preferences.list,team.profile.get,tooling.tokens.rotate,usergroups.create,usergroups.disable,usergroups.enable,usergroups.list,usergroups.update,usergroups.users.list,usergroups.users.update,users.conversations,users.deletePhoto,users.getPresence,users.identity,users.info,users.list,users.lookupByEmail,users.setActive,users.setPhoto,users.setPresence,users.discoverableContacts.lookup,users.profile.get,users.profile.set,views.open,views.publish,views.push,views.update,workflows.stepCompleted,workflows.stepFailed,workflows.updateStep,workflows.featured.add,workflows.featured.list,workflows.featured.remove,workflows.featured.set,workflows.triggers.permissions.add,workflows.triggers.permissions.list,workflows.triggers.permissions.remove,workflows.triggers.permissions.set,im.list,im.mark,mpim.list,mpim.mark".split( + all_api_methods = "admin.analytics.getFile,admin.apps.activities.list,admin.apps.approve,admin.apps.clearResolution,admin.apps.restrict,admin.apps.uninstall,admin.apps.approved.list,admin.apps.config.lookup,admin.apps.config.set,admin.apps.requests.cancel,admin.apps.requests.list,admin.apps.restricted.list,admin.audit.anomaly.allow.getItem,admin.audit.anomaly.allow.updateItem,admin.auth.policy.assignEntities,admin.auth.policy.getEntities,admin.auth.policy.removeEntities,admin.barriers.create,admin.barriers.delete,admin.barriers.list,admin.barriers.update,admin.conversations.archive,admin.conversations.bulkArchive,admin.conversations.bulkDelete,admin.conversations.bulkMove,admin.conversations.convertToPrivate,admin.conversations.convertToPublic,admin.conversations.create,admin.conversations.createForObjects,admin.conversations.delete,admin.conversations.disconnectShared,admin.conversations.getConversationPrefs,admin.conversations.getCustomRetention,admin.conversations.getTeams,admin.conversations.invite,admin.conversations.linkObjects,admin.conversations.lookup,admin.conversations.removeCustomRetention,admin.conversations.rename,admin.conversations.search,admin.conversations.setConversationPrefs,admin.conversations.setCustomRetention,admin.conversations.setTeams,admin.conversations.unarchive,admin.conversations.unlinkObjects,admin.conversations.ekm.listOriginalConnectedChannelInfo,admin.conversations.restrictAccess.addGroup,admin.conversations.restrictAccess.listGroups,admin.conversations.restrictAccess.removeGroup,admin.emoji.add,admin.emoji.addAlias,admin.emoji.list,admin.emoji.remove,admin.emoji.rename,admin.functions.list,admin.functions.permissions.lookup,admin.functions.permissions.set,admin.inviteRequests.approve,admin.inviteRequests.deny,admin.inviteRequests.list,admin.inviteRequests.approved.list,admin.inviteRequests.denied.list,admin.roles.addAssignments,admin.roles.listAssignments,admin.roles.removeAssignments,admin.teams.admins.list,admin.teams.create,admin.teams.list,admin.teams.owners.list,admin.teams.settings.info,admin.teams.settings.setDefaultChannels,admin.teams.settings.setDescription,admin.teams.settings.setDiscoverability,admin.teams.settings.setIcon,admin.teams.settings.setName,admin.usergroups.addChannels,admin.usergroups.addTeams,admin.usergroups.listChannels,admin.usergroups.removeChannels,admin.users.assign,admin.users.invite,admin.users.list,admin.users.remove,admin.users.setAdmin,admin.users.setExpiration,admin.users.setOwner,admin.users.setRegular,admin.users.session.clearSettings,admin.users.session.getSettings,admin.users.session.invalidate,admin.users.session.list,admin.users.session.reset,admin.users.session.resetBulk,admin.users.session.setSettings,admin.users.unsupportedVersions.export,admin.workflows.collaborators.add,admin.workflows.collaborators.remove,admin.workflows.permissions.lookup,admin.workflows.search,admin.workflows.unpublish,api.test,apps.activities.list,apps.auth.external.delete,apps.auth.external.get,apps.connections.open,apps.uninstall,apps.datastore.bulkDelete,apps.datastore.bulkGet,apps.datastore.bulkPut,apps.datastore.count,apps.datastore.delete,apps.datastore.get,apps.datastore.put,apps.datastore.query,apps.datastore.update,apps.event.authorizations.list,apps.manifest.create,apps.manifest.delete,apps.manifest.export,apps.manifest.update,apps.manifest.validate,apps.user.connection.update,agents.sessions.rename,agents.sessions.setStatus,assistant.search.context,assistant.threads.setStatus,assistant.threads.setSuggestedPrompts,assistant.threads.setTitle,auth.revoke,auth.test,auth.teams.list,bookmarks.add,bookmarks.edit,bookmarks.list,bookmarks.remove,bots.info,calls.add,calls.end,calls.info,calls.update,calls.participants.add,calls.participants.remove,canvases.access.delete,canvases.access.set,canvases.create,canvases.delete,canvases.edit,canvases.sections.lookup,channels.mark,agents.conversations.archive,agents.conversations.create,agents.conversations.getCanvas,agents.conversations.listViews,agents.conversations.removeView,agents.conversations.setCanvasContent,agents.conversations.setCommands,agents.conversations.setProperties,agents.conversations.setView,chat.appendStream,chat.delete,chat.deleteScheduledMessage,chat.getPermalink,chat.meMessage,chat.postEphemeral,chat.postMessage,chat.scheduleMessage,chat.startStream,chat.stopStream,chat.unfurl,chat.update,chat.scheduledMessages.list,conversations.acceptSharedInvite,conversations.approveSharedInvite,conversations.archive,conversations.close,conversations.create,conversations.declineSharedInvite,conversations.history,conversations.info,conversations.invite,conversations.inviteShared,conversations.join,conversations.kick,conversations.leave,conversations.list,conversations.listConnectInvites,conversations.mark,conversations.members,conversations.open,conversations.rename,conversations.replies,conversations.setPurpose,conversations.setTopic,conversations.unarchive,conversations.canvases.create,conversations.externalInvitePermissions.set,conversations.requestSharedInvite.approve,conversations.requestSharedInvite.deny,conversations.requestSharedInvite.list,dialog.open,dnd.endDnd,dnd.endSnooze,dnd.info,dnd.setSnooze,dnd.teamInfo,emoji.list,files.completeUploadExternal,files.delete,files.getUploadURLExternal,files.info,files.list,files.revokePublicURL,files.sharedPublicURL,files.upload,files.comments.delete,files.remote.add,files.remote.info,files.remote.list,files.remote.remove,files.remote.share,files.remote.update,functions.completeError,functions.completeSuccess,functions.distributions.permissions.add,functions.distributions.permissions.list,functions.distributions.permissions.remove,functions.distributions.permissions.set,functions.workflows.steps.list,functions.workflows.steps.responses.export,groups.mark,migration.exchange,oauth.access,oauth.v2.access,oauth.v2.exchange,openid.connect.token,openid.connect.userInfo,pins.add,pins.list,pins.remove,reactions.add,reactions.get,reactions.list,reactions.remove,reminders.add,reminders.complete,reminders.delete,reminders.info,reminders.list,rtm.connect,rtm.start,search.all,search.files,search.messages,slackLists.access.delete,slackLists.access.set,slackLists.create,slackLists.update,slackLists.download.get,slackLists.download.start,slackLists.items.create,slackLists.items.delete,slackLists.items.deleteMultiple,slackLists.items.info,slackLists.items.list,slackLists.items.update,stars.add,stars.list,stars.remove,team.accessLogs,team.billableInfo,team.info,team.integrationLogs,team.billing.info,team.externalTeams.disconnect,team.externalTeams.list,team.preferences.list,team.profile.get,tooling.tokens.rotate,usergroups.create,usergroups.disable,usergroups.enable,usergroups.list,usergroups.update,usergroups.users.list,usergroups.users.update,users.conversations,users.deletePhoto,users.getPresence,users.identity,users.info,users.list,users.lookupByEmail,users.setActive,users.setPhoto,users.setPresence,users.discoverableContacts.lookup,users.profile.get,users.profile.set,views.open,views.publish,views.push,views.update,workflows.stepCompleted,workflows.stepFailed,workflows.updateStep,workflows.featured.add,workflows.featured.list,workflows.featured.remove,workflows.featured.set,workflows.triggers.permissions.add,workflows.triggers.permissions.list,workflows.triggers.permissions.remove,workflows.triggers.permissions.set,im.list,im.mark,mpim.list,mpim.mark".split( "," ) @@ -1169,36 +1169,33 @@ async def run_method(self, method_name, method, async_method): elif method_name == "agents_sessions_setStatus": self.api_methods_to_call.remove(method(channel_id="C123", status="processing")["method"]) await async_method(channel_id="C123", status="processing") - elif method_name == "codeChannels_archive": + elif method_name == "agents_conversations_archive": self.api_methods_to_call.remove(method(channel_id="C123")["method"]) await async_method(channel_id="C123") - elif method_name == "codeChannels_create": + elif method_name == "agents_conversations_create": self.api_methods_to_call.remove( method(name="Fix flaky test", origin_channel_id="C123", origin_message_ts="1717171717.123456")["method"] ) await async_method(name="Fix flaky test", origin_channel_id="C123", origin_message_ts="1717171717.123456") - elif method_name == "codeChannels_getCanvas": - self.api_methods_to_call.remove(method(channel_id="C123", canvas_id="F123")["method"]) - await async_method(channel_id="C123", canvas_id="F123") - elif method_name == "codeChannels_listViews": + elif method_name == "agents_conversations_getCanvas": + self.api_methods_to_call.remove(method(channel="C123", canvas_id="F123")["method"]) + await async_method(channel="C123", canvas_id="F123") + elif method_name == "agents_conversations_listViews": self.api_methods_to_call.remove(method(channel_id="C123")["method"]) await async_method(channel_id="C123") - elif method_name == "codeChannels_removeView": + elif method_name == "agents_conversations_removeView": self.api_methods_to_call.remove(method(channel_id="C123", view_id="V123")["method"]) await async_method(channel_id="C123", view_id="V123") - elif method_name == "codeChannels_rename": - self.api_methods_to_call.remove(method(channel_id="C123", name="new-name")["method"]) - await async_method(channel_id="C123", name="new-name") - elif method_name == "codeChannels_setCanvasContent": - self.api_methods_to_call.remove(method(channel_id="C123", canvas_id="F123", content="# Plan")["method"]) - await async_method(channel_id="C123", canvas_id="F123", content="# Plan") - elif method_name == "codeChannels_setCommands": + elif method_name == "agents_conversations_setCanvasContent": + self.api_methods_to_call.remove(method(channel="C123", canvas_id="F123", content="# Plan")["method"]) + await async_method(channel="C123", canvas_id="F123", content="# Plan") + elif method_name == "agents_conversations_setCommands": self.api_methods_to_call.remove(method(channel_id="C123", commands=[])["method"]) await async_method(channel_id="C123", commands=[]) - elif method_name == "codeChannels_setProperties": + elif method_name == "agents_conversations_setProperties": self.api_methods_to_call.remove(method(channel_id="C123")["method"]) await async_method(channel_id="C123") - elif method_name == "codeChannels_setView": + elif method_name == "agents_conversations_setView": self.api_methods_to_call.remove(method(channel_id="C123", type="diff")["method"]) await async_method(channel_id="C123", type="diff") else: From ed5f8d72bd6daf3d1392171825571eef1be1235e Mon Sep 17 00:00:00 2001 From: Eden Zimbelman Date: Wed, 23 Sep 2026 14:42:17 -0700 Subject: [PATCH 04/11] refactor(web-api): give agents.conversations.* explicit typed params MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rewrite the 9 agents.conversations.* methods (create, archive, setProperties, setView, setCommands, listViews, removeView, getCanvas, setCanvasContent) from **kwargs-only to explicit keyword-only typed params, matching the repo house convention (conversations_create / chat_postMessage): required args have no default, optional args are Optional[...] = None, kwargs.update({...}) maps each named param, and **kwargs stays as the fallback for future/undocumented args. Arg names preserved verbatim from the method schemas: getCanvas and setCanvasContent take `channel` (not `channel_id`); the other seven take `channel_id`. Transport unchanged (json=kwargs, json_input_supported). setView.blocks uses Optional[Sequence[Union[Dict, Block]]] mirroring chat_postMessage; complex object args (code_channel, agent_resource, commands, csp) stay Optional[Dict]/Optional[Sequence[Dict]] pending published nested shapes. agents.sessions.* were already typed — left as-is. Regenerated async_client.py + legacy_client.py via codegen. Co-Authored-By: Claude Co-Authored-By: Claude Opus 4.8 (1M context) --- slack_sdk/web/async_client.py | 228 +++++++++++++++++++-------------- slack_sdk/web/client.py | 228 +++++++++++++++++++-------------- slack_sdk/web/legacy_client.py | 228 +++++++++++++++++++-------------- 3 files changed, 399 insertions(+), 285 deletions(-) diff --git a/slack_sdk/web/async_client.py b/slack_sdk/web/async_client.py index f9c9409e4..1388601ec 100644 --- a/slack_sdk/web/async_client.py +++ b/slack_sdk/web/async_client.py @@ -2167,185 +2167,223 @@ async def agents_sessions_setStatus( async def agents_conversations_archive( self, + *, + channel_id: Optional[str] = None, + summary_message_ts: Optional[str] = None, **kwargs, ) -> AsyncSlackResponse: """Archive a code channel. Requires the ``code_channels:manage`` scope. - - Args: - channel_id (str, optional): ID of the code channel to archive. - summary_message_ts (str, optional): Timestamp of a message in the code channel to - share back as a thread reply on the origin message. Requires the channel to have - an origin link. https://docs.slack.dev/reference/methods/agents.conversations.archive """ + kwargs.update( + { + "channel_id": channel_id, + "summary_message_ts": summary_message_ts, + } + ) + kwargs = _remove_none_values(kwargs) return await self.api_call("agents.conversations.archive", json=kwargs) async def agents_conversations_create( self, + *, + team_id: Optional[str] = None, + session_id: Optional[str] = None, + name: Optional[str] = None, + is_private: Optional[bool] = None, + origin_channel_id: Optional[str] = None, + origin_message_ts: Optional[str] = None, **kwargs, ) -> AsyncSlackResponse: """Create a dedicated code channel for an agent session. Requires the ``code_channels:manage`` scope. - - Args: - team_id (str, optional): Encoded team id to create the channel in. Required for org - tokens when ``origin_channel_id`` is not provided. When omitted, the workspace is - derived from context. - session_id (str, optional): An opaque identifier for the agent session. When provided, - the call is idempotent: if a channel already exists for this ``session_id``, it is - returned instead of creating a new one. - name (str, optional): A friendly display name for the code channel. Optional when - ``origin_channel_id`` and ``origin_message_ts`` are provided — in that case the - channel is named from context. - is_private (bool, optional): Create a private channel instead of a public one. - origin_channel_id (str, optional): The channel ID where the agent session was initiated - from. Must be provided together with ``origin_message_ts``. The channel must be - accessible. - origin_message_ts (str, optional): The message timestamp in the origin channel that - started the agent session. Must be provided together with ``origin_channel_id``. https://docs.slack.dev/reference/methods/agents.conversations.create """ + kwargs.update( + { + "team_id": team_id, + "session_id": session_id, + "name": name, + "is_private": is_private, + "origin_channel_id": origin_channel_id, + "origin_message_ts": origin_message_ts, + } + ) + kwargs = _remove_none_values(kwargs) return await self.api_call("agents.conversations.create", json=kwargs) async def agents_conversations_getCanvas( self, + *, + channel: str, + canvas_id: str, + content_format: Optional[str] = None, + include_resolved: Optional[bool] = None, **kwargs, ) -> AsyncSlackResponse: """Fetch a canvas attached to a code channel. Requires the ``code_channels:manage`` scope. - Args: - channel (str, required): ID of the agent session channel the canvas belongs to. Note - this method takes ``channel``, not ``channel_id``. - canvas_id (str, required): Encoded ID of the canvas to fetch. - content_format (str, optional): Format to render the canvas content in. Defaults to - markdown. - include_resolved (bool, optional): Whether to include resolved comment threads in the - response. Defaults to false. + Note this method takes ``channel``, not ``channel_id``. https://docs.slack.dev/reference/methods/agents.conversations.getCanvas """ + kwargs.update( + { + "channel": channel, + "canvas_id": canvas_id, + "content_format": content_format, + "include_resolved": include_resolved, + } + ) + kwargs = _remove_none_values(kwargs) return await self.api_call("agents.conversations.getCanvas", json=kwargs) async def agents_conversations_listViews( self, + *, + channel_id: Optional[str] = None, **kwargs, ) -> AsyncSlackResponse: """List the views currently attached to a code channel. Requires the ``code_channels:manage`` scope. - - Args: - channel_id (str, optional): ID of the code channel to list views for. https://docs.slack.dev/reference/methods/agents.conversations.listViews """ + kwargs.update({"channel_id": channel_id}) + kwargs = _remove_none_values(kwargs) return await self.api_call("agents.conversations.listViews", json=kwargs) async def agents_conversations_removeView( self, + *, + channel_id: Optional[str] = None, + view_key: Optional[str] = None, + view_id: Optional[str] = None, **kwargs, ) -> AsyncSlackResponse: """Remove a view from a code channel. Requires the ``code_channels:manage`` scope. - Args: - channel_id (str, optional): ID of the code channel to remove the view from. - view_key (str, optional): Agent-assigned key of the view to remove. Provide exactly one - of ``view_key`` or ``view_id``. - view_id (str, optional): Encoded channel tab ID of the view to remove. Provide exactly - one of ``view_key`` or ``view_id``. + Provide exactly one of ``view_key`` or ``view_id``. https://docs.slack.dev/reference/methods/agents.conversations.removeView """ + kwargs.update( + { + "channel_id": channel_id, + "view_key": view_key, + "view_id": view_id, + } + ) + kwargs = _remove_none_values(kwargs) return await self.api_call("agents.conversations.removeView", json=kwargs) async def agents_conversations_setCanvasContent( self, + *, + channel: str, + canvas_id: str, + content: str, **kwargs, ) -> AsyncSlackResponse: """Replace the full markdown content of a plan canvas attached to a code channel. Requires the ``code_channels:manage`` scope. - Args: - channel (str, required): ID of the agent session channel the canvas is attached to. - Note this method takes ``channel``, not ``channel_id``. - canvas_id (str, required): Encoded ID of the canvas whose content to replace. - content (str, required): The full new canvas content as markdown. The server diffs this - against the current content and applies only the changed sections. + Note this method takes ``channel``, not ``channel_id``. https://docs.slack.dev/reference/methods/agents.conversations.setCanvasContent """ + kwargs.update( + { + "channel": channel, + "canvas_id": canvas_id, + "content": content, + } + ) + kwargs = _remove_none_values(kwargs) return await self.api_call("agents.conversations.setCanvasContent", json=kwargs) async def agents_conversations_setCommands( self, + *, + commands: Sequence[Dict], + channel_id: Optional[str] = None, **kwargs, ) -> AsyncSlackResponse: """Register the set of agent-defined slash commands for the calling agent in a code channel. Requires the ``code_channels:manage`` scope. - - Args: - channel_id (str, optional): ID of the code channel to register commands for. - commands (array, required): Full set of commands to register for the calling agent in - this channel, replacing that agent's previously registered set. Pass an empty array - to clear them. https://docs.slack.dev/reference/methods/agents.conversations.setCommands """ + kwargs.update( + { + "commands": commands, + "channel_id": channel_id, + } + ) + kwargs = _remove_none_values(kwargs) return await self.api_call("agents.conversations.setCommands", json=kwargs) async def agents_conversations_setProperties( self, + *, + channel_id: Optional[str] = None, + title: Optional[str] = None, + status: Optional[str] = None, + code_channel: Optional[Dict] = None, + agent_resource: Optional[Dict] = None, **kwargs, ) -> AsyncSlackResponse: """Set properties on a code channel. Requires the ``code_channels:manage`` scope. - - Args: - channel_id (str, optional): ID of the code channel to update. - title (str, optional): New display title for the agent session. - status (str, optional): New status for the agent session. - code_channel (object, optional): Code channel properties to set. Only provided fields - are updated. - agent_resource (object, optional): Agent resource properties to set. Only provided - fields are updated. https://docs.slack.dev/reference/methods/agents.conversations.setProperties """ + kwargs.update( + { + "channel_id": channel_id, + "title": title, + "status": status, + "code_channel": code_channel, + "agent_resource": agent_resource, + } + ) + kwargs = _remove_none_values(kwargs) return await self.api_call("agents.conversations.setProperties", json=kwargs) async def agents_conversations_setView( self, + *, + channel_id: Optional[str] = None, + type: Optional[str] = None, + view_key: Optional[str] = None, + content: Optional[str] = None, + blocks: Optional[Sequence[Union[Dict, Block]]] = None, + canvas_id: Optional[str] = None, + access_level: Optional[str] = None, + agent_content_hash: Optional[str] = None, + pr_url: Optional[str] = None, + base_branch: Optional[str] = None, + head_branch: Optional[str] = None, + name: Optional[str] = None, + label: Optional[str] = None, + csp: Optional[Dict] = None, **kwargs, ) -> AsyncSlackResponse: """Create or update a view in a code channel. Requires the ``code_channels:manage`` scope. - - Args: - channel_id (str, optional): ID of the code channel to render the view in. - type (str, optional): The kind of view to create or update. Defaults to html. - Determines which other arguments are required: html and diff require content, - block_kit requires blocks, canvas requires canvas_id, pull_request requires pr_url. - view_key (str, optional): Agent-assigned stable identity for the view (e.g. the source - file path on the agent's machine). Used as the upsert key: calls with the same - view_key update the existing view. - content (str, optional): View content. For html, a full self-contained HTML document; - for diff, raw unified diff text. Capped at 1,000,000 bytes — larger content returns - an error. - blocks (array, optional): Block Kit blocks to render in the view tab. Required when type - is block_kit; ignored otherwise. - canvas_id (str, optional): Encoded ID of the canvas to attach as the view. Required when - type is canvas; ignored otherwise. - access_level (str, optional): For canvas views: access level granted to the channel for - the canvas tab. Defaults to write. Use 'comment' to grant channel members comment - access. - agent_content_hash (str, optional): For canvas views: hash of the canvas-derived - markdown the agent last wrote, recorded so the agent can later detect human edits to - the canvas. - pr_url (str, optional): For pull_request views: the pull request's URL. Required when - type is pull_request; ignored otherwise. - base_branch (str, optional): For diff views: base branch name for display purposes. - head_branch (str, optional): For diff views: head branch name for display purposes. - name (str, optional): Display label for the view tab. Preferred over the legacy 'label' - argument (name wins if both are supplied). Defaults to the last path segment of - view_key. - label (str, optional): Deprecated alias for 'name'. Display label for the view tab. - Defaults to the last path segment of view_key, stripped of any .html/.htm extension. - csp (object, optional): Content-Security-Policy domain declarations for the view. - Domains are validated server-side (https-only, no private/internal hosts) and - persisted. https://docs.slack.dev/reference/methods/agents.conversations.setView """ + kwargs.update( + { + "channel_id": channel_id, + "type": type, + "view_key": view_key, + "content": content, + "blocks": blocks, + "canvas_id": canvas_id, + "access_level": access_level, + "agent_content_hash": agent_content_hash, + "pr_url": pr_url, + "base_branch": base_branch, + "head_branch": head_branch, + "name": name, + "label": label, + "csp": csp, + } + ) + kwargs = _remove_none_values(kwargs) return await self.api_call("agents.conversations.setView", json=kwargs) async def assistant_threads_setTitle( diff --git a/slack_sdk/web/client.py b/slack_sdk/web/client.py index 5b4a4d2ff..5efbbd9ae 100644 --- a/slack_sdk/web/client.py +++ b/slack_sdk/web/client.py @@ -2157,185 +2157,223 @@ def agents_sessions_setStatus( def agents_conversations_archive( self, + *, + channel_id: Optional[str] = None, + summary_message_ts: Optional[str] = None, **kwargs, ) -> SlackResponse: """Archive a code channel. Requires the ``code_channels:manage`` scope. - - Args: - channel_id (str, optional): ID of the code channel to archive. - summary_message_ts (str, optional): Timestamp of a message in the code channel to - share back as a thread reply on the origin message. Requires the channel to have - an origin link. https://docs.slack.dev/reference/methods/agents.conversations.archive """ + kwargs.update( + { + "channel_id": channel_id, + "summary_message_ts": summary_message_ts, + } + ) + kwargs = _remove_none_values(kwargs) return self.api_call("agents.conversations.archive", json=kwargs) def agents_conversations_create( self, + *, + team_id: Optional[str] = None, + session_id: Optional[str] = None, + name: Optional[str] = None, + is_private: Optional[bool] = None, + origin_channel_id: Optional[str] = None, + origin_message_ts: Optional[str] = None, **kwargs, ) -> SlackResponse: """Create a dedicated code channel for an agent session. Requires the ``code_channels:manage`` scope. - - Args: - team_id (str, optional): Encoded team id to create the channel in. Required for org - tokens when ``origin_channel_id`` is not provided. When omitted, the workspace is - derived from context. - session_id (str, optional): An opaque identifier for the agent session. When provided, - the call is idempotent: if a channel already exists for this ``session_id``, it is - returned instead of creating a new one. - name (str, optional): A friendly display name for the code channel. Optional when - ``origin_channel_id`` and ``origin_message_ts`` are provided — in that case the - channel is named from context. - is_private (bool, optional): Create a private channel instead of a public one. - origin_channel_id (str, optional): The channel ID where the agent session was initiated - from. Must be provided together with ``origin_message_ts``. The channel must be - accessible. - origin_message_ts (str, optional): The message timestamp in the origin channel that - started the agent session. Must be provided together with ``origin_channel_id``. https://docs.slack.dev/reference/methods/agents.conversations.create """ + kwargs.update( + { + "team_id": team_id, + "session_id": session_id, + "name": name, + "is_private": is_private, + "origin_channel_id": origin_channel_id, + "origin_message_ts": origin_message_ts, + } + ) + kwargs = _remove_none_values(kwargs) return self.api_call("agents.conversations.create", json=kwargs) def agents_conversations_getCanvas( self, + *, + channel: str, + canvas_id: str, + content_format: Optional[str] = None, + include_resolved: Optional[bool] = None, **kwargs, ) -> SlackResponse: """Fetch a canvas attached to a code channel. Requires the ``code_channels:manage`` scope. - Args: - channel (str, required): ID of the agent session channel the canvas belongs to. Note - this method takes ``channel``, not ``channel_id``. - canvas_id (str, required): Encoded ID of the canvas to fetch. - content_format (str, optional): Format to render the canvas content in. Defaults to - markdown. - include_resolved (bool, optional): Whether to include resolved comment threads in the - response. Defaults to false. + Note this method takes ``channel``, not ``channel_id``. https://docs.slack.dev/reference/methods/agents.conversations.getCanvas """ + kwargs.update( + { + "channel": channel, + "canvas_id": canvas_id, + "content_format": content_format, + "include_resolved": include_resolved, + } + ) + kwargs = _remove_none_values(kwargs) return self.api_call("agents.conversations.getCanvas", json=kwargs) def agents_conversations_listViews( self, + *, + channel_id: Optional[str] = None, **kwargs, ) -> SlackResponse: """List the views currently attached to a code channel. Requires the ``code_channels:manage`` scope. - - Args: - channel_id (str, optional): ID of the code channel to list views for. https://docs.slack.dev/reference/methods/agents.conversations.listViews """ + kwargs.update({"channel_id": channel_id}) + kwargs = _remove_none_values(kwargs) return self.api_call("agents.conversations.listViews", json=kwargs) def agents_conversations_removeView( self, + *, + channel_id: Optional[str] = None, + view_key: Optional[str] = None, + view_id: Optional[str] = None, **kwargs, ) -> SlackResponse: """Remove a view from a code channel. Requires the ``code_channels:manage`` scope. - Args: - channel_id (str, optional): ID of the code channel to remove the view from. - view_key (str, optional): Agent-assigned key of the view to remove. Provide exactly one - of ``view_key`` or ``view_id``. - view_id (str, optional): Encoded channel tab ID of the view to remove. Provide exactly - one of ``view_key`` or ``view_id``. + Provide exactly one of ``view_key`` or ``view_id``. https://docs.slack.dev/reference/methods/agents.conversations.removeView """ + kwargs.update( + { + "channel_id": channel_id, + "view_key": view_key, + "view_id": view_id, + } + ) + kwargs = _remove_none_values(kwargs) return self.api_call("agents.conversations.removeView", json=kwargs) def agents_conversations_setCanvasContent( self, + *, + channel: str, + canvas_id: str, + content: str, **kwargs, ) -> SlackResponse: """Replace the full markdown content of a plan canvas attached to a code channel. Requires the ``code_channels:manage`` scope. - Args: - channel (str, required): ID of the agent session channel the canvas is attached to. - Note this method takes ``channel``, not ``channel_id``. - canvas_id (str, required): Encoded ID of the canvas whose content to replace. - content (str, required): The full new canvas content as markdown. The server diffs this - against the current content and applies only the changed sections. + Note this method takes ``channel``, not ``channel_id``. https://docs.slack.dev/reference/methods/agents.conversations.setCanvasContent """ + kwargs.update( + { + "channel": channel, + "canvas_id": canvas_id, + "content": content, + } + ) + kwargs = _remove_none_values(kwargs) return self.api_call("agents.conversations.setCanvasContent", json=kwargs) def agents_conversations_setCommands( self, + *, + commands: Sequence[Dict], + channel_id: Optional[str] = None, **kwargs, ) -> SlackResponse: """Register the set of agent-defined slash commands for the calling agent in a code channel. Requires the ``code_channels:manage`` scope. - - Args: - channel_id (str, optional): ID of the code channel to register commands for. - commands (array, required): Full set of commands to register for the calling agent in - this channel, replacing that agent's previously registered set. Pass an empty array - to clear them. https://docs.slack.dev/reference/methods/agents.conversations.setCommands """ + kwargs.update( + { + "commands": commands, + "channel_id": channel_id, + } + ) + kwargs = _remove_none_values(kwargs) return self.api_call("agents.conversations.setCommands", json=kwargs) def agents_conversations_setProperties( self, + *, + channel_id: Optional[str] = None, + title: Optional[str] = None, + status: Optional[str] = None, + code_channel: Optional[Dict] = None, + agent_resource: Optional[Dict] = None, **kwargs, ) -> SlackResponse: """Set properties on a code channel. Requires the ``code_channels:manage`` scope. - - Args: - channel_id (str, optional): ID of the code channel to update. - title (str, optional): New display title for the agent session. - status (str, optional): New status for the agent session. - code_channel (object, optional): Code channel properties to set. Only provided fields - are updated. - agent_resource (object, optional): Agent resource properties to set. Only provided - fields are updated. https://docs.slack.dev/reference/methods/agents.conversations.setProperties """ + kwargs.update( + { + "channel_id": channel_id, + "title": title, + "status": status, + "code_channel": code_channel, + "agent_resource": agent_resource, + } + ) + kwargs = _remove_none_values(kwargs) return self.api_call("agents.conversations.setProperties", json=kwargs) def agents_conversations_setView( self, + *, + channel_id: Optional[str] = None, + type: Optional[str] = None, + view_key: Optional[str] = None, + content: Optional[str] = None, + blocks: Optional[Sequence[Union[Dict, Block]]] = None, + canvas_id: Optional[str] = None, + access_level: Optional[str] = None, + agent_content_hash: Optional[str] = None, + pr_url: Optional[str] = None, + base_branch: Optional[str] = None, + head_branch: Optional[str] = None, + name: Optional[str] = None, + label: Optional[str] = None, + csp: Optional[Dict] = None, **kwargs, ) -> SlackResponse: """Create or update a view in a code channel. Requires the ``code_channels:manage`` scope. - - Args: - channel_id (str, optional): ID of the code channel to render the view in. - type (str, optional): The kind of view to create or update. Defaults to html. - Determines which other arguments are required: html and diff require content, - block_kit requires blocks, canvas requires canvas_id, pull_request requires pr_url. - view_key (str, optional): Agent-assigned stable identity for the view (e.g. the source - file path on the agent's machine). Used as the upsert key: calls with the same - view_key update the existing view. - content (str, optional): View content. For html, a full self-contained HTML document; - for diff, raw unified diff text. Capped at 1,000,000 bytes — larger content returns - an error. - blocks (array, optional): Block Kit blocks to render in the view tab. Required when type - is block_kit; ignored otherwise. - canvas_id (str, optional): Encoded ID of the canvas to attach as the view. Required when - type is canvas; ignored otherwise. - access_level (str, optional): For canvas views: access level granted to the channel for - the canvas tab. Defaults to write. Use 'comment' to grant channel members comment - access. - agent_content_hash (str, optional): For canvas views: hash of the canvas-derived - markdown the agent last wrote, recorded so the agent can later detect human edits to - the canvas. - pr_url (str, optional): For pull_request views: the pull request's URL. Required when - type is pull_request; ignored otherwise. - base_branch (str, optional): For diff views: base branch name for display purposes. - head_branch (str, optional): For diff views: head branch name for display purposes. - name (str, optional): Display label for the view tab. Preferred over the legacy 'label' - argument (name wins if both are supplied). Defaults to the last path segment of - view_key. - label (str, optional): Deprecated alias for 'name'. Display label for the view tab. - Defaults to the last path segment of view_key, stripped of any .html/.htm extension. - csp (object, optional): Content-Security-Policy domain declarations for the view. - Domains are validated server-side (https-only, no private/internal hosts) and - persisted. https://docs.slack.dev/reference/methods/agents.conversations.setView """ + kwargs.update( + { + "channel_id": channel_id, + "type": type, + "view_key": view_key, + "content": content, + "blocks": blocks, + "canvas_id": canvas_id, + "access_level": access_level, + "agent_content_hash": agent_content_hash, + "pr_url": pr_url, + "base_branch": base_branch, + "head_branch": head_branch, + "name": name, + "label": label, + "csp": csp, + } + ) + kwargs = _remove_none_values(kwargs) return self.api_call("agents.conversations.setView", json=kwargs) def assistant_threads_setTitle( diff --git a/slack_sdk/web/legacy_client.py b/slack_sdk/web/legacy_client.py index ff17f8c23..78dd454c1 100644 --- a/slack_sdk/web/legacy_client.py +++ b/slack_sdk/web/legacy_client.py @@ -2167,185 +2167,223 @@ def agents_sessions_setStatus( def agents_conversations_archive( self, + *, + channel_id: Optional[str] = None, + summary_message_ts: Optional[str] = None, **kwargs, ) -> Union[Future, SlackResponse]: """Archive a code channel. Requires the ``code_channels:manage`` scope. - - Args: - channel_id (str, optional): ID of the code channel to archive. - summary_message_ts (str, optional): Timestamp of a message in the code channel to - share back as a thread reply on the origin message. Requires the channel to have - an origin link. https://docs.slack.dev/reference/methods/agents.conversations.archive """ + kwargs.update( + { + "channel_id": channel_id, + "summary_message_ts": summary_message_ts, + } + ) + kwargs = _remove_none_values(kwargs) return self.api_call("agents.conversations.archive", json=kwargs) def agents_conversations_create( self, + *, + team_id: Optional[str] = None, + session_id: Optional[str] = None, + name: Optional[str] = None, + is_private: Optional[bool] = None, + origin_channel_id: Optional[str] = None, + origin_message_ts: Optional[str] = None, **kwargs, ) -> Union[Future, SlackResponse]: """Create a dedicated code channel for an agent session. Requires the ``code_channels:manage`` scope. - - Args: - team_id (str, optional): Encoded team id to create the channel in. Required for org - tokens when ``origin_channel_id`` is not provided. When omitted, the workspace is - derived from context. - session_id (str, optional): An opaque identifier for the agent session. When provided, - the call is idempotent: if a channel already exists for this ``session_id``, it is - returned instead of creating a new one. - name (str, optional): A friendly display name for the code channel. Optional when - ``origin_channel_id`` and ``origin_message_ts`` are provided — in that case the - channel is named from context. - is_private (bool, optional): Create a private channel instead of a public one. - origin_channel_id (str, optional): The channel ID where the agent session was initiated - from. Must be provided together with ``origin_message_ts``. The channel must be - accessible. - origin_message_ts (str, optional): The message timestamp in the origin channel that - started the agent session. Must be provided together with ``origin_channel_id``. https://docs.slack.dev/reference/methods/agents.conversations.create """ + kwargs.update( + { + "team_id": team_id, + "session_id": session_id, + "name": name, + "is_private": is_private, + "origin_channel_id": origin_channel_id, + "origin_message_ts": origin_message_ts, + } + ) + kwargs = _remove_none_values(kwargs) return self.api_call("agents.conversations.create", json=kwargs) def agents_conversations_getCanvas( self, + *, + channel: str, + canvas_id: str, + content_format: Optional[str] = None, + include_resolved: Optional[bool] = None, **kwargs, ) -> Union[Future, SlackResponse]: """Fetch a canvas attached to a code channel. Requires the ``code_channels:manage`` scope. - Args: - channel (str, required): ID of the agent session channel the canvas belongs to. Note - this method takes ``channel``, not ``channel_id``. - canvas_id (str, required): Encoded ID of the canvas to fetch. - content_format (str, optional): Format to render the canvas content in. Defaults to - markdown. - include_resolved (bool, optional): Whether to include resolved comment threads in the - response. Defaults to false. + Note this method takes ``channel``, not ``channel_id``. https://docs.slack.dev/reference/methods/agents.conversations.getCanvas """ + kwargs.update( + { + "channel": channel, + "canvas_id": canvas_id, + "content_format": content_format, + "include_resolved": include_resolved, + } + ) + kwargs = _remove_none_values(kwargs) return self.api_call("agents.conversations.getCanvas", json=kwargs) def agents_conversations_listViews( self, + *, + channel_id: Optional[str] = None, **kwargs, ) -> Union[Future, SlackResponse]: """List the views currently attached to a code channel. Requires the ``code_channels:manage`` scope. - - Args: - channel_id (str, optional): ID of the code channel to list views for. https://docs.slack.dev/reference/methods/agents.conversations.listViews """ + kwargs.update({"channel_id": channel_id}) + kwargs = _remove_none_values(kwargs) return self.api_call("agents.conversations.listViews", json=kwargs) def agents_conversations_removeView( self, + *, + channel_id: Optional[str] = None, + view_key: Optional[str] = None, + view_id: Optional[str] = None, **kwargs, ) -> Union[Future, SlackResponse]: """Remove a view from a code channel. Requires the ``code_channels:manage`` scope. - Args: - channel_id (str, optional): ID of the code channel to remove the view from. - view_key (str, optional): Agent-assigned key of the view to remove. Provide exactly one - of ``view_key`` or ``view_id``. - view_id (str, optional): Encoded channel tab ID of the view to remove. Provide exactly - one of ``view_key`` or ``view_id``. + Provide exactly one of ``view_key`` or ``view_id``. https://docs.slack.dev/reference/methods/agents.conversations.removeView """ + kwargs.update( + { + "channel_id": channel_id, + "view_key": view_key, + "view_id": view_id, + } + ) + kwargs = _remove_none_values(kwargs) return self.api_call("agents.conversations.removeView", json=kwargs) def agents_conversations_setCanvasContent( self, + *, + channel: str, + canvas_id: str, + content: str, **kwargs, ) -> Union[Future, SlackResponse]: """Replace the full markdown content of a plan canvas attached to a code channel. Requires the ``code_channels:manage`` scope. - Args: - channel (str, required): ID of the agent session channel the canvas is attached to. - Note this method takes ``channel``, not ``channel_id``. - canvas_id (str, required): Encoded ID of the canvas whose content to replace. - content (str, required): The full new canvas content as markdown. The server diffs this - against the current content and applies only the changed sections. + Note this method takes ``channel``, not ``channel_id``. https://docs.slack.dev/reference/methods/agents.conversations.setCanvasContent """ + kwargs.update( + { + "channel": channel, + "canvas_id": canvas_id, + "content": content, + } + ) + kwargs = _remove_none_values(kwargs) return self.api_call("agents.conversations.setCanvasContent", json=kwargs) def agents_conversations_setCommands( self, + *, + commands: Sequence[Dict], + channel_id: Optional[str] = None, **kwargs, ) -> Union[Future, SlackResponse]: """Register the set of agent-defined slash commands for the calling agent in a code channel. Requires the ``code_channels:manage`` scope. - - Args: - channel_id (str, optional): ID of the code channel to register commands for. - commands (array, required): Full set of commands to register for the calling agent in - this channel, replacing that agent's previously registered set. Pass an empty array - to clear them. https://docs.slack.dev/reference/methods/agents.conversations.setCommands """ + kwargs.update( + { + "commands": commands, + "channel_id": channel_id, + } + ) + kwargs = _remove_none_values(kwargs) return self.api_call("agents.conversations.setCommands", json=kwargs) def agents_conversations_setProperties( self, + *, + channel_id: Optional[str] = None, + title: Optional[str] = None, + status: Optional[str] = None, + code_channel: Optional[Dict] = None, + agent_resource: Optional[Dict] = None, **kwargs, ) -> Union[Future, SlackResponse]: """Set properties on a code channel. Requires the ``code_channels:manage`` scope. - - Args: - channel_id (str, optional): ID of the code channel to update. - title (str, optional): New display title for the agent session. - status (str, optional): New status for the agent session. - code_channel (object, optional): Code channel properties to set. Only provided fields - are updated. - agent_resource (object, optional): Agent resource properties to set. Only provided - fields are updated. https://docs.slack.dev/reference/methods/agents.conversations.setProperties """ + kwargs.update( + { + "channel_id": channel_id, + "title": title, + "status": status, + "code_channel": code_channel, + "agent_resource": agent_resource, + } + ) + kwargs = _remove_none_values(kwargs) return self.api_call("agents.conversations.setProperties", json=kwargs) def agents_conversations_setView( self, + *, + channel_id: Optional[str] = None, + type: Optional[str] = None, + view_key: Optional[str] = None, + content: Optional[str] = None, + blocks: Optional[Sequence[Union[Dict, Block]]] = None, + canvas_id: Optional[str] = None, + access_level: Optional[str] = None, + agent_content_hash: Optional[str] = None, + pr_url: Optional[str] = None, + base_branch: Optional[str] = None, + head_branch: Optional[str] = None, + name: Optional[str] = None, + label: Optional[str] = None, + csp: Optional[Dict] = None, **kwargs, ) -> Union[Future, SlackResponse]: """Create or update a view in a code channel. Requires the ``code_channels:manage`` scope. - - Args: - channel_id (str, optional): ID of the code channel to render the view in. - type (str, optional): The kind of view to create or update. Defaults to html. - Determines which other arguments are required: html and diff require content, - block_kit requires blocks, canvas requires canvas_id, pull_request requires pr_url. - view_key (str, optional): Agent-assigned stable identity for the view (e.g. the source - file path on the agent's machine). Used as the upsert key: calls with the same - view_key update the existing view. - content (str, optional): View content. For html, a full self-contained HTML document; - for diff, raw unified diff text. Capped at 1,000,000 bytes — larger content returns - an error. - blocks (array, optional): Block Kit blocks to render in the view tab. Required when type - is block_kit; ignored otherwise. - canvas_id (str, optional): Encoded ID of the canvas to attach as the view. Required when - type is canvas; ignored otherwise. - access_level (str, optional): For canvas views: access level granted to the channel for - the canvas tab. Defaults to write. Use 'comment' to grant channel members comment - access. - agent_content_hash (str, optional): For canvas views: hash of the canvas-derived - markdown the agent last wrote, recorded so the agent can later detect human edits to - the canvas. - pr_url (str, optional): For pull_request views: the pull request's URL. Required when - type is pull_request; ignored otherwise. - base_branch (str, optional): For diff views: base branch name for display purposes. - head_branch (str, optional): For diff views: head branch name for display purposes. - name (str, optional): Display label for the view tab. Preferred over the legacy 'label' - argument (name wins if both are supplied). Defaults to the last path segment of - view_key. - label (str, optional): Deprecated alias for 'name'. Display label for the view tab. - Defaults to the last path segment of view_key, stripped of any .html/.htm extension. - csp (object, optional): Content-Security-Policy domain declarations for the view. - Domains are validated server-side (https-only, no private/internal hosts) and - persisted. https://docs.slack.dev/reference/methods/agents.conversations.setView """ + kwargs.update( + { + "channel_id": channel_id, + "type": type, + "view_key": view_key, + "content": content, + "blocks": blocks, + "canvas_id": canvas_id, + "access_level": access_level, + "agent_content_hash": agent_content_hash, + "pr_url": pr_url, + "base_branch": base_branch, + "head_branch": head_branch, + "name": name, + "label": label, + "csp": csp, + } + ) + kwargs = _remove_none_values(kwargs) return self.api_call("agents.conversations.setView", json=kwargs) def assistant_threads_setTitle( From 3f4ed6dfabec22ada6f3adcc341a253ab4b563a0 Mon Sep 17 00:00:00 2001 From: Eden Zimbelman Date: Wed, 23 Sep 2026 14:45:49 -0700 Subject: [PATCH 05/11] refactor(web-api): order agents.conversations.* before agents.sessions.* Co-Authored-By: Claude Co-Authored-By: Claude Opus 4.8 (1M context) --- slack_sdk/web/async_client.py | 104 ++++++++++++++++----------------- slack_sdk/web/client.py | 104 ++++++++++++++++----------------- slack_sdk/web/legacy_client.py | 104 ++++++++++++++++----------------- 3 files changed, 156 insertions(+), 156 deletions(-) diff --git a/slack_sdk/web/async_client.py b/slack_sdk/web/async_client.py index 1388601ec..d9006040c 100644 --- a/slack_sdk/web/async_client.py +++ b/slack_sdk/web/async_client.py @@ -2113,58 +2113,6 @@ async def assistant_threads_setStatus( kwargs = _remove_none_values(kwargs) return await self.api_call("assistant.threads.setStatus", json=kwargs) - async def agents_sessions_rename( - self, - *, - channel_id: str, - title: str, - thread_ts: Optional[str] = None, - **kwargs, - ) -> AsyncSlackResponse: - """Renames an agent session. - https://docs.slack.dev/reference/methods/agents.sessions.rename - """ - kwargs.update( - { - "channel_id": channel_id, - "title": title, - "thread_ts": thread_ts, - } - ) - kwargs = _remove_none_values(kwargs) - return await self.api_call("agents.sessions.rename", json=kwargs) - - async def agents_sessions_setStatus( - self, - *, - channel_id: str, - status: str, - thread_ts: Optional[str] = None, - title: Optional[str] = None, - initiator_user_id: Optional[str] = None, - icon_emoji: Optional[str] = None, - icon_url: Optional[str] = None, - username: Optional[str] = None, - **kwargs, - ) -> AsyncSlackResponse: - """Sets the lifecycle status of an agent session, creating the session if it does not already exist. - https://docs.slack.dev/reference/methods/agents.sessions.setStatus - """ - kwargs.update( - { - "channel_id": channel_id, - "status": status, - "thread_ts": thread_ts, - "title": title, - "initiator_user_id": initiator_user_id, - "icon_emoji": icon_emoji, - "icon_url": icon_url, - "username": username, - } - ) - kwargs = _remove_none_values(kwargs) - return await self.api_call("agents.sessions.setStatus", json=kwargs) - async def agents_conversations_archive( self, *, @@ -2386,6 +2334,58 @@ async def agents_conversations_setView( kwargs = _remove_none_values(kwargs) return await self.api_call("agents.conversations.setView", json=kwargs) + async def agents_sessions_rename( + self, + *, + channel_id: str, + title: str, + thread_ts: Optional[str] = None, + **kwargs, + ) -> AsyncSlackResponse: + """Renames an agent session. + https://docs.slack.dev/reference/methods/agents.sessions.rename + """ + kwargs.update( + { + "channel_id": channel_id, + "title": title, + "thread_ts": thread_ts, + } + ) + kwargs = _remove_none_values(kwargs) + return await self.api_call("agents.sessions.rename", json=kwargs) + + async def agents_sessions_setStatus( + self, + *, + channel_id: str, + status: str, + thread_ts: Optional[str] = None, + title: Optional[str] = None, + initiator_user_id: Optional[str] = None, + icon_emoji: Optional[str] = None, + icon_url: Optional[str] = None, + username: Optional[str] = None, + **kwargs, + ) -> AsyncSlackResponse: + """Sets the lifecycle status of an agent session, creating the session if it does not already exist. + https://docs.slack.dev/reference/methods/agents.sessions.setStatus + """ + kwargs.update( + { + "channel_id": channel_id, + "status": status, + "thread_ts": thread_ts, + "title": title, + "initiator_user_id": initiator_user_id, + "icon_emoji": icon_emoji, + "icon_url": icon_url, + "username": username, + } + ) + kwargs = _remove_none_values(kwargs) + return await self.api_call("agents.sessions.setStatus", json=kwargs) + async def assistant_threads_setTitle( self, *, diff --git a/slack_sdk/web/client.py b/slack_sdk/web/client.py index 5efbbd9ae..4c4c4e65e 100644 --- a/slack_sdk/web/client.py +++ b/slack_sdk/web/client.py @@ -2103,58 +2103,6 @@ def assistant_threads_setStatus( kwargs = _remove_none_values(kwargs) return self.api_call("assistant.threads.setStatus", json=kwargs) - def agents_sessions_rename( - self, - *, - channel_id: str, - title: str, - thread_ts: Optional[str] = None, - **kwargs, - ) -> SlackResponse: - """Renames an agent session. - https://docs.slack.dev/reference/methods/agents.sessions.rename - """ - kwargs.update( - { - "channel_id": channel_id, - "title": title, - "thread_ts": thread_ts, - } - ) - kwargs = _remove_none_values(kwargs) - return self.api_call("agents.sessions.rename", json=kwargs) - - def agents_sessions_setStatus( - self, - *, - channel_id: str, - status: str, - thread_ts: Optional[str] = None, - title: Optional[str] = None, - initiator_user_id: Optional[str] = None, - icon_emoji: Optional[str] = None, - icon_url: Optional[str] = None, - username: Optional[str] = None, - **kwargs, - ) -> SlackResponse: - """Sets the lifecycle status of an agent session, creating the session if it does not already exist. - https://docs.slack.dev/reference/methods/agents.sessions.setStatus - """ - kwargs.update( - { - "channel_id": channel_id, - "status": status, - "thread_ts": thread_ts, - "title": title, - "initiator_user_id": initiator_user_id, - "icon_emoji": icon_emoji, - "icon_url": icon_url, - "username": username, - } - ) - kwargs = _remove_none_values(kwargs) - return self.api_call("agents.sessions.setStatus", json=kwargs) - def agents_conversations_archive( self, *, @@ -2376,6 +2324,58 @@ def agents_conversations_setView( kwargs = _remove_none_values(kwargs) return self.api_call("agents.conversations.setView", json=kwargs) + def agents_sessions_rename( + self, + *, + channel_id: str, + title: str, + thread_ts: Optional[str] = None, + **kwargs, + ) -> SlackResponse: + """Renames an agent session. + https://docs.slack.dev/reference/methods/agents.sessions.rename + """ + kwargs.update( + { + "channel_id": channel_id, + "title": title, + "thread_ts": thread_ts, + } + ) + kwargs = _remove_none_values(kwargs) + return self.api_call("agents.sessions.rename", json=kwargs) + + def agents_sessions_setStatus( + self, + *, + channel_id: str, + status: str, + thread_ts: Optional[str] = None, + title: Optional[str] = None, + initiator_user_id: Optional[str] = None, + icon_emoji: Optional[str] = None, + icon_url: Optional[str] = None, + username: Optional[str] = None, + **kwargs, + ) -> SlackResponse: + """Sets the lifecycle status of an agent session, creating the session if it does not already exist. + https://docs.slack.dev/reference/methods/agents.sessions.setStatus + """ + kwargs.update( + { + "channel_id": channel_id, + "status": status, + "thread_ts": thread_ts, + "title": title, + "initiator_user_id": initiator_user_id, + "icon_emoji": icon_emoji, + "icon_url": icon_url, + "username": username, + } + ) + kwargs = _remove_none_values(kwargs) + return self.api_call("agents.sessions.setStatus", json=kwargs) + def assistant_threads_setTitle( self, *, diff --git a/slack_sdk/web/legacy_client.py b/slack_sdk/web/legacy_client.py index 78dd454c1..76b9c540b 100644 --- a/slack_sdk/web/legacy_client.py +++ b/slack_sdk/web/legacy_client.py @@ -2113,58 +2113,6 @@ def assistant_threads_setStatus( kwargs = _remove_none_values(kwargs) return self.api_call("assistant.threads.setStatus", json=kwargs) - def agents_sessions_rename( - self, - *, - channel_id: str, - title: str, - thread_ts: Optional[str] = None, - **kwargs, - ) -> Union[Future, SlackResponse]: - """Renames an agent session. - https://docs.slack.dev/reference/methods/agents.sessions.rename - """ - kwargs.update( - { - "channel_id": channel_id, - "title": title, - "thread_ts": thread_ts, - } - ) - kwargs = _remove_none_values(kwargs) - return self.api_call("agents.sessions.rename", json=kwargs) - - def agents_sessions_setStatus( - self, - *, - channel_id: str, - status: str, - thread_ts: Optional[str] = None, - title: Optional[str] = None, - initiator_user_id: Optional[str] = None, - icon_emoji: Optional[str] = None, - icon_url: Optional[str] = None, - username: Optional[str] = None, - **kwargs, - ) -> Union[Future, SlackResponse]: - """Sets the lifecycle status of an agent session, creating the session if it does not already exist. - https://docs.slack.dev/reference/methods/agents.sessions.setStatus - """ - kwargs.update( - { - "channel_id": channel_id, - "status": status, - "thread_ts": thread_ts, - "title": title, - "initiator_user_id": initiator_user_id, - "icon_emoji": icon_emoji, - "icon_url": icon_url, - "username": username, - } - ) - kwargs = _remove_none_values(kwargs) - return self.api_call("agents.sessions.setStatus", json=kwargs) - def agents_conversations_archive( self, *, @@ -2386,6 +2334,58 @@ def agents_conversations_setView( kwargs = _remove_none_values(kwargs) return self.api_call("agents.conversations.setView", json=kwargs) + def agents_sessions_rename( + self, + *, + channel_id: str, + title: str, + thread_ts: Optional[str] = None, + **kwargs, + ) -> Union[Future, SlackResponse]: + """Renames an agent session. + https://docs.slack.dev/reference/methods/agents.sessions.rename + """ + kwargs.update( + { + "channel_id": channel_id, + "title": title, + "thread_ts": thread_ts, + } + ) + kwargs = _remove_none_values(kwargs) + return self.api_call("agents.sessions.rename", json=kwargs) + + def agents_sessions_setStatus( + self, + *, + channel_id: str, + status: str, + thread_ts: Optional[str] = None, + title: Optional[str] = None, + initiator_user_id: Optional[str] = None, + icon_emoji: Optional[str] = None, + icon_url: Optional[str] = None, + username: Optional[str] = None, + **kwargs, + ) -> Union[Future, SlackResponse]: + """Sets the lifecycle status of an agent session, creating the session if it does not already exist. + https://docs.slack.dev/reference/methods/agents.sessions.setStatus + """ + kwargs.update( + { + "channel_id": channel_id, + "status": status, + "thread_ts": thread_ts, + "title": title, + "initiator_user_id": initiator_user_id, + "icon_emoji": icon_emoji, + "icon_url": icon_url, + "username": username, + } + ) + kwargs = _remove_none_values(kwargs) + return self.api_call("agents.sessions.setStatus", json=kwargs) + def assistant_threads_setTitle( self, *, From c11fbfe56520d9ac932f126b08672c51ad72046d Mon Sep 17 00:00:00 2001 From: Eden Zimbelman Date: Wed, 23 Sep 2026 14:49:06 -0700 Subject: [PATCH 06/11] refactor(web-api): move agents.* methods to their alphabetical slot Move the agents.* block (conversations then sessions) out of the assistant_threads_* family and into its natural a* slot before api_test, so assistant_threads_* is contiguous again. Also drop the code_channels:manage scope note from the 9 agents.conversations.* docstrings and the "takes channel, not channel_id" aside from getCanvas/setCanvasContent so the docstrings match the docs (scopes/args are documented there). Co-Authored-By: Claude Co-Authored-By: Claude Opus 4.8 (1M context) --- slack_sdk/web/async_client.py | 384 ++++++++++++++++----------------- slack_sdk/web/client.py | 384 ++++++++++++++++----------------- slack_sdk/web/legacy_client.py | 384 ++++++++++++++++----------------- 3 files changed, 564 insertions(+), 588 deletions(-) diff --git a/slack_sdk/web/async_client.py b/slack_sdk/web/async_client.py index d9006040c..cc32d9f23 100644 --- a/slack_sdk/web/async_client.py +++ b/slack_sdk/web/async_client.py @@ -1933,186 +1933,6 @@ async def admin_workflows_unpublish( kwargs.update({"workflow_ids": workflow_ids}) return await self.api_call("admin.workflows.unpublish", params=kwargs) - async def api_test( - self, - *, - error: Optional[str] = None, - **kwargs, - ) -> AsyncSlackResponse: - """Checks API calling code. - https://docs.slack.dev/reference/methods/api.test - """ - kwargs.update({"error": error}) - return await self.api_call("api.test", params=kwargs) - - async def apps_connections_open( - self, - *, - app_token: str, - **kwargs, - ) -> AsyncSlackResponse: - """Generate a temporary Socket Mode WebSocket URL that your app can connect to - in order to receive events and interactive payloads - https://docs.slack.dev/reference/methods/apps.connections.open - """ - kwargs.update({"token": app_token}) - return await self.api_call("apps.connections.open", http_verb="POST", params=kwargs) - - async def apps_event_authorizations_list( - self, - *, - event_context: str, - cursor: Optional[str] = None, - limit: Optional[int] = None, - **kwargs, - ) -> AsyncSlackResponse: - """Get a list of authorizations for the given event context. - Each authorization represents an app installation that the event is visible to. - https://docs.slack.dev/reference/methods/apps.event.authorizations.list - """ - kwargs.update({"event_context": event_context, "cursor": cursor, "limit": limit}) - return await self.api_call("apps.event.authorizations.list", params=kwargs) - - async def apps_uninstall( - self, - *, - client_id: str, - client_secret: str, - **kwargs, - ) -> AsyncSlackResponse: - """Uninstalls your app from a workspace. - https://docs.slack.dev/reference/methods/apps.uninstall - """ - kwargs.update({"client_id": client_id, "client_secret": client_secret}) - return await self.api_call("apps.uninstall", params=kwargs) - - async def apps_manifest_create( - self, - *, - manifest: Union[str, Dict[str, Any]], - **kwargs, - ) -> AsyncSlackResponse: - """Create an app from an app manifest - https://docs.slack.dev/reference/methods/apps.manifest.create - """ - if isinstance(manifest, str): - kwargs.update({"manifest": manifest}) - else: - kwargs.update({"manifest": json.dumps(manifest)}) - return await self.api_call("apps.manifest.create", params=kwargs) - - async def apps_manifest_delete( - self, - *, - app_id: str, - **kwargs, - ) -> AsyncSlackResponse: - """Permanently deletes an app created through app manifests - https://docs.slack.dev/reference/methods/apps.manifest.delete - """ - kwargs.update({"app_id": app_id}) - return await self.api_call("apps.manifest.delete", params=kwargs) - - async def apps_manifest_export( - self, - *, - app_id: str, - **kwargs, - ) -> AsyncSlackResponse: - """Export an app manifest from an existing app - https://docs.slack.dev/reference/methods/apps.manifest.export - """ - kwargs.update({"app_id": app_id}) - return await self.api_call("apps.manifest.export", params=kwargs) - - async def apps_manifest_update( - self, - *, - app_id: str, - manifest: Union[str, Dict[str, Any]], - **kwargs, - ) -> AsyncSlackResponse: - """Update an app from an app manifest - https://docs.slack.dev/reference/methods/apps.manifest.update - """ - if isinstance(manifest, str): - kwargs.update({"manifest": manifest}) - else: - kwargs.update({"manifest": json.dumps(manifest)}) - kwargs.update({"app_id": app_id}) - return await self.api_call("apps.manifest.update", params=kwargs) - - async def apps_manifest_validate( - self, - *, - manifest: Union[str, Dict[str, Any]], - app_id: Optional[str] = None, - **kwargs, - ) -> AsyncSlackResponse: - """Validate an app manifest - https://docs.slack.dev/reference/methods/apps.manifest.validate - """ - if isinstance(manifest, str): - kwargs.update({"manifest": manifest}) - else: - kwargs.update({"manifest": json.dumps(manifest)}) - kwargs.update({"app_id": app_id}) - return await self.api_call("apps.manifest.validate", params=kwargs) - - async def apps_user_connection_update( - self, - *, - user_id: str, - status: str, - **kwargs, - ) -> AsyncSlackResponse: - """Updates the connection status between a user and an app. - https://docs.slack.dev/reference/methods/apps.user.connection.update - """ - kwargs.update({"user_id": user_id, "status": status}) - return await self.api_call("apps.user.connection.update", params=kwargs) - - async def tooling_tokens_rotate( - self, - *, - refresh_token: str, - **kwargs, - ) -> AsyncSlackResponse: - """Exchanges a refresh token for a new app configuration token - https://docs.slack.dev/reference/methods/tooling.tokens.rotate - """ - kwargs.update({"refresh_token": refresh_token}) - return await self.api_call("tooling.tokens.rotate", params=kwargs) - - async def assistant_threads_setStatus( - self, - *, - channel_id: str, - thread_ts: str, - status: str, - loading_messages: Optional[List[str]] = None, - icon_emoji: Optional[str] = None, - icon_url: Optional[str] = None, - username: Optional[str] = None, - **kwargs, - ) -> AsyncSlackResponse: - """Set the status for an AI assistant thread. - https://docs.slack.dev/reference/methods/assistant.threads.setStatus - """ - kwargs.update( - { - "channel_id": channel_id, - "thread_ts": thread_ts, - "status": status, - "loading_messages": loading_messages, - "icon_emoji": icon_emoji, - "icon_url": icon_url, - "username": username, - } - ) - kwargs = _remove_none_values(kwargs) - return await self.api_call("assistant.threads.setStatus", json=kwargs) - async def agents_conversations_archive( self, *, @@ -2120,7 +1940,7 @@ async def agents_conversations_archive( summary_message_ts: Optional[str] = None, **kwargs, ) -> AsyncSlackResponse: - """Archive a code channel. Requires the ``code_channels:manage`` scope. + """Archive a code channel. https://docs.slack.dev/reference/methods/agents.conversations.archive """ kwargs.update( @@ -2143,8 +1963,7 @@ async def agents_conversations_create( origin_message_ts: Optional[str] = None, **kwargs, ) -> AsyncSlackResponse: - """Create a dedicated code channel for an agent session. Requires the - ``code_channels:manage`` scope. + """Create a dedicated code channel for an agent session. https://docs.slack.dev/reference/methods/agents.conversations.create """ kwargs.update( @@ -2169,9 +1988,7 @@ async def agents_conversations_getCanvas( include_resolved: Optional[bool] = None, **kwargs, ) -> AsyncSlackResponse: - """Fetch a canvas attached to a code channel. Requires the ``code_channels:manage`` scope. - - Note this method takes ``channel``, not ``channel_id``. + """Fetch a canvas attached to a code channel. https://docs.slack.dev/reference/methods/agents.conversations.getCanvas """ kwargs.update( @@ -2191,8 +2008,7 @@ async def agents_conversations_listViews( channel_id: Optional[str] = None, **kwargs, ) -> AsyncSlackResponse: - """List the views currently attached to a code channel. Requires the - ``code_channels:manage`` scope. + """List the views currently attached to a code channel. https://docs.slack.dev/reference/methods/agents.conversations.listViews """ kwargs.update({"channel_id": channel_id}) @@ -2207,7 +2023,7 @@ async def agents_conversations_removeView( view_id: Optional[str] = None, **kwargs, ) -> AsyncSlackResponse: - """Remove a view from a code channel. Requires the ``code_channels:manage`` scope. + """Remove a view from a code channel. Provide exactly one of ``view_key`` or ``view_id``. https://docs.slack.dev/reference/methods/agents.conversations.removeView @@ -2230,10 +2046,7 @@ async def agents_conversations_setCanvasContent( content: str, **kwargs, ) -> AsyncSlackResponse: - """Replace the full markdown content of a plan canvas attached to a code channel. Requires - the ``code_channels:manage`` scope. - - Note this method takes ``channel``, not ``channel_id``. + """Replace the full markdown content of a plan canvas attached to a code channel. https://docs.slack.dev/reference/methods/agents.conversations.setCanvasContent """ kwargs.update( @@ -2254,7 +2067,6 @@ async def agents_conversations_setCommands( **kwargs, ) -> AsyncSlackResponse: """Register the set of agent-defined slash commands for the calling agent in a code channel. - Requires the ``code_channels:manage`` scope. https://docs.slack.dev/reference/methods/agents.conversations.setCommands """ kwargs.update( @@ -2276,7 +2088,7 @@ async def agents_conversations_setProperties( agent_resource: Optional[Dict] = None, **kwargs, ) -> AsyncSlackResponse: - """Set properties on a code channel. Requires the ``code_channels:manage`` scope. + """Set properties on a code channel. https://docs.slack.dev/reference/methods/agents.conversations.setProperties """ kwargs.update( @@ -2310,7 +2122,7 @@ async def agents_conversations_setView( csp: Optional[Dict] = None, **kwargs, ) -> AsyncSlackResponse: - """Create or update a view in a code channel. Requires the ``code_channels:manage`` scope. + """Create or update a view in a code channel. https://docs.slack.dev/reference/methods/agents.conversations.setView """ kwargs.update( @@ -2386,6 +2198,186 @@ async def agents_sessions_setStatus( kwargs = _remove_none_values(kwargs) return await self.api_call("agents.sessions.setStatus", json=kwargs) + async def api_test( + self, + *, + error: Optional[str] = None, + **kwargs, + ) -> AsyncSlackResponse: + """Checks API calling code. + https://docs.slack.dev/reference/methods/api.test + """ + kwargs.update({"error": error}) + return await self.api_call("api.test", params=kwargs) + + async def apps_connections_open( + self, + *, + app_token: str, + **kwargs, + ) -> AsyncSlackResponse: + """Generate a temporary Socket Mode WebSocket URL that your app can connect to + in order to receive events and interactive payloads + https://docs.slack.dev/reference/methods/apps.connections.open + """ + kwargs.update({"token": app_token}) + return await self.api_call("apps.connections.open", http_verb="POST", params=kwargs) + + async def apps_event_authorizations_list( + self, + *, + event_context: str, + cursor: Optional[str] = None, + limit: Optional[int] = None, + **kwargs, + ) -> AsyncSlackResponse: + """Get a list of authorizations for the given event context. + Each authorization represents an app installation that the event is visible to. + https://docs.slack.dev/reference/methods/apps.event.authorizations.list + """ + kwargs.update({"event_context": event_context, "cursor": cursor, "limit": limit}) + return await self.api_call("apps.event.authorizations.list", params=kwargs) + + async def apps_uninstall( + self, + *, + client_id: str, + client_secret: str, + **kwargs, + ) -> AsyncSlackResponse: + """Uninstalls your app from a workspace. + https://docs.slack.dev/reference/methods/apps.uninstall + """ + kwargs.update({"client_id": client_id, "client_secret": client_secret}) + return await self.api_call("apps.uninstall", params=kwargs) + + async def apps_manifest_create( + self, + *, + manifest: Union[str, Dict[str, Any]], + **kwargs, + ) -> AsyncSlackResponse: + """Create an app from an app manifest + https://docs.slack.dev/reference/methods/apps.manifest.create + """ + if isinstance(manifest, str): + kwargs.update({"manifest": manifest}) + else: + kwargs.update({"manifest": json.dumps(manifest)}) + return await self.api_call("apps.manifest.create", params=kwargs) + + async def apps_manifest_delete( + self, + *, + app_id: str, + **kwargs, + ) -> AsyncSlackResponse: + """Permanently deletes an app created through app manifests + https://docs.slack.dev/reference/methods/apps.manifest.delete + """ + kwargs.update({"app_id": app_id}) + return await self.api_call("apps.manifest.delete", params=kwargs) + + async def apps_manifest_export( + self, + *, + app_id: str, + **kwargs, + ) -> AsyncSlackResponse: + """Export an app manifest from an existing app + https://docs.slack.dev/reference/methods/apps.manifest.export + """ + kwargs.update({"app_id": app_id}) + return await self.api_call("apps.manifest.export", params=kwargs) + + async def apps_manifest_update( + self, + *, + app_id: str, + manifest: Union[str, Dict[str, Any]], + **kwargs, + ) -> AsyncSlackResponse: + """Update an app from an app manifest + https://docs.slack.dev/reference/methods/apps.manifest.update + """ + if isinstance(manifest, str): + kwargs.update({"manifest": manifest}) + else: + kwargs.update({"manifest": json.dumps(manifest)}) + kwargs.update({"app_id": app_id}) + return await self.api_call("apps.manifest.update", params=kwargs) + + async def apps_manifest_validate( + self, + *, + manifest: Union[str, Dict[str, Any]], + app_id: Optional[str] = None, + **kwargs, + ) -> AsyncSlackResponse: + """Validate an app manifest + https://docs.slack.dev/reference/methods/apps.manifest.validate + """ + if isinstance(manifest, str): + kwargs.update({"manifest": manifest}) + else: + kwargs.update({"manifest": json.dumps(manifest)}) + kwargs.update({"app_id": app_id}) + return await self.api_call("apps.manifest.validate", params=kwargs) + + async def apps_user_connection_update( + self, + *, + user_id: str, + status: str, + **kwargs, + ) -> AsyncSlackResponse: + """Updates the connection status between a user and an app. + https://docs.slack.dev/reference/methods/apps.user.connection.update + """ + kwargs.update({"user_id": user_id, "status": status}) + return await self.api_call("apps.user.connection.update", params=kwargs) + + async def tooling_tokens_rotate( + self, + *, + refresh_token: str, + **kwargs, + ) -> AsyncSlackResponse: + """Exchanges a refresh token for a new app configuration token + https://docs.slack.dev/reference/methods/tooling.tokens.rotate + """ + kwargs.update({"refresh_token": refresh_token}) + return await self.api_call("tooling.tokens.rotate", params=kwargs) + + async def assistant_threads_setStatus( + self, + *, + channel_id: str, + thread_ts: str, + status: str, + loading_messages: Optional[List[str]] = None, + icon_emoji: Optional[str] = None, + icon_url: Optional[str] = None, + username: Optional[str] = None, + **kwargs, + ) -> AsyncSlackResponse: + """Set the status for an AI assistant thread. + https://docs.slack.dev/reference/methods/assistant.threads.setStatus + """ + kwargs.update( + { + "channel_id": channel_id, + "thread_ts": thread_ts, + "status": status, + "loading_messages": loading_messages, + "icon_emoji": icon_emoji, + "icon_url": icon_url, + "username": username, + } + ) + kwargs = _remove_none_values(kwargs) + return await self.api_call("assistant.threads.setStatus", json=kwargs) + async def assistant_threads_setTitle( self, *, diff --git a/slack_sdk/web/client.py b/slack_sdk/web/client.py index 4c4c4e65e..8707bc7c4 100644 --- a/slack_sdk/web/client.py +++ b/slack_sdk/web/client.py @@ -1923,186 +1923,6 @@ def admin_workflows_unpublish( kwargs.update({"workflow_ids": workflow_ids}) return self.api_call("admin.workflows.unpublish", params=kwargs) - def api_test( - self, - *, - error: Optional[str] = None, - **kwargs, - ) -> SlackResponse: - """Checks API calling code. - https://docs.slack.dev/reference/methods/api.test - """ - kwargs.update({"error": error}) - return self.api_call("api.test", params=kwargs) - - def apps_connections_open( - self, - *, - app_token: str, - **kwargs, - ) -> SlackResponse: - """Generate a temporary Socket Mode WebSocket URL that your app can connect to - in order to receive events and interactive payloads - https://docs.slack.dev/reference/methods/apps.connections.open - """ - kwargs.update({"token": app_token}) - return self.api_call("apps.connections.open", http_verb="POST", params=kwargs) - - def apps_event_authorizations_list( - self, - *, - event_context: str, - cursor: Optional[str] = None, - limit: Optional[int] = None, - **kwargs, - ) -> SlackResponse: - """Get a list of authorizations for the given event context. - Each authorization represents an app installation that the event is visible to. - https://docs.slack.dev/reference/methods/apps.event.authorizations.list - """ - kwargs.update({"event_context": event_context, "cursor": cursor, "limit": limit}) - return self.api_call("apps.event.authorizations.list", params=kwargs) - - def apps_uninstall( - self, - *, - client_id: str, - client_secret: str, - **kwargs, - ) -> SlackResponse: - """Uninstalls your app from a workspace. - https://docs.slack.dev/reference/methods/apps.uninstall - """ - kwargs.update({"client_id": client_id, "client_secret": client_secret}) - return self.api_call("apps.uninstall", params=kwargs) - - def apps_manifest_create( - self, - *, - manifest: Union[str, Dict[str, Any]], - **kwargs, - ) -> SlackResponse: - """Create an app from an app manifest - https://docs.slack.dev/reference/methods/apps.manifest.create - """ - if isinstance(manifest, str): - kwargs.update({"manifest": manifest}) - else: - kwargs.update({"manifest": json.dumps(manifest)}) - return self.api_call("apps.manifest.create", params=kwargs) - - def apps_manifest_delete( - self, - *, - app_id: str, - **kwargs, - ) -> SlackResponse: - """Permanently deletes an app created through app manifests - https://docs.slack.dev/reference/methods/apps.manifest.delete - """ - kwargs.update({"app_id": app_id}) - return self.api_call("apps.manifest.delete", params=kwargs) - - def apps_manifest_export( - self, - *, - app_id: str, - **kwargs, - ) -> SlackResponse: - """Export an app manifest from an existing app - https://docs.slack.dev/reference/methods/apps.manifest.export - """ - kwargs.update({"app_id": app_id}) - return self.api_call("apps.manifest.export", params=kwargs) - - def apps_manifest_update( - self, - *, - app_id: str, - manifest: Union[str, Dict[str, Any]], - **kwargs, - ) -> SlackResponse: - """Update an app from an app manifest - https://docs.slack.dev/reference/methods/apps.manifest.update - """ - if isinstance(manifest, str): - kwargs.update({"manifest": manifest}) - else: - kwargs.update({"manifest": json.dumps(manifest)}) - kwargs.update({"app_id": app_id}) - return self.api_call("apps.manifest.update", params=kwargs) - - def apps_manifest_validate( - self, - *, - manifest: Union[str, Dict[str, Any]], - app_id: Optional[str] = None, - **kwargs, - ) -> SlackResponse: - """Validate an app manifest - https://docs.slack.dev/reference/methods/apps.manifest.validate - """ - if isinstance(manifest, str): - kwargs.update({"manifest": manifest}) - else: - kwargs.update({"manifest": json.dumps(manifest)}) - kwargs.update({"app_id": app_id}) - return self.api_call("apps.manifest.validate", params=kwargs) - - def apps_user_connection_update( - self, - *, - user_id: str, - status: str, - **kwargs, - ) -> SlackResponse: - """Updates the connection status between a user and an app. - https://docs.slack.dev/reference/methods/apps.user.connection.update - """ - kwargs.update({"user_id": user_id, "status": status}) - return self.api_call("apps.user.connection.update", params=kwargs) - - def tooling_tokens_rotate( - self, - *, - refresh_token: str, - **kwargs, - ) -> SlackResponse: - """Exchanges a refresh token for a new app configuration token - https://docs.slack.dev/reference/methods/tooling.tokens.rotate - """ - kwargs.update({"refresh_token": refresh_token}) - return self.api_call("tooling.tokens.rotate", params=kwargs) - - def assistant_threads_setStatus( - self, - *, - channel_id: str, - thread_ts: str, - status: str, - loading_messages: Optional[List[str]] = None, - icon_emoji: Optional[str] = None, - icon_url: Optional[str] = None, - username: Optional[str] = None, - **kwargs, - ) -> SlackResponse: - """Set the status for an AI assistant thread. - https://docs.slack.dev/reference/methods/assistant.threads.setStatus - """ - kwargs.update( - { - "channel_id": channel_id, - "thread_ts": thread_ts, - "status": status, - "loading_messages": loading_messages, - "icon_emoji": icon_emoji, - "icon_url": icon_url, - "username": username, - } - ) - kwargs = _remove_none_values(kwargs) - return self.api_call("assistant.threads.setStatus", json=kwargs) - def agents_conversations_archive( self, *, @@ -2110,7 +1930,7 @@ def agents_conversations_archive( summary_message_ts: Optional[str] = None, **kwargs, ) -> SlackResponse: - """Archive a code channel. Requires the ``code_channels:manage`` scope. + """Archive a code channel. https://docs.slack.dev/reference/methods/agents.conversations.archive """ kwargs.update( @@ -2133,8 +1953,7 @@ def agents_conversations_create( origin_message_ts: Optional[str] = None, **kwargs, ) -> SlackResponse: - """Create a dedicated code channel for an agent session. Requires the - ``code_channels:manage`` scope. + """Create a dedicated code channel for an agent session. https://docs.slack.dev/reference/methods/agents.conversations.create """ kwargs.update( @@ -2159,9 +1978,7 @@ def agents_conversations_getCanvas( include_resolved: Optional[bool] = None, **kwargs, ) -> SlackResponse: - """Fetch a canvas attached to a code channel. Requires the ``code_channels:manage`` scope. - - Note this method takes ``channel``, not ``channel_id``. + """Fetch a canvas attached to a code channel. https://docs.slack.dev/reference/methods/agents.conversations.getCanvas """ kwargs.update( @@ -2181,8 +1998,7 @@ def agents_conversations_listViews( channel_id: Optional[str] = None, **kwargs, ) -> SlackResponse: - """List the views currently attached to a code channel. Requires the - ``code_channels:manage`` scope. + """List the views currently attached to a code channel. https://docs.slack.dev/reference/methods/agents.conversations.listViews """ kwargs.update({"channel_id": channel_id}) @@ -2197,7 +2013,7 @@ def agents_conversations_removeView( view_id: Optional[str] = None, **kwargs, ) -> SlackResponse: - """Remove a view from a code channel. Requires the ``code_channels:manage`` scope. + """Remove a view from a code channel. Provide exactly one of ``view_key`` or ``view_id``. https://docs.slack.dev/reference/methods/agents.conversations.removeView @@ -2220,10 +2036,7 @@ def agents_conversations_setCanvasContent( content: str, **kwargs, ) -> SlackResponse: - """Replace the full markdown content of a plan canvas attached to a code channel. Requires - the ``code_channels:manage`` scope. - - Note this method takes ``channel``, not ``channel_id``. + """Replace the full markdown content of a plan canvas attached to a code channel. https://docs.slack.dev/reference/methods/agents.conversations.setCanvasContent """ kwargs.update( @@ -2244,7 +2057,6 @@ def agents_conversations_setCommands( **kwargs, ) -> SlackResponse: """Register the set of agent-defined slash commands for the calling agent in a code channel. - Requires the ``code_channels:manage`` scope. https://docs.slack.dev/reference/methods/agents.conversations.setCommands """ kwargs.update( @@ -2266,7 +2078,7 @@ def agents_conversations_setProperties( agent_resource: Optional[Dict] = None, **kwargs, ) -> SlackResponse: - """Set properties on a code channel. Requires the ``code_channels:manage`` scope. + """Set properties on a code channel. https://docs.slack.dev/reference/methods/agents.conversations.setProperties """ kwargs.update( @@ -2300,7 +2112,7 @@ def agents_conversations_setView( csp: Optional[Dict] = None, **kwargs, ) -> SlackResponse: - """Create or update a view in a code channel. Requires the ``code_channels:manage`` scope. + """Create or update a view in a code channel. https://docs.slack.dev/reference/methods/agents.conversations.setView """ kwargs.update( @@ -2376,6 +2188,186 @@ def agents_sessions_setStatus( kwargs = _remove_none_values(kwargs) return self.api_call("agents.sessions.setStatus", json=kwargs) + def api_test( + self, + *, + error: Optional[str] = None, + **kwargs, + ) -> SlackResponse: + """Checks API calling code. + https://docs.slack.dev/reference/methods/api.test + """ + kwargs.update({"error": error}) + return self.api_call("api.test", params=kwargs) + + def apps_connections_open( + self, + *, + app_token: str, + **kwargs, + ) -> SlackResponse: + """Generate a temporary Socket Mode WebSocket URL that your app can connect to + in order to receive events and interactive payloads + https://docs.slack.dev/reference/methods/apps.connections.open + """ + kwargs.update({"token": app_token}) + return self.api_call("apps.connections.open", http_verb="POST", params=kwargs) + + def apps_event_authorizations_list( + self, + *, + event_context: str, + cursor: Optional[str] = None, + limit: Optional[int] = None, + **kwargs, + ) -> SlackResponse: + """Get a list of authorizations for the given event context. + Each authorization represents an app installation that the event is visible to. + https://docs.slack.dev/reference/methods/apps.event.authorizations.list + """ + kwargs.update({"event_context": event_context, "cursor": cursor, "limit": limit}) + return self.api_call("apps.event.authorizations.list", params=kwargs) + + def apps_uninstall( + self, + *, + client_id: str, + client_secret: str, + **kwargs, + ) -> SlackResponse: + """Uninstalls your app from a workspace. + https://docs.slack.dev/reference/methods/apps.uninstall + """ + kwargs.update({"client_id": client_id, "client_secret": client_secret}) + return self.api_call("apps.uninstall", params=kwargs) + + def apps_manifest_create( + self, + *, + manifest: Union[str, Dict[str, Any]], + **kwargs, + ) -> SlackResponse: + """Create an app from an app manifest + https://docs.slack.dev/reference/methods/apps.manifest.create + """ + if isinstance(manifest, str): + kwargs.update({"manifest": manifest}) + else: + kwargs.update({"manifest": json.dumps(manifest)}) + return self.api_call("apps.manifest.create", params=kwargs) + + def apps_manifest_delete( + self, + *, + app_id: str, + **kwargs, + ) -> SlackResponse: + """Permanently deletes an app created through app manifests + https://docs.slack.dev/reference/methods/apps.manifest.delete + """ + kwargs.update({"app_id": app_id}) + return self.api_call("apps.manifest.delete", params=kwargs) + + def apps_manifest_export( + self, + *, + app_id: str, + **kwargs, + ) -> SlackResponse: + """Export an app manifest from an existing app + https://docs.slack.dev/reference/methods/apps.manifest.export + """ + kwargs.update({"app_id": app_id}) + return self.api_call("apps.manifest.export", params=kwargs) + + def apps_manifest_update( + self, + *, + app_id: str, + manifest: Union[str, Dict[str, Any]], + **kwargs, + ) -> SlackResponse: + """Update an app from an app manifest + https://docs.slack.dev/reference/methods/apps.manifest.update + """ + if isinstance(manifest, str): + kwargs.update({"manifest": manifest}) + else: + kwargs.update({"manifest": json.dumps(manifest)}) + kwargs.update({"app_id": app_id}) + return self.api_call("apps.manifest.update", params=kwargs) + + def apps_manifest_validate( + self, + *, + manifest: Union[str, Dict[str, Any]], + app_id: Optional[str] = None, + **kwargs, + ) -> SlackResponse: + """Validate an app manifest + https://docs.slack.dev/reference/methods/apps.manifest.validate + """ + if isinstance(manifest, str): + kwargs.update({"manifest": manifest}) + else: + kwargs.update({"manifest": json.dumps(manifest)}) + kwargs.update({"app_id": app_id}) + return self.api_call("apps.manifest.validate", params=kwargs) + + def apps_user_connection_update( + self, + *, + user_id: str, + status: str, + **kwargs, + ) -> SlackResponse: + """Updates the connection status between a user and an app. + https://docs.slack.dev/reference/methods/apps.user.connection.update + """ + kwargs.update({"user_id": user_id, "status": status}) + return self.api_call("apps.user.connection.update", params=kwargs) + + def tooling_tokens_rotate( + self, + *, + refresh_token: str, + **kwargs, + ) -> SlackResponse: + """Exchanges a refresh token for a new app configuration token + https://docs.slack.dev/reference/methods/tooling.tokens.rotate + """ + kwargs.update({"refresh_token": refresh_token}) + return self.api_call("tooling.tokens.rotate", params=kwargs) + + def assistant_threads_setStatus( + self, + *, + channel_id: str, + thread_ts: str, + status: str, + loading_messages: Optional[List[str]] = None, + icon_emoji: Optional[str] = None, + icon_url: Optional[str] = None, + username: Optional[str] = None, + **kwargs, + ) -> SlackResponse: + """Set the status for an AI assistant thread. + https://docs.slack.dev/reference/methods/assistant.threads.setStatus + """ + kwargs.update( + { + "channel_id": channel_id, + "thread_ts": thread_ts, + "status": status, + "loading_messages": loading_messages, + "icon_emoji": icon_emoji, + "icon_url": icon_url, + "username": username, + } + ) + kwargs = _remove_none_values(kwargs) + return self.api_call("assistant.threads.setStatus", json=kwargs) + def assistant_threads_setTitle( self, *, diff --git a/slack_sdk/web/legacy_client.py b/slack_sdk/web/legacy_client.py index 76b9c540b..0455159c1 100644 --- a/slack_sdk/web/legacy_client.py +++ b/slack_sdk/web/legacy_client.py @@ -1933,186 +1933,6 @@ def admin_workflows_unpublish( kwargs.update({"workflow_ids": workflow_ids}) return self.api_call("admin.workflows.unpublish", params=kwargs) - def api_test( - self, - *, - error: Optional[str] = None, - **kwargs, - ) -> Union[Future, SlackResponse]: - """Checks API calling code. - https://docs.slack.dev/reference/methods/api.test - """ - kwargs.update({"error": error}) - return self.api_call("api.test", params=kwargs) - - def apps_connections_open( - self, - *, - app_token: str, - **kwargs, - ) -> Union[Future, SlackResponse]: - """Generate a temporary Socket Mode WebSocket URL that your app can connect to - in order to receive events and interactive payloads - https://docs.slack.dev/reference/methods/apps.connections.open - """ - kwargs.update({"token": app_token}) - return self.api_call("apps.connections.open", http_verb="POST", params=kwargs) - - def apps_event_authorizations_list( - self, - *, - event_context: str, - cursor: Optional[str] = None, - limit: Optional[int] = None, - **kwargs, - ) -> Union[Future, SlackResponse]: - """Get a list of authorizations for the given event context. - Each authorization represents an app installation that the event is visible to. - https://docs.slack.dev/reference/methods/apps.event.authorizations.list - """ - kwargs.update({"event_context": event_context, "cursor": cursor, "limit": limit}) - return self.api_call("apps.event.authorizations.list", params=kwargs) - - def apps_uninstall( - self, - *, - client_id: str, - client_secret: str, - **kwargs, - ) -> Union[Future, SlackResponse]: - """Uninstalls your app from a workspace. - https://docs.slack.dev/reference/methods/apps.uninstall - """ - kwargs.update({"client_id": client_id, "client_secret": client_secret}) - return self.api_call("apps.uninstall", params=kwargs) - - def apps_manifest_create( - self, - *, - manifest: Union[str, Dict[str, Any]], - **kwargs, - ) -> Union[Future, SlackResponse]: - """Create an app from an app manifest - https://docs.slack.dev/reference/methods/apps.manifest.create - """ - if isinstance(manifest, str): - kwargs.update({"manifest": manifest}) - else: - kwargs.update({"manifest": json.dumps(manifest)}) - return self.api_call("apps.manifest.create", params=kwargs) - - def apps_manifest_delete( - self, - *, - app_id: str, - **kwargs, - ) -> Union[Future, SlackResponse]: - """Permanently deletes an app created through app manifests - https://docs.slack.dev/reference/methods/apps.manifest.delete - """ - kwargs.update({"app_id": app_id}) - return self.api_call("apps.manifest.delete", params=kwargs) - - def apps_manifest_export( - self, - *, - app_id: str, - **kwargs, - ) -> Union[Future, SlackResponse]: - """Export an app manifest from an existing app - https://docs.slack.dev/reference/methods/apps.manifest.export - """ - kwargs.update({"app_id": app_id}) - return self.api_call("apps.manifest.export", params=kwargs) - - def apps_manifest_update( - self, - *, - app_id: str, - manifest: Union[str, Dict[str, Any]], - **kwargs, - ) -> Union[Future, SlackResponse]: - """Update an app from an app manifest - https://docs.slack.dev/reference/methods/apps.manifest.update - """ - if isinstance(manifest, str): - kwargs.update({"manifest": manifest}) - else: - kwargs.update({"manifest": json.dumps(manifest)}) - kwargs.update({"app_id": app_id}) - return self.api_call("apps.manifest.update", params=kwargs) - - def apps_manifest_validate( - self, - *, - manifest: Union[str, Dict[str, Any]], - app_id: Optional[str] = None, - **kwargs, - ) -> Union[Future, SlackResponse]: - """Validate an app manifest - https://docs.slack.dev/reference/methods/apps.manifest.validate - """ - if isinstance(manifest, str): - kwargs.update({"manifest": manifest}) - else: - kwargs.update({"manifest": json.dumps(manifest)}) - kwargs.update({"app_id": app_id}) - return self.api_call("apps.manifest.validate", params=kwargs) - - def apps_user_connection_update( - self, - *, - user_id: str, - status: str, - **kwargs, - ) -> Union[Future, SlackResponse]: - """Updates the connection status between a user and an app. - https://docs.slack.dev/reference/methods/apps.user.connection.update - """ - kwargs.update({"user_id": user_id, "status": status}) - return self.api_call("apps.user.connection.update", params=kwargs) - - def tooling_tokens_rotate( - self, - *, - refresh_token: str, - **kwargs, - ) -> Union[Future, SlackResponse]: - """Exchanges a refresh token for a new app configuration token - https://docs.slack.dev/reference/methods/tooling.tokens.rotate - """ - kwargs.update({"refresh_token": refresh_token}) - return self.api_call("tooling.tokens.rotate", params=kwargs) - - def assistant_threads_setStatus( - self, - *, - channel_id: str, - thread_ts: str, - status: str, - loading_messages: Optional[List[str]] = None, - icon_emoji: Optional[str] = None, - icon_url: Optional[str] = None, - username: Optional[str] = None, - **kwargs, - ) -> Union[Future, SlackResponse]: - """Set the status for an AI assistant thread. - https://docs.slack.dev/reference/methods/assistant.threads.setStatus - """ - kwargs.update( - { - "channel_id": channel_id, - "thread_ts": thread_ts, - "status": status, - "loading_messages": loading_messages, - "icon_emoji": icon_emoji, - "icon_url": icon_url, - "username": username, - } - ) - kwargs = _remove_none_values(kwargs) - return self.api_call("assistant.threads.setStatus", json=kwargs) - def agents_conversations_archive( self, *, @@ -2120,7 +1940,7 @@ def agents_conversations_archive( summary_message_ts: Optional[str] = None, **kwargs, ) -> Union[Future, SlackResponse]: - """Archive a code channel. Requires the ``code_channels:manage`` scope. + """Archive a code channel. https://docs.slack.dev/reference/methods/agents.conversations.archive """ kwargs.update( @@ -2143,8 +1963,7 @@ def agents_conversations_create( origin_message_ts: Optional[str] = None, **kwargs, ) -> Union[Future, SlackResponse]: - """Create a dedicated code channel for an agent session. Requires the - ``code_channels:manage`` scope. + """Create a dedicated code channel for an agent session. https://docs.slack.dev/reference/methods/agents.conversations.create """ kwargs.update( @@ -2169,9 +1988,7 @@ def agents_conversations_getCanvas( include_resolved: Optional[bool] = None, **kwargs, ) -> Union[Future, SlackResponse]: - """Fetch a canvas attached to a code channel. Requires the ``code_channels:manage`` scope. - - Note this method takes ``channel``, not ``channel_id``. + """Fetch a canvas attached to a code channel. https://docs.slack.dev/reference/methods/agents.conversations.getCanvas """ kwargs.update( @@ -2191,8 +2008,7 @@ def agents_conversations_listViews( channel_id: Optional[str] = None, **kwargs, ) -> Union[Future, SlackResponse]: - """List the views currently attached to a code channel. Requires the - ``code_channels:manage`` scope. + """List the views currently attached to a code channel. https://docs.slack.dev/reference/methods/agents.conversations.listViews """ kwargs.update({"channel_id": channel_id}) @@ -2207,7 +2023,7 @@ def agents_conversations_removeView( view_id: Optional[str] = None, **kwargs, ) -> Union[Future, SlackResponse]: - """Remove a view from a code channel. Requires the ``code_channels:manage`` scope. + """Remove a view from a code channel. Provide exactly one of ``view_key`` or ``view_id``. https://docs.slack.dev/reference/methods/agents.conversations.removeView @@ -2230,10 +2046,7 @@ def agents_conversations_setCanvasContent( content: str, **kwargs, ) -> Union[Future, SlackResponse]: - """Replace the full markdown content of a plan canvas attached to a code channel. Requires - the ``code_channels:manage`` scope. - - Note this method takes ``channel``, not ``channel_id``. + """Replace the full markdown content of a plan canvas attached to a code channel. https://docs.slack.dev/reference/methods/agents.conversations.setCanvasContent """ kwargs.update( @@ -2254,7 +2067,6 @@ def agents_conversations_setCommands( **kwargs, ) -> Union[Future, SlackResponse]: """Register the set of agent-defined slash commands for the calling agent in a code channel. - Requires the ``code_channels:manage`` scope. https://docs.slack.dev/reference/methods/agents.conversations.setCommands """ kwargs.update( @@ -2276,7 +2088,7 @@ def agents_conversations_setProperties( agent_resource: Optional[Dict] = None, **kwargs, ) -> Union[Future, SlackResponse]: - """Set properties on a code channel. Requires the ``code_channels:manage`` scope. + """Set properties on a code channel. https://docs.slack.dev/reference/methods/agents.conversations.setProperties """ kwargs.update( @@ -2310,7 +2122,7 @@ def agents_conversations_setView( csp: Optional[Dict] = None, **kwargs, ) -> Union[Future, SlackResponse]: - """Create or update a view in a code channel. Requires the ``code_channels:manage`` scope. + """Create or update a view in a code channel. https://docs.slack.dev/reference/methods/agents.conversations.setView """ kwargs.update( @@ -2386,6 +2198,186 @@ def agents_sessions_setStatus( kwargs = _remove_none_values(kwargs) return self.api_call("agents.sessions.setStatus", json=kwargs) + def api_test( + self, + *, + error: Optional[str] = None, + **kwargs, + ) -> Union[Future, SlackResponse]: + """Checks API calling code. + https://docs.slack.dev/reference/methods/api.test + """ + kwargs.update({"error": error}) + return self.api_call("api.test", params=kwargs) + + def apps_connections_open( + self, + *, + app_token: str, + **kwargs, + ) -> Union[Future, SlackResponse]: + """Generate a temporary Socket Mode WebSocket URL that your app can connect to + in order to receive events and interactive payloads + https://docs.slack.dev/reference/methods/apps.connections.open + """ + kwargs.update({"token": app_token}) + return self.api_call("apps.connections.open", http_verb="POST", params=kwargs) + + def apps_event_authorizations_list( + self, + *, + event_context: str, + cursor: Optional[str] = None, + limit: Optional[int] = None, + **kwargs, + ) -> Union[Future, SlackResponse]: + """Get a list of authorizations for the given event context. + Each authorization represents an app installation that the event is visible to. + https://docs.slack.dev/reference/methods/apps.event.authorizations.list + """ + kwargs.update({"event_context": event_context, "cursor": cursor, "limit": limit}) + return self.api_call("apps.event.authorizations.list", params=kwargs) + + def apps_uninstall( + self, + *, + client_id: str, + client_secret: str, + **kwargs, + ) -> Union[Future, SlackResponse]: + """Uninstalls your app from a workspace. + https://docs.slack.dev/reference/methods/apps.uninstall + """ + kwargs.update({"client_id": client_id, "client_secret": client_secret}) + return self.api_call("apps.uninstall", params=kwargs) + + def apps_manifest_create( + self, + *, + manifest: Union[str, Dict[str, Any]], + **kwargs, + ) -> Union[Future, SlackResponse]: + """Create an app from an app manifest + https://docs.slack.dev/reference/methods/apps.manifest.create + """ + if isinstance(manifest, str): + kwargs.update({"manifest": manifest}) + else: + kwargs.update({"manifest": json.dumps(manifest)}) + return self.api_call("apps.manifest.create", params=kwargs) + + def apps_manifest_delete( + self, + *, + app_id: str, + **kwargs, + ) -> Union[Future, SlackResponse]: + """Permanently deletes an app created through app manifests + https://docs.slack.dev/reference/methods/apps.manifest.delete + """ + kwargs.update({"app_id": app_id}) + return self.api_call("apps.manifest.delete", params=kwargs) + + def apps_manifest_export( + self, + *, + app_id: str, + **kwargs, + ) -> Union[Future, SlackResponse]: + """Export an app manifest from an existing app + https://docs.slack.dev/reference/methods/apps.manifest.export + """ + kwargs.update({"app_id": app_id}) + return self.api_call("apps.manifest.export", params=kwargs) + + def apps_manifest_update( + self, + *, + app_id: str, + manifest: Union[str, Dict[str, Any]], + **kwargs, + ) -> Union[Future, SlackResponse]: + """Update an app from an app manifest + https://docs.slack.dev/reference/methods/apps.manifest.update + """ + if isinstance(manifest, str): + kwargs.update({"manifest": manifest}) + else: + kwargs.update({"manifest": json.dumps(manifest)}) + kwargs.update({"app_id": app_id}) + return self.api_call("apps.manifest.update", params=kwargs) + + def apps_manifest_validate( + self, + *, + manifest: Union[str, Dict[str, Any]], + app_id: Optional[str] = None, + **kwargs, + ) -> Union[Future, SlackResponse]: + """Validate an app manifest + https://docs.slack.dev/reference/methods/apps.manifest.validate + """ + if isinstance(manifest, str): + kwargs.update({"manifest": manifest}) + else: + kwargs.update({"manifest": json.dumps(manifest)}) + kwargs.update({"app_id": app_id}) + return self.api_call("apps.manifest.validate", params=kwargs) + + def apps_user_connection_update( + self, + *, + user_id: str, + status: str, + **kwargs, + ) -> Union[Future, SlackResponse]: + """Updates the connection status between a user and an app. + https://docs.slack.dev/reference/methods/apps.user.connection.update + """ + kwargs.update({"user_id": user_id, "status": status}) + return self.api_call("apps.user.connection.update", params=kwargs) + + def tooling_tokens_rotate( + self, + *, + refresh_token: str, + **kwargs, + ) -> Union[Future, SlackResponse]: + """Exchanges a refresh token for a new app configuration token + https://docs.slack.dev/reference/methods/tooling.tokens.rotate + """ + kwargs.update({"refresh_token": refresh_token}) + return self.api_call("tooling.tokens.rotate", params=kwargs) + + def assistant_threads_setStatus( + self, + *, + channel_id: str, + thread_ts: str, + status: str, + loading_messages: Optional[List[str]] = None, + icon_emoji: Optional[str] = None, + icon_url: Optional[str] = None, + username: Optional[str] = None, + **kwargs, + ) -> Union[Future, SlackResponse]: + """Set the status for an AI assistant thread. + https://docs.slack.dev/reference/methods/assistant.threads.setStatus + """ + kwargs.update( + { + "channel_id": channel_id, + "thread_ts": thread_ts, + "status": status, + "loading_messages": loading_messages, + "icon_emoji": icon_emoji, + "icon_url": icon_url, + "username": username, + } + ) + kwargs = _remove_none_values(kwargs) + return self.api_call("assistant.threads.setStatus", json=kwargs) + def assistant_threads_setTitle( self, *, From 330a5651bfc26fe9892a937d17ee5e782568afd9 Mon Sep 17 00:00:00 2001 From: Eden Zimbelman Date: Wed, 23 Sep 2026 15:29:56 -0700 Subject: [PATCH 07/11] refactor(web-api): make code channel identifiers required per review Address inline review feedback on the agents.conversations.* methods: make the identifying argument a required typed param instead of an optional one, moving it to the front of the keyword-only args. - agents.conversations.archive: channel_id now required - agents.conversations.create: name now required (the API allows omitting it when origin_channel_id + origin_message_ts are given, but require it for a clearer default DX) - agents.conversations.listViews: channel_id now required - agents.conversations.removeView: channel_id now required - agents.conversations.setCommands: channel_id now required - agents.conversations.setProperties: channel_id now required - agents.conversations.setView: channel_id now required Also drop the "Provide exactly one of view_key or view_id" line from removeView's docstring, and add the summary/description blank line the merged-in docstring style now expects (ruff D205/D415). Regenerated async_client.py and legacy_client.py via scripts/codegen.py. Co-Authored-By: Claude Co-Authored-By: Claude Opus 4.8 (1M context) --- slack_sdk/web/async_client.py | 23 +++++++++++++++-------- slack_sdk/web/client.py | 23 +++++++++++++++-------- slack_sdk/web/legacy_client.py | 23 +++++++++++++++-------- 3 files changed, 45 insertions(+), 24 deletions(-) diff --git a/slack_sdk/web/async_client.py b/slack_sdk/web/async_client.py index 493a18929..5b6b897e6 100644 --- a/slack_sdk/web/async_client.py +++ b/slack_sdk/web/async_client.py @@ -2032,11 +2032,12 @@ async def admin_workflows_unpublish( async def agents_conversations_archive( self, *, - channel_id: Optional[str] = None, + channel_id: str, summary_message_ts: Optional[str] = None, **kwargs, ) -> AsyncSlackResponse: """Archive a code channel. + https://docs.slack.dev/reference/methods/agents.conversations.archive """ kwargs.update( @@ -2051,15 +2052,16 @@ async def agents_conversations_archive( async def agents_conversations_create( self, *, + name: str, team_id: Optional[str] = None, session_id: Optional[str] = None, - name: Optional[str] = None, is_private: Optional[bool] = None, origin_channel_id: Optional[str] = None, origin_message_ts: Optional[str] = None, **kwargs, ) -> AsyncSlackResponse: """Create a dedicated code channel for an agent session. + https://docs.slack.dev/reference/methods/agents.conversations.create """ kwargs.update( @@ -2085,6 +2087,7 @@ async def agents_conversations_getCanvas( **kwargs, ) -> AsyncSlackResponse: """Fetch a canvas attached to a code channel. + https://docs.slack.dev/reference/methods/agents.conversations.getCanvas """ kwargs.update( @@ -2101,10 +2104,11 @@ async def agents_conversations_getCanvas( async def agents_conversations_listViews( self, *, - channel_id: Optional[str] = None, + channel_id: str, **kwargs, ) -> AsyncSlackResponse: """List the views currently attached to a code channel. + https://docs.slack.dev/reference/methods/agents.conversations.listViews """ kwargs.update({"channel_id": channel_id}) @@ -2114,14 +2118,13 @@ async def agents_conversations_listViews( async def agents_conversations_removeView( self, *, - channel_id: Optional[str] = None, + channel_id: str, view_key: Optional[str] = None, view_id: Optional[str] = None, **kwargs, ) -> AsyncSlackResponse: """Remove a view from a code channel. - Provide exactly one of ``view_key`` or ``view_id``. https://docs.slack.dev/reference/methods/agents.conversations.removeView """ kwargs.update( @@ -2143,6 +2146,7 @@ async def agents_conversations_setCanvasContent( **kwargs, ) -> AsyncSlackResponse: """Replace the full markdown content of a plan canvas attached to a code channel. + https://docs.slack.dev/reference/methods/agents.conversations.setCanvasContent """ kwargs.update( @@ -2158,11 +2162,12 @@ async def agents_conversations_setCanvasContent( async def agents_conversations_setCommands( self, *, + channel_id: str, commands: Sequence[Dict], - channel_id: Optional[str] = None, **kwargs, ) -> AsyncSlackResponse: """Register the set of agent-defined slash commands for the calling agent in a code channel. + https://docs.slack.dev/reference/methods/agents.conversations.setCommands """ kwargs.update( @@ -2177,7 +2182,7 @@ async def agents_conversations_setCommands( async def agents_conversations_setProperties( self, *, - channel_id: Optional[str] = None, + channel_id: str, title: Optional[str] = None, status: Optional[str] = None, code_channel: Optional[Dict] = None, @@ -2185,6 +2190,7 @@ async def agents_conversations_setProperties( **kwargs, ) -> AsyncSlackResponse: """Set properties on a code channel. + https://docs.slack.dev/reference/methods/agents.conversations.setProperties """ kwargs.update( @@ -2202,7 +2208,7 @@ async def agents_conversations_setProperties( async def agents_conversations_setView( self, *, - channel_id: Optional[str] = None, + channel_id: str, type: Optional[str] = None, view_key: Optional[str] = None, content: Optional[str] = None, @@ -2219,6 +2225,7 @@ async def agents_conversations_setView( **kwargs, ) -> AsyncSlackResponse: """Create or update a view in a code channel. + https://docs.slack.dev/reference/methods/agents.conversations.setView """ kwargs.update( diff --git a/slack_sdk/web/client.py b/slack_sdk/web/client.py index b0ddade1c..e5f629425 100644 --- a/slack_sdk/web/client.py +++ b/slack_sdk/web/client.py @@ -2022,11 +2022,12 @@ def admin_workflows_unpublish( def agents_conversations_archive( self, *, - channel_id: Optional[str] = None, + channel_id: str, summary_message_ts: Optional[str] = None, **kwargs, ) -> SlackResponse: """Archive a code channel. + https://docs.slack.dev/reference/methods/agents.conversations.archive """ kwargs.update( @@ -2041,15 +2042,16 @@ def agents_conversations_archive( def agents_conversations_create( self, *, + name: str, team_id: Optional[str] = None, session_id: Optional[str] = None, - name: Optional[str] = None, is_private: Optional[bool] = None, origin_channel_id: Optional[str] = None, origin_message_ts: Optional[str] = None, **kwargs, ) -> SlackResponse: """Create a dedicated code channel for an agent session. + https://docs.slack.dev/reference/methods/agents.conversations.create """ kwargs.update( @@ -2075,6 +2077,7 @@ def agents_conversations_getCanvas( **kwargs, ) -> SlackResponse: """Fetch a canvas attached to a code channel. + https://docs.slack.dev/reference/methods/agents.conversations.getCanvas """ kwargs.update( @@ -2091,10 +2094,11 @@ def agents_conversations_getCanvas( def agents_conversations_listViews( self, *, - channel_id: Optional[str] = None, + channel_id: str, **kwargs, ) -> SlackResponse: """List the views currently attached to a code channel. + https://docs.slack.dev/reference/methods/agents.conversations.listViews """ kwargs.update({"channel_id": channel_id}) @@ -2104,14 +2108,13 @@ def agents_conversations_listViews( def agents_conversations_removeView( self, *, - channel_id: Optional[str] = None, + channel_id: str, view_key: Optional[str] = None, view_id: Optional[str] = None, **kwargs, ) -> SlackResponse: """Remove a view from a code channel. - Provide exactly one of ``view_key`` or ``view_id``. https://docs.slack.dev/reference/methods/agents.conversations.removeView """ kwargs.update( @@ -2133,6 +2136,7 @@ def agents_conversations_setCanvasContent( **kwargs, ) -> SlackResponse: """Replace the full markdown content of a plan canvas attached to a code channel. + https://docs.slack.dev/reference/methods/agents.conversations.setCanvasContent """ kwargs.update( @@ -2148,11 +2152,12 @@ def agents_conversations_setCanvasContent( def agents_conversations_setCommands( self, *, + channel_id: str, commands: Sequence[Dict], - channel_id: Optional[str] = None, **kwargs, ) -> SlackResponse: """Register the set of agent-defined slash commands for the calling agent in a code channel. + https://docs.slack.dev/reference/methods/agents.conversations.setCommands """ kwargs.update( @@ -2167,7 +2172,7 @@ def agents_conversations_setCommands( def agents_conversations_setProperties( self, *, - channel_id: Optional[str] = None, + channel_id: str, title: Optional[str] = None, status: Optional[str] = None, code_channel: Optional[Dict] = None, @@ -2175,6 +2180,7 @@ def agents_conversations_setProperties( **kwargs, ) -> SlackResponse: """Set properties on a code channel. + https://docs.slack.dev/reference/methods/agents.conversations.setProperties """ kwargs.update( @@ -2192,7 +2198,7 @@ def agents_conversations_setProperties( def agents_conversations_setView( self, *, - channel_id: Optional[str] = None, + channel_id: str, type: Optional[str] = None, view_key: Optional[str] = None, content: Optional[str] = None, @@ -2209,6 +2215,7 @@ def agents_conversations_setView( **kwargs, ) -> SlackResponse: """Create or update a view in a code channel. + https://docs.slack.dev/reference/methods/agents.conversations.setView """ kwargs.update( diff --git a/slack_sdk/web/legacy_client.py b/slack_sdk/web/legacy_client.py index f0791c2f5..da93421e7 100644 --- a/slack_sdk/web/legacy_client.py +++ b/slack_sdk/web/legacy_client.py @@ -2033,11 +2033,12 @@ def admin_workflows_unpublish( def agents_conversations_archive( self, *, - channel_id: Optional[str] = None, + channel_id: str, summary_message_ts: Optional[str] = None, **kwargs, ) -> Union[Future, SlackResponse]: """Archive a code channel. + https://docs.slack.dev/reference/methods/agents.conversations.archive """ kwargs.update( @@ -2052,15 +2053,16 @@ def agents_conversations_archive( def agents_conversations_create( self, *, + name: str, team_id: Optional[str] = None, session_id: Optional[str] = None, - name: Optional[str] = None, is_private: Optional[bool] = None, origin_channel_id: Optional[str] = None, origin_message_ts: Optional[str] = None, **kwargs, ) -> Union[Future, SlackResponse]: """Create a dedicated code channel for an agent session. + https://docs.slack.dev/reference/methods/agents.conversations.create """ kwargs.update( @@ -2086,6 +2088,7 @@ def agents_conversations_getCanvas( **kwargs, ) -> Union[Future, SlackResponse]: """Fetch a canvas attached to a code channel. + https://docs.slack.dev/reference/methods/agents.conversations.getCanvas """ kwargs.update( @@ -2102,10 +2105,11 @@ def agents_conversations_getCanvas( def agents_conversations_listViews( self, *, - channel_id: Optional[str] = None, + channel_id: str, **kwargs, ) -> Union[Future, SlackResponse]: """List the views currently attached to a code channel. + https://docs.slack.dev/reference/methods/agents.conversations.listViews """ kwargs.update({"channel_id": channel_id}) @@ -2115,14 +2119,13 @@ def agents_conversations_listViews( def agents_conversations_removeView( self, *, - channel_id: Optional[str] = None, + channel_id: str, view_key: Optional[str] = None, view_id: Optional[str] = None, **kwargs, ) -> Union[Future, SlackResponse]: """Remove a view from a code channel. - Provide exactly one of ``view_key`` or ``view_id``. https://docs.slack.dev/reference/methods/agents.conversations.removeView """ kwargs.update( @@ -2144,6 +2147,7 @@ def agents_conversations_setCanvasContent( **kwargs, ) -> Union[Future, SlackResponse]: """Replace the full markdown content of a plan canvas attached to a code channel. + https://docs.slack.dev/reference/methods/agents.conversations.setCanvasContent """ kwargs.update( @@ -2159,11 +2163,12 @@ def agents_conversations_setCanvasContent( def agents_conversations_setCommands( self, *, + channel_id: str, commands: Sequence[Dict], - channel_id: Optional[str] = None, **kwargs, ) -> Union[Future, SlackResponse]: """Register the set of agent-defined slash commands for the calling agent in a code channel. + https://docs.slack.dev/reference/methods/agents.conversations.setCommands """ kwargs.update( @@ -2178,7 +2183,7 @@ def agents_conversations_setCommands( def agents_conversations_setProperties( self, *, - channel_id: Optional[str] = None, + channel_id: str, title: Optional[str] = None, status: Optional[str] = None, code_channel: Optional[Dict] = None, @@ -2186,6 +2191,7 @@ def agents_conversations_setProperties( **kwargs, ) -> Union[Future, SlackResponse]: """Set properties on a code channel. + https://docs.slack.dev/reference/methods/agents.conversations.setProperties """ kwargs.update( @@ -2203,7 +2209,7 @@ def agents_conversations_setProperties( def agents_conversations_setView( self, *, - channel_id: Optional[str] = None, + channel_id: str, type: Optional[str] = None, view_key: Optional[str] = None, content: Optional[str] = None, @@ -2220,6 +2226,7 @@ def agents_conversations_setView( **kwargs, ) -> Union[Future, SlackResponse]: """Create or update a view in a code channel. + https://docs.slack.dev/reference/methods/agents.conversations.setView """ kwargs.update( From f6eccc7c141be57b9ed5db9200d4e732564a3e96 Mon Sep 17 00:00:00 2001 From: Eden Zimbelman Date: Wed, 23 Sep 2026 16:08:51 -0700 Subject: [PATCH 08/11] test(web-api): dedupe + order agents.* coverage cases The main merge left a stale duplicate agents_sessions_* elif pair (dead code, unreachable after the first match). Remove it, and order the agents.* coverage branches conversations-then-sessions to match the client method ordering. Co-Authored-By: Claude Co-Authored-By: Claude Opus 4.8 (1M context) --- .../web/test_web_client_coverage.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/tests/slack_sdk_async/web/test_web_client_coverage.py b/tests/slack_sdk_async/web/test_web_client_coverage.py index 353e6ee46..38c51feac 100644 --- a/tests/slack_sdk_async/web/test_web_client_coverage.py +++ b/tests/slack_sdk_async/web/test_web_client_coverage.py @@ -93,12 +93,6 @@ async def run_method(self, method_name, method, async_method): method(app_id="AID123", enterprise_id="E111", team_ids=["T1", "T2"])["method"] ) await async_method(app_id="AID123", enterprise_id="E111", team_ids=["T1", "T2"]) - elif method_name == "agents_sessions_rename": - self.api_methods_to_call.remove(method(channel_id="C123", title="New title")["method"]) - await async_method(channel_id="C123", title="New title") - elif method_name == "agents_sessions_setStatus": - self.api_methods_to_call.remove(method(channel_id="C123", status="processing")["method"]) - await async_method(channel_id="C123", status="processing") elif method_name == "apps_manifest_create": self.api_methods_to_call.remove(method(manifest="{}")["method"]) await async_method(manifest="{}") @@ -1169,12 +1163,6 @@ async def run_method(self, method_name, method, async_method): elif method_name == "users_discoverableContacts_lookup": self.api_methods_to_call.remove(method(email="foo@example.com")["method"]) await async_method(email="foo@example.com") - elif method_name == "agents_sessions_rename": - self.api_methods_to_call.remove(method(channel_id="C123", title="New title")["method"]) - await async_method(channel_id="C123", title="New title") - elif method_name == "agents_sessions_setStatus": - self.api_methods_to_call.remove(method(channel_id="C123", status="processing")["method"]) - await async_method(channel_id="C123", status="processing") elif method_name == "agents_conversations_archive": self.api_methods_to_call.remove(method(channel_id="C123")["method"]) await async_method(channel_id="C123") @@ -1204,6 +1192,12 @@ async def run_method(self, method_name, method, async_method): elif method_name == "agents_conversations_setView": self.api_methods_to_call.remove(method(channel_id="C123", type="diff")["method"]) await async_method(channel_id="C123", type="diff") + elif method_name == "agents_sessions_rename": + self.api_methods_to_call.remove(method(channel_id="C123", title="New title")["method"]) + await async_method(channel_id="C123", title="New title") + elif method_name == "agents_sessions_setStatus": + self.api_methods_to_call.remove(method(channel_id="C123", status="processing")["method"]) + await async_method(channel_id="C123", status="processing") else: self.api_methods_to_call.remove(method(*{})["method"]) await async_method(*{}) From 396a3e5ec8dbad7b35500b017f239feb2a390047 Mon Sep 17 00:00:00 2001 From: Eden Zimbelman Date: Thu, 24 Sep 2026 10:13:54 -0700 Subject: [PATCH 09/11] test(web-api): group agents.* coverage cases with the method list order Move the agents.conversations.*/agents.sessions.* coverage elif cases up beside the admin.*/apps.* cluster so they sit where agents.* appears in all_api_methods, instead of trailing after users.discoverableContacts. Pure reorder; no argument changes. Co-Authored-By: Claude Co-Authored-By: Claude Opus 4.8 (1M context) --- .../web/test_web_client_coverage.py | 70 +++++++++---------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/tests/slack_sdk_async/web/test_web_client_coverage.py b/tests/slack_sdk_async/web/test_web_client_coverage.py index 38c51feac..5ddbda5ad 100644 --- a/tests/slack_sdk_async/web/test_web_client_coverage.py +++ b/tests/slack_sdk_async/web/test_web_client_coverage.py @@ -93,6 +93,41 @@ async def run_method(self, method_name, method, async_method): method(app_id="AID123", enterprise_id="E111", team_ids=["T1", "T2"])["method"] ) await async_method(app_id="AID123", enterprise_id="E111", team_ids=["T1", "T2"]) + elif method_name == "agents_conversations_archive": + self.api_methods_to_call.remove(method(channel_id="C123")["method"]) + await async_method(channel_id="C123") + elif method_name == "agents_conversations_create": + self.api_methods_to_call.remove( + method(name="Fix flaky test", origin_channel_id="C123", origin_message_ts="1717171717.123456")["method"] + ) + await async_method(name="Fix flaky test", origin_channel_id="C123", origin_message_ts="1717171717.123456") + elif method_name == "agents_conversations_getCanvas": + self.api_methods_to_call.remove(method(channel="C123", canvas_id="F123")["method"]) + await async_method(channel="C123", canvas_id="F123") + elif method_name == "agents_conversations_listViews": + self.api_methods_to_call.remove(method(channel_id="C123")["method"]) + await async_method(channel_id="C123") + elif method_name == "agents_conversations_removeView": + self.api_methods_to_call.remove(method(channel_id="C123", view_id="V123")["method"]) + await async_method(channel_id="C123", view_id="V123") + elif method_name == "agents_conversations_setCanvasContent": + self.api_methods_to_call.remove(method(channel="C123", canvas_id="F123", content="# Plan")["method"]) + await async_method(channel="C123", canvas_id="F123", content="# Plan") + elif method_name == "agents_conversations_setCommands": + self.api_methods_to_call.remove(method(channel_id="C123", commands=[])["method"]) + await async_method(channel_id="C123", commands=[]) + elif method_name == "agents_conversations_setProperties": + self.api_methods_to_call.remove(method(channel_id="C123")["method"]) + await async_method(channel_id="C123") + elif method_name == "agents_conversations_setView": + self.api_methods_to_call.remove(method(channel_id="C123", type="diff")["method"]) + await async_method(channel_id="C123", type="diff") + elif method_name == "agents_sessions_rename": + self.api_methods_to_call.remove(method(channel_id="C123", title="New title")["method"]) + await async_method(channel_id="C123", title="New title") + elif method_name == "agents_sessions_setStatus": + self.api_methods_to_call.remove(method(channel_id="C123", status="processing")["method"]) + await async_method(channel_id="C123", status="processing") elif method_name == "apps_manifest_create": self.api_methods_to_call.remove(method(manifest="{}")["method"]) await async_method(manifest="{}") @@ -1163,41 +1198,6 @@ async def run_method(self, method_name, method, async_method): elif method_name == "users_discoverableContacts_lookup": self.api_methods_to_call.remove(method(email="foo@example.com")["method"]) await async_method(email="foo@example.com") - elif method_name == "agents_conversations_archive": - self.api_methods_to_call.remove(method(channel_id="C123")["method"]) - await async_method(channel_id="C123") - elif method_name == "agents_conversations_create": - self.api_methods_to_call.remove( - method(name="Fix flaky test", origin_channel_id="C123", origin_message_ts="1717171717.123456")["method"] - ) - await async_method(name="Fix flaky test", origin_channel_id="C123", origin_message_ts="1717171717.123456") - elif method_name == "agents_conversations_getCanvas": - self.api_methods_to_call.remove(method(channel="C123", canvas_id="F123")["method"]) - await async_method(channel="C123", canvas_id="F123") - elif method_name == "agents_conversations_listViews": - self.api_methods_to_call.remove(method(channel_id="C123")["method"]) - await async_method(channel_id="C123") - elif method_name == "agents_conversations_removeView": - self.api_methods_to_call.remove(method(channel_id="C123", view_id="V123")["method"]) - await async_method(channel_id="C123", view_id="V123") - elif method_name == "agents_conversations_setCanvasContent": - self.api_methods_to_call.remove(method(channel="C123", canvas_id="F123", content="# Plan")["method"]) - await async_method(channel="C123", canvas_id="F123", content="# Plan") - elif method_name == "agents_conversations_setCommands": - self.api_methods_to_call.remove(method(channel_id="C123", commands=[])["method"]) - await async_method(channel_id="C123", commands=[]) - elif method_name == "agents_conversations_setProperties": - self.api_methods_to_call.remove(method(channel_id="C123")["method"]) - await async_method(channel_id="C123") - elif method_name == "agents_conversations_setView": - self.api_methods_to_call.remove(method(channel_id="C123", type="diff")["method"]) - await async_method(channel_id="C123", type="diff") - elif method_name == "agents_sessions_rename": - self.api_methods_to_call.remove(method(channel_id="C123", title="New title")["method"]) - await async_method(channel_id="C123", title="New title") - elif method_name == "agents_sessions_setStatus": - self.api_methods_to_call.remove(method(channel_id="C123", status="processing")["method"]) - await async_method(channel_id="C123", status="processing") else: self.api_methods_to_call.remove(method(*{})["method"]) await async_method(*{}) From f6535895fd49228ce079d666dd8ac1dbcd5c661f Mon Sep 17 00:00:00 2001 From: Eden Zimbelman Date: Thu, 24 Sep 2026 10:31:02 -0700 Subject: [PATCH 10/11] test(web-api): use realistic mock data for agents.conversations coverage Address review on the coverage cases: - setProperties: send a real code_channel.context_bar_items payload ({key,label,icon}) instead of only channel_id - setView: send a full diff-view payload (content/base_branch/head_branch) instead of just type=diff - getCanvas/setCanvasContent: use a canvas-prefixed id (Ct...) not F... Payloads mirror the docs #816 examples. Co-Authored-By: Claude Co-Authored-By: Claude Opus 4.8 (1M context) --- .../web/test_web_client_coverage.py | 46 +++++++++++++++---- 1 file changed, 38 insertions(+), 8 deletions(-) diff --git a/tests/slack_sdk_async/web/test_web_client_coverage.py b/tests/slack_sdk_async/web/test_web_client_coverage.py index 5ddbda5ad..829562152 100644 --- a/tests/slack_sdk_async/web/test_web_client_coverage.py +++ b/tests/slack_sdk_async/web/test_web_client_coverage.py @@ -102,8 +102,8 @@ async def run_method(self, method_name, method, async_method): ) await async_method(name="Fix flaky test", origin_channel_id="C123", origin_message_ts="1717171717.123456") elif method_name == "agents_conversations_getCanvas": - self.api_methods_to_call.remove(method(channel="C123", canvas_id="F123")["method"]) - await async_method(channel="C123", canvas_id="F123") + self.api_methods_to_call.remove(method(channel="C123", canvas_id="Ct1234567890")["method"]) + await async_method(channel="C123", canvas_id="Ct1234567890") elif method_name == "agents_conversations_listViews": self.api_methods_to_call.remove(method(channel_id="C123")["method"]) await async_method(channel_id="C123") @@ -111,17 +111,47 @@ async def run_method(self, method_name, method, async_method): self.api_methods_to_call.remove(method(channel_id="C123", view_id="V123")["method"]) await async_method(channel_id="C123", view_id="V123") elif method_name == "agents_conversations_setCanvasContent": - self.api_methods_to_call.remove(method(channel="C123", canvas_id="F123", content="# Plan")["method"]) - await async_method(channel="C123", canvas_id="F123", content="# Plan") + self.api_methods_to_call.remove(method(channel="C123", canvas_id="Ct1234567890", content="# Plan")["method"]) + await async_method(channel="C123", canvas_id="Ct1234567890", content="# Plan") elif method_name == "agents_conversations_setCommands": self.api_methods_to_call.remove(method(channel_id="C123", commands=[])["method"]) await async_method(channel_id="C123", commands=[]) elif method_name == "agents_conversations_setProperties": - self.api_methods_to_call.remove(method(channel_id="C123")["method"]) - await async_method(channel_id="C123") + self.api_methods_to_call.remove( + method( + channel_id="C123", + code_channel={ + "context_bar_items": [ + {"key": "repo", "label": "borant/billing", "icon": "folder"}, + ] + }, + )["method"] + ) + await async_method( + channel_id="C123", + code_channel={ + "context_bar_items": [ + {"key": "repo", "label": "borant/billing", "icon": "folder"}, + ] + }, + ) elif method_name == "agents_conversations_setView": - self.api_methods_to_call.remove(method(channel_id="C123", type="diff")["method"]) - await async_method(channel_id="C123", type="diff") + self.api_methods_to_call.remove( + method( + channel_id="C123", + type="diff", + content="diff --git a/cron.py b/cron.py\n--- a/cron.py\n+++ b/cron.py\n@@ ...", + base_branch="main", + head_branch="agent/migrate-cron", + )["method"] + ) + await async_method( + channel_id="C123", + type="diff", + content="diff --git a/cron.py b/cron.py\n--- a/cron.py\n+++ b/cron.py\n@@ ...", + base_branch="main", + head_branch="agent/migrate-cron", + ) elif method_name == "agents_sessions_rename": self.api_methods_to_call.remove(method(channel_id="C123", title="New title")["method"]) await async_method(channel_id="C123", title="New title") From 28fbc3f3c0f510f0251a81c1edcf551cab5cb535 Mon Sep 17 00:00:00 2001 From: Eden Zimbelman Date: Thu, 24 Sep 2026 10:37:37 -0700 Subject: [PATCH 11/11] test(web-api): put the Ct-prefixed id on removeView's view_id The prefixed-id note was about the view identifier, not the canvas methods. Use view_id="Ct123" for removeView; revert getCanvas / setCanvasContent canvas_id back to F123. Co-Authored-By: Claude Co-Authored-By: Claude Opus 4.8 (1M context) --- .../slack_sdk_async/web/test_web_client_coverage.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/slack_sdk_async/web/test_web_client_coverage.py b/tests/slack_sdk_async/web/test_web_client_coverage.py index 829562152..d24ffd805 100644 --- a/tests/slack_sdk_async/web/test_web_client_coverage.py +++ b/tests/slack_sdk_async/web/test_web_client_coverage.py @@ -102,17 +102,17 @@ async def run_method(self, method_name, method, async_method): ) await async_method(name="Fix flaky test", origin_channel_id="C123", origin_message_ts="1717171717.123456") elif method_name == "agents_conversations_getCanvas": - self.api_methods_to_call.remove(method(channel="C123", canvas_id="Ct1234567890")["method"]) - await async_method(channel="C123", canvas_id="Ct1234567890") + self.api_methods_to_call.remove(method(channel="C123", canvas_id="F123")["method"]) + await async_method(channel="C123", canvas_id="F123") elif method_name == "agents_conversations_listViews": self.api_methods_to_call.remove(method(channel_id="C123")["method"]) await async_method(channel_id="C123") elif method_name == "agents_conversations_removeView": - self.api_methods_to_call.remove(method(channel_id="C123", view_id="V123")["method"]) - await async_method(channel_id="C123", view_id="V123") + self.api_methods_to_call.remove(method(channel_id="C123", view_id="Ct123")["method"]) + await async_method(channel_id="C123", view_id="Ct123") elif method_name == "agents_conversations_setCanvasContent": - self.api_methods_to_call.remove(method(channel="C123", canvas_id="Ct1234567890", content="# Plan")["method"]) - await async_method(channel="C123", canvas_id="Ct1234567890", content="# Plan") + self.api_methods_to_call.remove(method(channel="C123", canvas_id="F123", content="# Plan")["method"]) + await async_method(channel="C123", canvas_id="F123", content="# Plan") elif method_name == "agents_conversations_setCommands": self.api_methods_to_call.remove(method(channel_id="C123", commands=[])["method"]) await async_method(channel_id="C123", commands=[])