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

Last Bullet List Item Not Displayed on iOS Devices

Open shuvaevv opened this issue 1 year ago • 2 comments

On iOS devices, the last line of the bullet list is not showing up when the message is sent using blocks. This issue doesn't occur on desktop or Android devices where it displays as expected. (See screenshots and code provided below.)

Reproducible in:

The Slack SDK version

slack_sdk==3.27.1

Python runtime version

Python 3.11.7

OS info

Darwin Kernel Version 23.3.0: Wed Dec 20 21:28:58 PST 2023; root:xnu-10002.81.5~7/RELEASE_X86_64

Steps to reproduce:

import os
from slack_sdk import WebClient

channel = os.environ["SLACK_CHANNEL"]
slack_token = os.environ["SLACK_BOT_TOKEN"]

client = WebClient(token=slack_token)

blocks = [
    {'type': 'section', 'text': {'type': 'mrkdwn', 'text': 'Bullet list:'}}, 
    {'type': 'section', 'text': {'type': 'mrkdwn', 'text': '• `[email protected]`\n• `[email protected]`'}}
]

client.chat_postMessage(
    channel=channel, blocks=blocks
)

Expected result:

image

Actual result:

photo1713403039

Requirements

For general questions/issues about Slack API platform or its server-side, could you submit questions at https://my.slack.com/help/requests/new instead. :bow:

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

shuvaevv avatar Apr 18 '24 01:04 shuvaevv

Hi @shuvaevv, thanks for sharing this, and we apologize for the inconvenience the iOS app has caused you.

Indeed, it does seem to be a bug on the iOS client app side, and it certainly needs to be resolved in its future releases. However, I am unable to tell when the fix will be delivered to you.

Therefore, as a workaround for this issue, I would suggest utilizing rich text blocks instead. Representing the list of items using the rich text blocks should work more reliably with any of the client apps.

blocks = [
    {
        "type": "rich_text",
        "elements": [
            {
                "type": "rich_text_section",
                "elements": [{"type": "text", "text": "Bullet list:"}],
            },
            {
                "type": "rich_text_list",
                "style": "bullet",
                "elements": [
                    {
                        "type": "rich_text_section",
                        "elements": [
                            {
                                "type": "text",
                                "text": "[email protected]",
                                "style": {"code": True},
                            }
                        ],
                    },
                    {
                        "type": "rich_text_section",
                        "elements": [
                            {
                                "type": "text",
                                "text": "[email protected]",
                                "style": {"code": True},
                            }
                        ],
                    },
                ],
            },
        ],
    },
]

I do realize this may require code changes on your side, but I hope you find this is helpful for the time being.

seratch avatar Apr 18 '24 01:04 seratch

👋 It looks like this issue has been open for 30 days with no activity. We'll mark this as stale for now, and wait 10 days for an update or for further comment before closing this issue out. If you think this issue needs to be prioritized, please comment to get the thread going again! Maintainers also review issues marked as stale on a regular basis and comment or adjust status if the issue needs to be reprioritized.

github-actions[bot] avatar Jun 03 '24 00:06 github-actions[bot]