Skip to content

Conversation

hello-ashleyintech
Copy link
Contributor

Summary

This PR resolves issue #2329 and adds an optional string markdown_text property for ChatPostMessageArguments

Requirements (place an x in each [ ])

@hello-ashleyintech hello-ashleyintech self-assigned this Aug 6, 2025
@hello-ashleyintech hello-ashleyintech added bug M-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documented semver:patch enhancement M-T: A feature request for new functionality pkg:web-api applies to `@slack/web-api` labels Aug 6, 2025
Copy link

codecov bot commented Aug 6, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.75%. Comparing base (c2a8c84) to head (67ac56a).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2330      +/-   ##
==========================================
+ Coverage   92.74%   92.75%   +0.01%     
==========================================
  Files          38       38              
  Lines       10660    10676      +16     
  Branches      687      692       +5     
==========================================
+ Hits         9887     9903      +16     
  Misses        761      761              
  Partials       12       12              
Flag Coverage Δ
cli-hooks 95.23% <ø> (ø)
cli-test 94.74% <ø> (ø)
oauth 77.39% <ø> (ø)
socket-mode 61.87% <ø> (ø)
web-api 97.99% <100.00%> (+<0.01%) ⬆️
webhook 96.66% <ø> (ø)

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
Copy link
Member

zimeg commented Aug 6, 2025

@hello-ashleyintech This is looking great! Would it be possible to include this in a few other methods too to match changes of slackapi/python-slack-sdk#1718?

Edit: Oops keyboard shortctus are difficult - sorry for closing this ahhhhgh.

@zimeg zimeg closed this Aug 6, 2025
@zimeg zimeg reopened this Aug 6, 2025
@zimeg zimeg mentioned this pull request Aug 6, 2025
2 tasks
@hello-ashleyintech
Copy link
Contributor Author

@zimeg great catch! 😄 I will update this expeditiously

@zimeg zimeg changed the title feat(web-api): Add markdown_text property to ChatPostMessageArguments feat(web-api): add markdown_text property to chat.{postEphemeral|postMessage|scheduleMessage|update} methods Aug 8, 2025
Copy link
Member

@zimeg zimeg left a comment

Choose a reason for hiding this comment

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

@hello-ashleyintech Nice and so appreciated - this is working well for me! 👁️‍🗨️

An update to the PR title was made just above this but before merging it, the fallback text warning might be nice to update to expect markdown_text too: 🙏 ✨

const isEmptyText = (args: Record<string, unknown>) =>
args.text === undefined || args.text === null || args.text === '';

I left a few other comments of jsdoc also and would love to hear your thoughts on such topic! 🔏

Comment on lines 171 to 172
/** @description Accepts message text formatted in markdown. This argument should not be used
* in conjunction with blocks or text. Limit this field to 12,000 characters. */
Copy link
Member

Choose a reason for hiding this comment

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

praise: Thank you for adding jsdoc 📚 ✨

thought: Might leaving line breaks to the editor should be an overall change we make? I'm thinking we could perhaps snag this from the kind docs.slack.dev/reference/methods pages in neartimes 🤖

Copy link
Member

Choose a reason for hiding this comment

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

thought: That "editor" I realize is not so clear but I find this in testing:

linewrap

@@ -265,4 +274,7 @@ export type ChatUpdateArguments = MessageContents & {
file_ids?: string[];
/** @description Broadcast an existing thread reply to make it visible to everyone in the channel or conversation. */
reply_broadcast?: boolean;
/** @description Accepts message text formatted in markdown. This argument should not be used
* in conjunction with blocks or text. Limit this field to 12,000 characters. */
markdown_text?: string;
Copy link
Member

Choose a reason for hiding this comment

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

praise: I am a fan of inlining these arguments! 👾

@pedropaccola
Copy link

Hey guys, I'm happy to help in order to expedite this release, given the branch isn't from a fork.

@zimeg by adjusting the fallback to consider the markdown fields, do you mean:

const isEmptyText = (args: Record<string, unknown>) =>
    args.text === undefined || args.text === null || args.text === '' || args.markdown_text === undefined || args.markdown_text === null || args.markdown_text === '';

@pedropaccola
Copy link

Apparently I don't have permission to push to this branch directly, sorry about that 😢

Copy link
Member

@zimeg zimeg left a comment

Choose a reason for hiding this comment

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

@hello-ashleyintech A few final touches on this PR were made in recent commits! After more testing I'm feeling good to merge this 🚢 💨

@pedropaccola Thanks too for sharing this suggestion! A similar change was made in 46359c6 that also adds tests. The investigation is so appreciated 🙏 ✨

// Models message-creation arguments, user must provide one of the following combinations:
// 1. channel and text
// 2. channel and blocks
// 3. channel and attachments
type MessageContents = ChannelAndText | ChannelAndBlocks | ChannelAndAttachments;
// 4. channel and markdown_text
type MessageContents = ChannelAndText | ChannelAndBlocks | ChannelAndAttachments | ChannelAndMarkdownText;
Copy link
Member

Choose a reason for hiding this comment

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

🗣️ note: Including markdown_text here was found to be helpful in avoiding typescript errors since none of the other "content" arguments are required!

⏳ ramble: Otherwise an attachments was expected I noticed-

@zimeg zimeg removed the bug M-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documented label Aug 21, 2025
@zimeg zimeg merged commit b66a2cb into main Aug 21, 2025
57 checks passed
@zimeg zimeg deleted the ah-fix-issue-2329 branch August 21, 2025 02:22
@zimeg zimeg linked an issue Aug 21, 2025 that may be closed by this pull request
7 tasks
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:patch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ChatPostMessageArguments type is missing "markdown_text" property.
3 participants