Migrate to Netlify Today

Netlify announces the next evolution of Gatsby Cloud. Learn more

Outgoing Notifications

When your Gatsby site is built and deployed on Gatsby Cloud, you now have the option to hook up a set of outgoing notifications regarding the status of that build. You can send notifications via:

  1. A generic webhook.
  2. A webhook that sends a Slack message.
  3. Pull Request comments in Github or GitLab.

By default, the Pull Request comments are already set up for existing and new sites in Gatsby Cloud.

Adding webhook notifications

  1. First, navigate to “Site Settings”. In the sidebar menu under “General”, select “Outgoing Notifications”. Then click “Add Notification” and choose the “Webhooks” option.

Steps to add a webhook notification

  1. Next, you will be prompted to add a webhook that will receive the payload of information about your build or deploy. There are the following options for event notifications:
  • build succeeded
  • build failed
  • build timed out
  • preview succeeded
  • preview failed
  • preview timed out
  • deploy succeeded
  • deploy failed
  1. Paste your webhook into the “Outgoing webhook URL” field, choose an event to listen to, then click Save. If you want to trigger notifications for multiple events, add a new notification for each.

Button to add a notification

Webhook message payload

You can expect the message payload to appear as following:

Adding slack notifications

To take advantage of Slack notifications, you first need to create a custom Slack application to handle the webhook message.

  1. First, add a new Slack app. Add one for a workspace where you have appropriate permissions.

Modal to create a slack app

  1. Next, add the “Incoming Webhook” feature and activate it. Then, at the bottom of that page, click “Add New Webhook to Workspace”:

Slack Incoming Webhooks feature

  1. Now, select an appropriate channel for your notifications and click “Allow”:

Slack App Permissions

After that, you will see a success message and a new webhook URL will be generated. Copy the “Webhook URL”.

Example of a Webhook URL

  1. Finally, return to Gatsby Cloud and navigate to the “Outgoing notifications” settings. Click “Add Notification” and choose the “Slack” option. Paste the Slack application’s webhook URL that you previously copied into the “Outgoing webhook URL” field.

  2. Choose which Event to listen to and then click “Save”. You can reuse the same Slack application webhook for all four event types. If you want to send a notification to multiple channels, you must generate additional Webhook URLs for your Slack app and create additional notifications as described above.

Edit this page on GitHub
© 2024 Gatsby, Inc.