slackapi/python-slack-sdk

Add rich_text classes to slack_sdk.models module

tj-smith47 opened this issue · 2 comments

I'm currently refactoring code using slack_sdk models, and most of my modals use RichText objects. I've noticed while available in Block Kit Builder and documented thoroughly, there is not a model for it. I created my own (I'd share, but the way it's constructed is significantly different than how I see it done in this project), but when I try to pass this through the View() constructor, it skips those blocks because it doesn't recognize the type, despite how well established and integrated into documentation that component appears to be.

I'm wondering if there is a plan to add a model for this in place, and if so, where that is on the priority scale? Also hoping to get clarity on what appears should be LinkTextObject for use inside a section or list of a RichTextElement. Passing subtype="link" to TextObject "works", but the url property gets discarded.

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)
  • 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

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.

Hi @tj-smith47, thanks for writing in!

'm wondering if there is a plan to add a model for this in place, and if so, where that is on the priority scale?

Since Slack's platform unlocked those rich_text blocks to 3rd party apps recently, this project has not yet supported it. However, we definitely plan to add it! (Actually it's already done for Node and Java SDKs).

I cannot tell the exact date to publish a new version yet, but it won't take weeks for sure. If everything goes well, a new version including it would be available by the end of this week.

Also hoping to get clarity on what appears should be LinkTextObject for use inside a section or list of a RichTextElement. Passing subtype="link" to TextObject "works", but the url property gets discarded.

I won't reuse the TextObject class for the link item in rich text list objects. The TextObject represents a typical property of a block, which possesses either a "plain_text" or "mrkdwn" type (and usually it is supposed to be used for label etc.). This object cannot be an item of "rich_text_section" block element. They are completely different ones. So, when we add rich_text block elements to the model module, we will introduce a new class for the link item.

@seratch This is great news! Thank you for your work on this, can't wait to see it!