Hey there,
Thanks to everyone who has pre-ordered
The No Code Startup, the response has been incredible and I’m so excited to be working on it.
This week’s topic is adding webhooks to your app.
Until a few years ago, I used to find using and interacting with APIs super intimidating.
If you’re not a coder, they can be a bit intimidating and technical when getting started.
Webhooks are an awesome way to get started, and they can help add some super powerful features to your application.
At the most basic level - they allow your application to send and receive payloads of data.
This is super powerful as it can allow your application to do things in the background even when a user isn’t directly interacting with it.
My own app UserLoop relies on webhooks extensively. Once a user has connected their Shopify account, my application receives a webhook whenever one of their customers completes an order on their Shopify store.
The webhook payload contains tons of useful data and allows my application to trigger things like sending an email, all automatically.
This is just one example of the kinds of things you can do with webhooks, but the sky is really the limit!
In this issue, I’m going to cover two key use cases…
-
Receiving webhook data into your app and triggering actions.
-
Adding webhooks to your own application so users can be notified of changes to their own endpoints.
Receiving Webhook Data
The first example we’re going to look at is receiving webhooks into your Bubble app which you can then use to trigger off workflow actions.
To do this, we need to head to the ‘API Workflow’ section in Bubble.
This is where we can set up an endpoint for our app to ‘listen’ for webhooks.
To get started, set up a new workflow.
In my example, I’m going to give my API endpoint the name ‘send-survey’
There’s a couple of options you might want to set up here…
-
Expose this public API workflow - this means the webhook endpoint can be called from outside your application
-
This workflow can be run without authentication. In my example, I’m not worried about authenticating calls as this is an open endpoint. If you want to add your own authentication I covered this in a previous newsletter.
-
Ignore privacy rules when running the workflow. For the purposes of this demo I’m not worried about privacy rules.
Then to define what fields your webhook endpoint will accept, you have 2 options.
-
Manual Definition. You can enter manually the fields your endpoint is expecting. Any calls your endpoint receives will need to match the scheme you define here.
-
Detect Request Data. This option lets you make a test call to the webhook, which Bubble with then use to automatically set up the fields & data structure for you.