Webhooks

There are two different types of webhooks in Caasy. Incoming and outgoing webhooks. Incoming webhooks are used to feed the activity stream and outgoing webhooks are a great way to trigger some actions on other platforms on certain events in Caasy.

Incoming Webhooks

These type of webhooks are also called Notifications. Currently, notifications are available for Firebase and Netlify. Notifications are used to add information about the build and deployment process to your site's activity stream.

sites

Firebase Notifications

Firebase does not offer webhooks out of the box. However, they give you the option to execute scripts before and after the deployment. We have prepared two scripts for you. One notifies Caasy that the deployment has started while the other one notifies Caasy when the deployment was successful. Unfortunately, Firebase does currently not have an event for failed deployments. To add Firebase notifications create the following files in your repositories root folder:

predeploy.sh

curl -X POST -H 'Content-Type: application/json' --data '{"state":"deploying"}' firebaseNotificationURL

postddeploy.sh

curl -X POST -H 'Content-Type: application/json' --data '{"state": "success"}' firebaseNotificationURL

Make sure to replace firebaseNotificationURL with your individual Firebase notification URL, which you can find in the sidebar under Integrations in the Caasy app.

caution

We recommend setting the Firebase notification URL as environment variable so that nobody can abuse it and spam your activity stream.

Now, add the properties predeploy and postdeploy to your firebase.json file and you are ready to go:

{
"hosting": {
"predeploy": ". predeploy.sh",
"postdeploy": ". postdeploy.sh"
}
}

Netlify Notifications

Netlify offers a rich set of webhooks that are sent on certain occasions such as a successful or failed deployment. To get started, login into your Netlify account and select a site. Click Settings in the top menu and then Build & Deploy in the sidebar. Scroll down to Deploy Notifications and click the button Add notification and select Outgoing webhook. This will open a modal, which lets you select the event to listen for and provide and URL to notify. Select your desired event and provide your individual Netlify notification URL that you can find in the Caasy app under Integrations. We recommend adding webhooks for the events started, succeeded and failed.

Outgoing Webhooks

Outgoing webhooks can be used to trigger actions in other systems such as deployment flows on certain events in Caasy. To create an outgoing webhook click on Integrations in your Caasy app and scroll down to Webhooks. Click on the Add button and provide a name for the webhook and an URL for the webhook. Afterwards, you can select the events that should trigger the webhook by clicking the checkboxes. Webhooks are POST requests with an empty body.

sites

Events:

  • on post created: fires every time a blog post was created, regardless of its publishing status

  • on post updated: fires every time a blog post was updated, regardless of its publishing status

  • on post deleted: fires every time a blog post was deleted

  • on post published: fires when a new blog post was created that is published or when the status of an existing blog post was changed to published

  • on post unpublished: fires when a published blog post is unpublished

  • on page created: fires every time a page was created, regardless of its publishing status

  • on page updated: fires every time a page was updated, regardless of its publishing status

  • on page deleted: fires every time a page was deleted

  • on page published: fires every time a new page was created that is published or when the status of an existing page was changed to published

  • on page unpublished: fires when a published page is unpublished