python-slack-sdk icon indicating copy to clipboard operation
python-slack-sdk copied to clipboard

Add Markdown Block model

Open frek818 opened this issue 10 months ago • 1 comments

I would like to use the new markdown block with this SDK. It would help with sending LLM responses in Slack messages.

Category (place an x in each of the [ ])

  • [ ] slack_sdk.web.WebClient (sync/async) (Web API client)
  • [ ] slack_sdk.webhook.WebhookClient (sync/async) (Incoming Webhook, response_url sender)
  • [x] slack_sdk.models (UI component builders)
  • [ ] slack_sdk.oauth (OAuth Flow Utilities)
  • [ ] slack_sdk.socket_mode (Socket Mode client)
  • [ ] slack_sdk.audit_logs (Audit Logs API client)
  • [ ] slack_sdk.scim (SCIM API client)
  • [ ] slack_sdk.rtm (RTM client)
  • [ ] slack_sdk.signature (Request Signature Verifier)

Requirements

There is a MarkdownBlock element that is an abstraction for this

frek818 avatar Apr 11 '25 20:04 frek818

Hey @frek818! 👋 Thanks for sending this issue in! I agree markdown is so useful for LLM responses 🤖

While the Python SDK offers a MarkdownTextObject this is not the same as the linked Block Kit markdown and we might need to add additional support for typed markdown so I will mark this as an enhancement.

In the meantime it is still possible to use the markdown block in a more verbose manner with the following:

client.chat_postMessage(
    channel="C0123456789",
    text="LGTM!",
    blocks=[
        {
            "type": "markdown",
            "text": "# LGTM\n> A kind response",
        },
    ],
)

This might not be ideal for now, but I hope it's an alright workaround! Let's keep this issue open to keep track of typed support in the meantime 🙏 ✨

zimeg avatar Apr 11 '25 23:04 zimeg