Slack notifications

Slack notifications allow you to receive real-time updates about your Forge workflows directly in your Slack channels. This integration helps teams stay informed about build statuses, deployment results, and other important events without having to constantly check the Forge dashboard.

To set up Slack notifications, you need to create a webhook URL that connects Forge to your desired Slack channel. This webhook acts as a secure communication bridge between the two platforms.

Creating Slack webhook

Step 1. Open Slack API settings

  1. Go to https://api.slack.com/apps.
  2. Click Create New App → choose From Scratch.
  3. Give your app a name (e.g., Forge Bot) and select your Slack workspace.

Step 2. Enable incoming webhooks

  1. Inside the app settings, go to Features → Incoming Webhooks.
  2. Switch ctivate Incoming WebhooksOn.

Step 3. Create a webhook URL

  1. Click dd New Webhook to Workspace.

  2. Select the xxchannelxx where messages should be sent.

  3. Click Allow.

  4. You’ll see a Webhook URL like:

    https://hooks.slack.com/services/xxxxxxxxxxx/xxxxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxx
    

Step 4. Test your webhook

Use curl to test:

curl -X POST -H 'Content-type: application/json' \
--data '{"text":"Hello from Forge 🚀"}' \
https://hooks.slack.com/services/xxxxxxxxxxx/xxxxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxx

If everything is set up, you’ll see the message in the selected Slack channel.

Forge configuration

Once you have your Slack webhook URL, you can configure Forge to send notifications in several ways:

You can enable Slack notifications using either configuration files or environment variables.

Method 1: Configuration file

Add the following settings to your Forge configuration file:

  • slack_alert: Set to true to enable Slack notifications
  • slack_url: Your webhook URL from the previous step

config.json example:

{
    "slack_alert": true,
    "slack_url": "https://hooks.slack.com/services/xxxxxxxxxxx/xxxxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxx",
}

Method 2: Environment variables

Alternatively, you can use environment variables to configure Slack notifications. This method is particularly useful for containerized deployments or when you want to keep sensitive information separate from configuration files.

FORGE_SLACK_ALERT=True
FORGE_SLACK_URL=https://hooks.slack.com/services/xxxxxxxxxxx/xxxxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxx