You can now automatically trigger a webhook to get notified when certain events occur inside PlanetScale.
Webhooks are an effective way to build integrations between systems that don't necessarily have strong ties with each other. A webhook, which is an outbound HTTP POST callback, can be triggered by various events. With webhooks, you can get near real-time data through automation. While an API must be polled by external services, webhooks can push information when an event occurs.
There are various examples where webhooks in PlanetScale can be helpful, for example:
- Creating notifications in Slack, Microsoft Teams, GitHub, and other tools
- Integrating with CI/CD processes for the automation of schema changes
- Updating external issue trackers like Jira
These examples can be built with the events we are releasing today for webhooks. You can trigger a webhook for the following events in PlanetScale:
branch.ready- The branch is created and ready to connect.
branch.sleeping- The branch is now sleeping.
deploy_request.opened- The deploy request has been opened.
deploy_request.queued- The deploy request has been added to the deploy queue.
deploy_request.in_progress- The deploy request has started running.
deploy_request.schema_applied- The deploy request has finished applying the schema.
deploy_request.errored- The deploy request has stopped due to an error.
deploy_request.reverted- The deploy request has been reverted.
deploy_request.closed- The deploy request has been closed.
If there is an event you want to use that is not included in this list, please contact us and let us know what event you want to trigger a webhook on.
Webhooks can notify your team about new and running deploy requests for your database. One way we've been using them internally is via Zapier and Slack. We've set up a Zapier webhook trigger, which gives us a URL to send our hooks. In PlanetScale, we created a new webhook that triggers all of the
deploy_request events. Each time a webhook is received, we have Zapier post a message into a Slack channel notifying us of the progress of a deploy request.
With the data available in the webhook, we were able to produce messages like this:
DR 16: deploy_request.schema_applied by Mike Coutermarsh - https://app.planetscale.com/mike/example-db/deploy-requests/16
Keeping our team informed right in Slack as changes are being made to our database.
With webhooks, you no longer need to poll the API for updates, like the latest status of a deploy request or when a branch is ready. If you need to take action or need more data, each webhook event pairs nicely with the PlanetScale API for further information or action.
If you are on a Hobby, Scaler, or Scaler Pro plan and are a database administrator in your organization, you can start using webhooks today. You can create a webhook by visiting your database's settings page.
If you are on an Enterprise plan, contact your account manager to enable webhooks in your organization.
See our webhooks overview docs for how to create and validate a webhook and what events can trigger a webhook.
Currently, webhooks are in beta. During this beta phase, we want to hear from you. We picked the webhook events based on the feedback we have heard from users. If you want to see other events for future integrations, please contact us to share. Also, we would love to see what you are building on top of webhooks! Let us know on Twitter by tagging @planetscale!