Webhooks
Learn how to use webhooks with the GeneratedBy API.
In this section, we will guide you on how to use webhooks with the GeneratedBy API. Webhooks allow you to receive real-time HTTP notifications of changes to specific objects in the GeneratedBy platform.
Setting up a Webhook
Before you can use webhooks, you need to set them up in your GeneratedBy account. Here's how you can do it:
- Log in to your GeneratedBy account.
- Navigate to the Applications section.
- Select the application for which you want to set up a webhook.
- Go to the Webhooks section and click on the "Add Webhook" button.
- Enter the URL where you want to receive the webhook payloads and select the events for which you want to receive notifications.
- Click on the "Save" button to save the webhook.
Receiving a Webhook
Webhooks are sent as HTTP POST requests to the URL that you specified when setting up the webhook. The body of the request contains the payload in JSON format.
Here is an example of how to set up a server to receive and handle webhook notifications:
Copy code
const express = require("express")
const bodyParser = require("body-parser")
const app = express()
app.use(bodyParser.json())
app.post("/webhook", (req, res) => {
console.log("Received webhook: ", req.body)
// Handle the webhook payload
// ...
res.sendStatus(200)
})
app.listen(3000, () => console.log("Server is listening on port 3000"))
For more details on how to use the API, please refer to the API section of the documentation.