Hi there - i'm just getting started with slack not...
# prefect-getting-started
b
Hi there - i'm just getting started with slack notifications and i'm trying to send an Incoming WebHook that is JSON formatted per their instructions. However - when I post the message it just ends up as plain text. Any quick assistance?
Trying something new - but no errors are returned:
Copy code
message_block = dict(
        {
            "blocks": [
                {
                    "type": "section",
                    "text": {
                        "type": "mrkdwn",
                        "text": "New Paid Time Off request from Fred>",
                    },
                }
            ]
        }
    )
and sending as the block:
Copy code
send_incoming_webhook_message(
        slack_webhook=slack_webhook, text=text_only_message, slack_blocks=message_block
    )
and no message is posted.
Thank you ChatGPT
Copy code
message_blocks = [
    {
        "type": "section",
        "text": {
            "type": "mrkdwn",
            "text": "Hello, world!"
        }
    },
    {
        "type": "divider"
    },
    {
        "type": "section",
        "fields": [
            {
                "type": "mrkdwn",
                "text": "*Priority:* High"
            },
            {
                "type": "mrkdwn",
                "text": "*Due:* Tomorrow"
            }
        ]
    },
    {
        "type": "actions",
        "elements": [
            {
                "type": "button",
                "text": {
                    "type": "plain_text",
                    "text": "Complete Task"
                },
                "value": "complete_task"
            }
        ]
    }
]
Those worked
n
glad you figured it out @Brian Roepke 🙂 just in case it ends up helpful sometime, you're free to #C04DZJC94DC questions like this. e.g. @Marvin what is wrong with this?
Copy code
message_block = dict(
        {
            "blocks": [
                {
                    "type": "section",
                    "text": {
                        "type": "mrkdwn",
                        "text": "New Paid Time Off request from Fred>",
                    },
                }
            ]
        }
    )
the text is showing up plain in slack??
b
Oh wow. Okay thanks!