Skip to content

Warn on unrecognized kwargs in chat_postMessage - #1988

Closed
Eryx-Z wants to merge 1 commit into
slackapi:mainfrom
Eryx-Z:fix/warn-unknown-kwargs-chat-postMessage
Closed

Eryx-Z wants to merge 1 commit into
slackapi:mainfrom
Eryx-Z:fix/warn-unknown-kwargs-chat-postMessage

Conversation

@Eryx-Z

@Eryx-Z Eryx-Z commented Oct 16, 2026

Copy link
Copy Markdown

Summary

chat_postMessage (and other Web API methods) accept **kwargs as an escape hatch for undocumented API parameters. Typos such as thread_id instead of thread_ts or unfurl_link instead of unfurl_links were forwarded into the request body with no warning, so a threaded reply could silently post as a top-level channel message.

This adds _warn_if_unknown_kwargs and calls it from chat_postMessage before merging declared parameters. **kwargs remains an escape hatch; unknown keys now emit a UserWarning.

Fixes #1923.

Test plan

  • Unit tests for thread_id / unfurl_link typos and for known thread_ts
  • Regenerated async_client.py / legacy_client.py via scripts/codegen.py
  • Formatted with scripts/format.sh

Typos such as thread_id (instead of thread_ts) or unfurl_link (instead of
unfurl_links) were forwarded silently into the request body, so a threaded
reply could post as a top-level channel message with no error or warning.

Add _warn_if_unknown_kwargs and call it from chat_postMessage before merging
declared parameters. **kwargs remains an escape hatch for undocumented API
fields; unknown keys now emit a UserWarning.

Fixes slackapi#1923.
@Eryx-Z
Eryx-Z requested a review from a team as a code owner October 16, 2026 23:10
@salesforce-cla

Copy link
Copy Markdown

Thanks for the contribution! Before we can merge this, we need @Eryx-Z to sign the Salesforce Inc. Contributor License Agreement.

@Eryx-Z

Eryx-Z commented Oct 17, 2026

Copy link
Copy Markdown
Author

Closing for now.

@Eryx-Z Eryx-Z closed this Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chat_postMessage silently forwards thread_id to the API, so a threaded reply posts to the channel

1 participant