Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add support for unicode parameter in emoji type of rich text blocks #1319

Conversation

YutoKashiwagi
Copy link
Contributor

This PR adds support for the unicode parameter to the RichTextSectionEmojiElement struct for rich text blocks. While this parameter is not officially documented in Slack's API, it is present in the JSON payload of actual Slack messages and represents the Unicode code point of the emoji.
https://api.slack.com/reference/block-kit/blocks#emoji-element-type

For example, a rich text block with an emoji can include the unicode field like this:

"blocks": [
    {
      "type": "rich_text",
      "block_id": "xxxxx",
      "elements": [
        {
          "type": "rich_text_section",
          "elements": [
            {
              "type": "emoji",
              "name": "+1",
              "unicode": "1f44d"
            }
          ]
        }
      ]
    }
  ]

The unicode parameter behaves similarly to the skin-tone parameter, which is also undocumented but has already been included in the structure. This PR aligns the handling of unicode in the same way to ensure emojis are fully supported in Slack message payloads.

Please review, and feel free to provide feedback if any adjustments are needed. Thank you!

Pull Request Guidelines

These are recommendations for pull requests.
They are strictly guidelines to help manage expectations.

PR preparation

Run make pr-prep from the root of the repository to run formatting, linting and tests.

Should this be an issue instead
  • is it a convenience method? (no new functionality, streamlines some use case)
  • exposes a previously private type, const, method, etc.
  • is it application specific (caching, retry logic, rate limiting, etc)
  • is it performance related.
API changes

Since API changes have to be maintained they undergo a more detailed review and are more likely to require changes.

  • no tests, if you're adding to the API include at least a single test of the happy case.
  • If you can accomplish your goal without changing the API, then do so.
  • dependency changes. updates are okay. adding/removing need justification.
Examples of API changes that do not meet guidelines:
  • in library cache for users. caches are use case specific.
  • Convenience methods for Sending Messages, update, post, ephemeral, etc. consider opening an issue instead.

@YutoKashiwagi YutoKashiwagi changed the title Add unicode parameter to RichTextSectionEmojiElement for rich text blocks Add support for unicode parameter in emoji type of rich text blocks Sep 9, 2024
@lorenzoaiello lorenzoaiello self-assigned this Sep 17, 2024
@lorenzoaiello lorenzoaiello changed the title Add support for unicode parameter in emoji type of rich text blocks feat: Add support for unicode parameter in emoji type of rich text blocks Sep 17, 2024
Copy link
Contributor

@lorenzoaiello lorenzoaiello left a comment

Choose a reason for hiding this comment

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

Thank you for the contribution @YutoKashiwagi !

The Slack documentation now also reflects the unicode field so this is no longer un-documented.

@lorenzoaiello lorenzoaiello removed the spec undocumented Slack does not document yet label Sep 19, 2024
@lorenzoaiello lorenzoaiello merged commit 447b7cd into slack-go:master Sep 19, 2024
7 checks passed
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.

2 participants