Skip to content

feat(web-api): add canvases.getContent method - #2797

Open
zimeg wants to merge 1 commit into
mainfrom
clack/canvases-get-content
Open

zimeg wants to merge 1 commit into
mainfrom
clack/canvases-get-content

Conversation

@zimeg

@zimeg zimeg commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Summary

This pull request adds the canvases.getContent method to @slack/web-api.

  • client.canvases.getContent({ canvas_id, content_type }) takes a required canvas_id and an optional content_type of html or markdown (the API defaults to markdown).
  • CanvasesGetContentResponse adds the content string. The response type is generated from the documented example response, since no recorded API response exists yet.
  • Adds type tests and a minor changeset.

Testing

  1. With a token that has the canvases:read scope, call client.canvases.getContent({ canvas_id: 'F0123456789' }) on a canvas you can read and confirm content comes back as markdown.
  2. Call it again with content_type: 'html' and confirm content comes back as HTML.

Requirements

🤖 Generated with Claude Code

Add the canvases.getContent Web API method, which gets the content of a
canvas as markdown (default) or HTML. Takes a required canvas_id and an
optional content_type of html or markdown.

The java-slack-sdk json-logs have no canvases.getContent sample yet, so
CanvasesGetContentResponse is produced by running the codegen's quicktype
command on a sample shaped like the documented response, matching the
generated output shape.

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@zimeg zimeg added semver:minor enhancement M-T: A feature request for new functionality area:typescript issues that specifically impact using the package from typescript projects pkg:web-api applies to `@slack/web-api` labels Oct 28, 2026
@zimeg zimeg self-assigned this Oct 28, 2026
@changeset-bot

changeset-bot Bot commented Oct 28, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c55a86d

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 Oct 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.36%. Comparing base (4483395) to head (c55a86d).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2797      +/-   ##
==========================================
+ Coverage   89.32%   89.36%   +0.03%     
==========================================
  Files          65       65              
  Lines       10548    10555       +7     
  Branches      480      480              
==========================================
+ Hits         9422     9432      +10     
+ Misses       1094     1091       -3     
  Partials       32       32              
Flag Coverage Δ
cli-hooks 89.28% <100.00%> (-0.01%) ⬇️
cli-test 89.28% <100.00%> (-0.01%) ⬇️
logger 89.28% <100.00%> (-0.01%) ⬇️
oauth 89.28% <100.00%> (-0.01%) ⬇️
socket-mode 89.28% <100.00%> (-0.01%) ⬇️
web-api 89.28% <100.00%> (-0.01%) ⬇️
webhook 89.28% <100.00%> (-0.01%) ⬇️

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.

@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.

🐙 A few words more before requesting kind review

CanvasesEditArguments,
CanvasesGetContentArguments,
CanvasesSectionsLookupArguments,
ConversationsCanvasesCreateArguments,

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.

👁️‍🗨️ note: I think we might want to move this to "conversations" export but no rush in meantime?

// https://docs.slack.dev/reference/methods/canvases.getContent
export interface CanvasesGetContentArguments extends CanvasID, TokenOverridable {
/** @description Format in which to return the canvas content. Defaults to markdown. */
content_type?: 'html' | 'markdown';

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.

📣 note: This is more strict than most method arguments but we might expand this as needed while starting correct? This can also be a string.

@zimeg zimeg added this to the web-api@next milestone Oct 28, 2026
@zimeg
zimeg marked this pull request as ready for review October 28, 2026 17:05
@zimeg
zimeg requested a review from a team as a code owner October 28, 2026 17:05

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

area:typescript issues that specifically impact using the package from typescript projects 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