Skip to content

feat(web-api): add agents.conversations.* methods - #2748

Draft
zimeg wants to merge 14 commits into
mainfrom
clack/agents-conversations-methods
Draft

zimeg wants to merge 14 commits into
mainfrom
clack/agents-conversations-methods

Conversation

@zimeg

@zimeg zimeg commented Sep 23, 2026

Copy link
Copy Markdown
Member

Summary

Adds the 9 Slack Code (code channel) Web API methods to @slack/web-api, under the agents.conversations.* namespace. Slack Code / code channels are going dev-GA; these type the client for that work.

All 9 methods require the code_channels:manage bot scope:

  • agents.conversations.create — create a dedicated code channel for an agent session
  • agents.conversations.archive — archive a code channel
  • agents.conversations.setProperties — set properties on a code channel
  • agents.conversations.setView — create or update a view in a code channel
  • agents.conversations.setCommands — register agent-defined slash commands (commands is required)
  • agents.conversations.listViews — list the views attached to a code channel
  • agents.conversations.removeView — remove a view from a code channel
  • agents.conversations.getCanvas — fetch a canvas attached to a code channel
  • agents.conversations.setCanvasContent — replace a plan canvas's markdown content

Notes

  • Argument names preserved verbatim from the API schemas: getCanvas and setCanvasContent take channel (not channel_id); the other seven take channel_id. This asymmetry is intentional and matches the method definitions.
  • Response types follow this package's auto-generated shape (minimal WebAPICallResult extensions). Because these are net-new methods with no java-slack-sdk samples yet, the response files are hand-written minimal/honest stubs rather than codegen output; they can be regenerated once samples land.
  • No legacy codeChannels.* names — only the agents.conversations.* names are shipped, per the SDK naming decision (2026-09-23).
  • Argument interfaces were typed from the agents.conversations.* method schemas in docs PR Add TypeScript definitions for events #816.

Status

Experimental / draft — pending the API going dev-GA and docs PR #816 landing. Opened as a draft on purpose.

Testing

  • npm run build --workspace=packages/web-api (tsc typecheck) — clean
  • npx @biomejs/biome check packages — clean (666 files)
  • npm test --workspace=packages/web-api — 152/152 pass

🤖 Generated with Claude Code

Add the 9 Slack Code (code channel) Web API methods to @slack/web-api:
create, archive, setProperties, setView, setCommands, listViews,
removeView, getCanvas, setCanvasContent — all requiring the
code_channels:manage bot scope.

Argument interfaces are hand-typed from the docs #816 method schemas.
Per those schemas, getCanvas and setCanvasContent use `channel` (not
`channel_id`); the other seven use `channel_id`. Response types follow
the repo's auto-generated shape; since these are net-new methods with no
java-slack-sdk samples yet, they are hand-written minimal WebAPICallResult
extensions rather than codegen output.

Only agents.conversations.* names are added — the legacy codeChannels.*
names are intentionally not shipped (decision 2026-09-23).

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4414513

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@slack/web-api Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codecov

codecov Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.28%. Comparing base (334e6a6) to head (4414513).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2748      +/-   ##
==========================================
+ Coverage   89.15%   89.28%   +0.12%     
==========================================
  Files          65       65              
  Lines       10442    10534      +92     
  Branches      480      480              
==========================================
+ Hits         9310     9405      +95     
+ Misses       1100     1097       -3     
  Partials       32       32              
