Skip to content

feat: add channel_id and optional document_content to canvases.create - #2001

Merged
zimeg merged 2 commits into
mainfrom
clack/canvases-create-args
Oct 28, 2026
Merged

zimeg merged 2 commits into
mainfrom
clack/canvases-create-args

Conversation

@zimeg

@zimeg zimeg commented Oct 28, 2026

Copy link
Copy Markdown
Member

Summary

This pull request updates canvases_create to match the canvases.create arguments documented on docs.slack.dev:

  • Adds a typed channel_id keyword argument for the channel the canvas will be tabbed in. Before this change it could only be passed through **kwargs.
  • Makes document_content optional, since the docs list it as an optional argument.
  • Drops None values before sending the JSON body, so unset arguments like channel_id and title aren't sent as null.

Testing

  1. Create a bot token with the canvases:write scope and invite the bot to a channel.
  2. Call client.canvases_create(channel_id="C0123456789") without document_content and confirm the response is ok and an empty canvas shows up as a tab in that channel.
  3. Call client.canvases_create(title="Example", document_content={"type": "markdown", "markdown": "> standalone canvas!"}) without channel_id and confirm a standalone canvas is still created.

Category

  • slack_sdk.web.WebClient (sync/async) (Web API client)
  • slack_sdk.webhook.WebhookClient (sync/async) (Incoming Webhook, response_url sender)
  • slack_sdk.socket_mode (Socket Mode client)
  • slack_sdk.signature (Request Signature Verifier)
  • slack_sdk.oauth (OAuth Flow Utilities)
  • slack_sdk.models (UI component builders)
  • slack_sdk.scim (SCIM API client)
  • slack_sdk.audit_logs (Audit Logs API client)
  • slack_sdk.rtm_v2 (RTM client)
  • /docs (Documents)
  • /tutorial (PythOnBoardingBot tutorial)
  • tests/integration_tests (Automated tests for this library)

Requirements

  • I've read and understood the Contributing Guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've run python3 -m venv .venv && source .venv/bin/activate && ./scripts/run_validation.sh after making the changes.

🤖 Generated with Claude Code

@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 84.37%. Comparing base (c7adb46) to head (6f92af1).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2001   +/-   ##
=======================================
  Coverage   84.36%   84.37%           
=======================================
  Files         118      118           
  Lines       13800    13803    +3     
=======================================
+ Hits        11643    11646    +3     
  Misses       2157     2157           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

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

@mwbrooks mwbrooks left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

✅ Nice cleanup @zimeg, thank you!

Comment thread slack_sdk/web/client.py
"channel_id": channel_id,
}
)
kwargs = _remove_none_values(kwargs)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

praise: Thanks for dropping the None values! title=None was going out as null in the JSON body before this.

@zimeg

zimeg commented Oct 28, 2026

Copy link
Copy Markdown
Member Author

@mwbrooks Thanks so much for the review! 🙏 ✨

@zimeg
zimeg merged commit fd538f7 into main Oct 28, 2026
19 checks passed
@zimeg
zimeg deleted the clack/canvases-create-args branch October 28, 2026 22:46
@zimeg zimeg mentioned this pull request Oct 30, 2026
3 tasks done
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 semver:minor web-client

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants