How to create a Slack webhook URL for the SlackWebhook notification block? (incoming webhook)

First, to create a webhook, go to Slack API: Applications | Slack → Create a New App → From Scratch.

Choose a name for your app and select your desired Slack workspace, then confirm “Create App”:

Select incoming webhooks and switch the toggle on.

Next, create a webhook for the Slack channel of your choice (“Add New Webhook to Workspace”).

Select the channel of your choice and confirm with “Allow”:

Once all that’s done, you can copy your Webhook URL and use it in your flow!

Create SlackWebhook block from code

Note that you should treat this webhook in the same way as an API key or password. You should store this webhook within the SlackWebhook notification block. You can do that from code:

from prefect.blocks.notifications import SlackWebhook

slack = SlackWebhook(url="SLACK_WEBHOOK_URL_JUST_CREATED")
slack.save("default", overwrite=True)

Create a SlackWebhook block from the UI