How to post bulleted lists using Slack Webhook URL.

TL;DR

The “Rich text block” is your friend.

import os

from slack_sdk import WebhookClient

if __name__ == “__main__”:
api_client = WebhookClient(url=os.environ[“SLACK_WEBHOOK_URL”])

unordered_list_elements: list[dict] = []
f…


This content originally appeared on DEV Community and was authored by Fomalhaut Weisszwerg

TL;DR

The "Rich text block" is your friend.

import os

from slack_sdk import WebhookClient

if __name__ == "__main__":
    api_client = WebhookClient(url=os.environ["SLACK_WEBHOOK_URL"])

    unordered_list_elements: list[dict] = []
    for fragment in ["foo", "bar", "baz"]:
        unordered_list_elements.append(
            {
                "type": "rich_text_section",
                "elements": [{"type": "text", "text": fragment}],
            }
        )

    api_client.send(
        blocks=[
            {
                "type": "rich_text",
                "elements": [
                    {
                        "type": "rich_text_list",
                        "style": "bullet",
                        "indent": 0,
                        "elements": unordered_list_elements,
                    }
                ],
            }
        ]
    )

The official Markdown example does not work

The official document provides a Markdown example:

{
    "blocks": [
        {
            "type": "section",
            "text": {
                "type": "mrkdwn",
                "text": "• Detective Chimp\n• Bouncing Boy\n• Aqualad"
            }
        }
    ]
}

But the example does not work properly.

There seems to be a bug in Markdown processing. So we need to use the other way to post a bulleted list via Webhook URL.

"Rich text block"

Rich text block is one of workarounds to the bug.

The basic format of the block is:

[
    {
        "type": "rich_text",
        "elements": [
            {
                "type": "rich_text_list",
                "style": "bullet",
                "elements": [rich_text_sections],
            }
        ],
    }
]

Note that the type of outermost block must always be set to "rich_text". And a block of bulleted list need to be declared as the inner block.

Finally, define elements of the bulleted list as a list of rich_text_section. The format of rich_text_section is following:

{
    "type": "rich_text_section",
    "elements": [
        {
            "type": "text",
            "text": value_of_elements
        }
    ]
}

Now it is able to post to your Slack workspace using slack_sdk.WebhookClient.send method!


This content originally appeared on DEV Community and was authored by Fomalhaut Weisszwerg


Print Share Comment Cite Upload Translate Updates
APA

Fomalhaut Weisszwerg | Sciencx (2025-09-10T15:58:39+00:00) How to post bulleted lists using Slack Webhook URL.. Retrieved from https://www.scien.cx/2025/09/10/how-to-post-bulleted-lists-using-slack-webhook-url/

MLA
" » How to post bulleted lists using Slack Webhook URL.." Fomalhaut Weisszwerg | Sciencx - Wednesday September 10, 2025, https://www.scien.cx/2025/09/10/how-to-post-bulleted-lists-using-slack-webhook-url/
HARVARD
Fomalhaut Weisszwerg | Sciencx Wednesday September 10, 2025 » How to post bulleted lists using Slack Webhook URL.., viewed ,<https://www.scien.cx/2025/09/10/how-to-post-bulleted-lists-using-slack-webhook-url/>
VANCOUVER
Fomalhaut Weisszwerg | Sciencx - » How to post bulleted lists using Slack Webhook URL.. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/09/10/how-to-post-bulleted-lists-using-slack-webhook-url/
CHICAGO
" » How to post bulleted lists using Slack Webhook URL.." Fomalhaut Weisszwerg | Sciencx - Accessed . https://www.scien.cx/2025/09/10/how-to-post-bulleted-lists-using-slack-webhook-url/
IEEE
" » How to post bulleted lists using Slack Webhook URL.." Fomalhaut Weisszwerg | Sciencx [Online]. Available: https://www.scien.cx/2025/09/10/how-to-post-bulleted-lists-using-slack-webhook-url/. [Accessed: ]
rf:citation
» How to post bulleted lists using Slack Webhook URL. | Fomalhaut Weisszwerg | Sciencx | https://www.scien.cx/2025/09/10/how-to-post-bulleted-lists-using-slack-webhook-url/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.