Skip to content

Conversation

@brendo
Copy link
Contributor

@brendo brendo commented Nov 30, 2025

RE: slack-ruby/slack-ruby-client#579

This PR adjusts the patches for the chat methods to accept markdown_text, but only if it's provided exclusively of text.

I'm not thrilled with the wording so open to suggestions 🙇

Locally, when using this code to generate slack-ruby-client this produces this output (one example provided):

  def chat_postMessage(options = {})
    raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
    raise ArgumentError, 'At least one of :attachments, :blocks, :text, :markdown_text is required' if options[:attachments].nil? && options[:blocks].nil? && options[:text].nil? && options[:markdown_text].nil?
    raise ArgumentError, 'Exactly one of :text, :markdown_text is required' unless options[:text].nil? ^ options[:markdown_text].nil?
    options = encode_options_as_json(options, %i[attachments blocks metadata])
    post('chat.postMessage', options)
  end

@dblock
Copy link
Collaborator

dblock commented Nov 30, 2025

Is "One of these arguments in addition to text or markdown_text ..." and "text or markdown_text will be used" better?

@brendo
Copy link
Contributor Author

brendo commented Dec 1, 2025

Is "One of these arguments in addition to text or markdown_text ..." and "text or markdown_text will be used" better?

Heh, I was actually more concerned about the desc text (eg. https://github.com/slack-ruby/slack-api-ref/pull/81/files#diff-bab7373208eb0c66cc06b17136d209fed196ecce690150e93ccbe718b03eb391R10). The error message text is auto-generated so I don't believe we have the flexibility to change it for this specific use-case?

@dblock
Copy link
Collaborator

dblock commented Dec 1, 2025

@brendo That's what I meant too.

Replace

"desc": "One of these arguments in addition to text (unless markdown_text is provided) is required to describe the content of the message. When attachments or blocks are included, text will be used as fallback text for notifications only.",

with

"desc": "One of these arguments in addition to either text or markdown_text is required to describe the content of the message. When attachments or blocks are included, text or markdown_text will be used as fallback text for notifications only.",

@brendo
Copy link
Contributor Author

brendo commented Dec 2, 2025

Sorry about that! Done :)

@dblock
Copy link
Collaborator

dblock commented Dec 2, 2025

Merged via b1be09b.

@dblock dblock closed this Dec 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants