Discord Alerter

Sending automated alerts to a Discord channel.

The DiscordAlerter enables you to send messages to a dedicated Discord channel directly from within your ZenML pipelines.

The discord integration contains the following two standard steps:

discord_alerter_post_step takes a string message, posts it to a Discord channel, and returns whether the operation was successful.

discord_alerter_ask_step also posts a message to a Discord channel, but waits for user feedback, and only returns True if a user explicitly approved the operation from within Discord (e.g., by sending "approve" / "reject" to the bot in response).

Interacting with Discord from within your pipelines can be very useful in practice:

The discord_alerter_post_step allows you to get notified immediately when failures happen (e.g., model performance degradation, data drift, ...),

The discord_alerter_ask_step allows you to integrate a human-in-the-loop into your pipelines before executing critical steps, such as deploying new models.

How to use it

Requirements

Before you can use the DiscordAlerter, you first need to install ZenML's discord integration:

zenml integration install discord -y

See the Integrations page for more details on ZenML integrations and how to install and use them.

Setting Up a Discord Bot

In order to use the DiscordAlerter, you first need to have a Discord workspace set up with a channel that you want your pipelines to post to. This is the <DISCORD_CHANNEL_ID> you will need when registering the discord alerter component.

Then, you need to create a Discord App with a bot in your server .

Note in the bot token copy step, if you don't find the copy button then click on reset token to reset the bot and you will get a new token which you can use. Also, make sure you give necessary permissions to the bot required for sending and receiving messages.

Registering a Discord Alerter in ZenML