Flag Coverage Δ
cli-hooks 89.21% <100.00%> (+0.09%) ⬆️
cli-test 89.21% <100.00%> (+0.09%) ⬆️
logger 89.21% <100.00%> (+0.09%) ⬆️
oauth 89.21% <100.00%> (+0.09%) ⬆️
socket-mode 89.21% <100.00%> (+0.09%) ⬆️
web-api 89.21% <100.00%> (+0.09%) ⬆️
webhook 89.21% <100.00%> (+0.09%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

…+ drop channel remark

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@zimeg zimeg changed the title feat(web-api): add agents.conversations.* code channel methods feat(web-api): add agents.conversations.* methods Sep 24, 2026
@zimeg zimeg self-assigned this Sep 25, 2026
@zimeg zimeg added semver:minor enhancement M-T: A feature request for new functionality pkg:web-api applies to `@slack/web-api` labels Sep 25, 2026
@zimeg zimeg added this to the web-api@next milestone Sep 25, 2026
zimeg and others added 4 commits September 25, 2026 14:04
Order the 9 agents.conversations method registrations (methods.ts) and
their request-argument interfaces (types/request/agents.ts)
alphabetically: archive, create, getCanvas, listViews, removeView,
setCanvasContent, setCommands, setProperties, setView. Pure reorder;
tsc --noEmit clean.

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… add type tests

Six agents.conversations methods (archive, create, listViews, removeView,
setProperties, setView) were bound with bindApiCallWithOptionalArgument,
so calling them with no argument type-checked despite channel_id/name
being required. Switch all nine to bindApiCall (required argument) for
parity with getCanvas/setCanvasContent/setCommands, and add
test/types/methods/agents.test-d.ts covering the sad/happy paths for
each (tsd clean; tsc --noEmit clean).

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…in request types

The agents.sessions argument interfaces sat before agents.conversations
in types/request/agents.ts; conversations sorts first. Move the sessions
block after the conversations block. Pure reorder; tsc --noEmit clean.

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@zimeg zimeg left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

🧪 Notes on docs and arguments me might not want to have!

Comment on lines +10 to +11
* @description 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`.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Suggested change
* @description 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`.
* @description 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` set.

export interface AgentsConversationsCreateArguments extends TokenOverridable {
/**
* @description 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 the token.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Suggested change
* provided. When omitted, the workspace is derived from the token.
* provided. When omitted, the workspace is derived from the origin channel.

is_private?: boolean;
/**
* @description The channel ID where the agent session was initiated from. Must be provided together with
* `origin_message_ts`. The channel must be accessible to the calling app.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Suggested change
* `origin_message_ts`. The channel must be accessible to the calling app.
* `origin_message_ts`. The channel must be accessible to the calling user and must not be externally shared (Slack Connect). When `team_id` is omitted with an org token, the channel is created in the same workspace as this origin channel.

origin_channel_id?: string;
/**
* @description The message timestamp in the origin channel that started the agent session. Must be provided together
* with `origin_channel_id`.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Suggested change
* with `origin_channel_id`.
* with `origin_channel_id`. The author of this message is automatically invited to the newly created code channel.

session_id?: string;
/**
* @description A friendly display name for the code channel. Optional when `origin_channel_id` and `origin_message_ts`
* are provided — in that case the channel name is derived from the origin message.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Suggested change
* are provided — in that case the channel name is derived from the origin message.
* are provided — in that case the channel name is derived from the origin message and re-titled automatically. Required when no origin link is given.

canvas_id?: string;
/**
* @description For canvas views: access level granted to the channel for the canvas tab. Defaults to `write`. Use
* `comment` to grant channel members comment access.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Suggested change
* `comment` to grant channel members comment access.
* `comment` to grant channel members comment access (read and comment, no editing) so the agent remains the sole author of the canvas text.

access_level?: string;
/**
* @description 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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Suggested change
* later detect human edits to the canvas.
* later detect human edits to the canvas. Opaque to the server.

head_branch?: string;
/**
* @description 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`.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Suggested change
* supplied). Defaults to the last path segment of `view_key`.
* supplied). Defaults to the last path segment of `view_key`, stripped of any .html/.htm extension.

label?: string;
/**
* @description Content-Security-Policy domain declarations for the view. Domains are validated server-side
* (https-only, no private/internal hosts) and persisted with the view.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Suggested change
* (https-only, no private/internal hosts) and persisted with the view.
* (https-only, no private/internal hosts) and persisted. Only resource_domains is honored at render time today; connect_domains is accepted and stored for forward-compatibility but NOT honored yet.

Comment thread packages/web-api/src/methods.ts Outdated
Comment on lines +1618 to +1710
create: bindApiCallWithOptionalArgument<CanvasesCreateArguments, CanvasesCreateResponse>(this, 'canvases.create'),
create: bindApiCall<CanvasesCreateArguments, CanvasesCreateResponse>(this, 'canvases.create'),

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

👁️‍🗨️ suggestion: Let's revert this?

zimeg and others added 8 commits September 28, 2026 21:58
- Type the complex args inline instead of Record<string, unknown>:
  commands ({name, description?, argument_hint?}[]), code_channel
  (context_bar_items[] + summary_message), agent_resource
  (url/resource_type/title/provider) — mirroring the java typed classes.
- Apply the reviewer's docs wording (archive origin_link, create team_id/
  name/origin fields, setCommands limits, setView view_key/content/
  access_level/agent_content_hash/name/csp).
- Drop the deprecated label field from setView; make create name optional
  (required only without an origin link) and remove the now-invalid
  create({}) type-test case.
- Revert the accidental canvases.create binding change (it correctly uses
  bindApiCallWithOptionalArgument).

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The docs mark name as Required (the conditional 'optional with an origin
link' is prose, not the declared arg requirement), so keep name: string
and restore the create({}) missing-name type-test.

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…perties

Session title/status are set via agents.sessions.rename / setStatus;
they don't belong on setProperties. Remove the deprecated fields per
review.

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ava json-logs

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
…ence

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement M-T: A feature request for new functionality pkg:web-api applies to `@slack/web-api` semver:minor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant