Pre-Requisites

Setup a Notification Channel Integration on the Integrations page. Please follow this document to add an integration.

Currently two types of Notification Channels are supported:

  1. Slack (Webhook URL based): For this, please create a webhook for your slack and then add it as an integration in Slack Provider Account
  2. Slack (Bot Token based): For this, please create a bot token for your slack and then add it as an integration in Slack Provider Account (Slack Bot Integration). It requires chat:write and chat:write:public scope. You can add slack channels to send to respective slack channel.
  3. Email (SMTP credentials Integration): This can be found in Custom Provider Account. You can configure the SMTP Credentials of the mail server, from_email and to_emails and use it to send notifications.

How to Configure

From UI

  1. In the Job form, please click on “Show Advanced Fields” and find the “Alerts” section

  2. Select your notification target and the triggers (on_start, on_completion, on_failure).

  3. There are three types of targets, one is email and the others are slack webhook and slack bot, you need to add an email/slack webhook/slack bot integration respectively and select it in notification channel field to use that integration for sending notifications.

  4. Click on Submit.

Once the Alerts are created you can see the alerts in your Slack/Email. Here is a sample Alert:

From CLI

To configure alerts when deploying from CLI or your CI/CD pipelines, Please add the following to your truefoundry.yaml
You will need to copy the FQN of your Notification Channel Integration and paste it as shown below.

type: job
name: <job-name>
...
alerts:
  - on_start: false
    on_completion: false
    on_failure: true
    notification_target:
      type: email
      to_emails:
        - demo.email@truefoundry.com
      notification_channel: <Paste your notification channel integration fqn here>

From Python SDK

To configure alerts when deploying from Python SDK, Please add the following to your deploy.pyfile:

from truefoundry.deploy import Job, JobAlert

job = Job(
  ...
  alerts = [
    JobAlert(
      on_start=False,
      on_completion=True,
      on_failure=True,
      notification_channel="<Paste your notification channel integration fqn here>"
    )
  ]
)