Skip to content

Template — Webhook API Gateway

This template shows how to build a complete REST API gateway in Floogos using two nodes: Webhook Router (splits traffic by verb) and Webhook Filter (validates each branch). The result behaves like a real HTTP API endpoint supporting GET, POST, PUT and DELETE.

API Gateway by method

Each branch is independent. Adding a new verb is as simple as connecting one more handle.


Drag a Webhook node to the canvas. This is your single API entry point — one URL handles all methods.

No special configuration needed. The webhook automatically captures the HTTP method and passes it as data._request.method.


Drag a Webhook Router node and connect it to the Webhook output.

This node has no configuration — just wire the output handles:

HandleWire to
GETNext Webhook Filter for GET
POSTNext Webhook Filter for POST
PUTNext Webhook Filter for PUT
DELETENext Webhook Filter for DELETE
DefaultWeb Response (405)

Add one Webhook Filter per branch to validate the payload before business logic runs.

{
"allowGET": true,
"requiredFields": [],
"errorCode": "400",
"errorBody": {}
}

GET requests often have no required body fields. Leave requiredFields empty if query parameters are optional.

POST branch — validate required body fields

Section titled “POST branch — validate required body fields”
{
"allowPOST": true,
"requiredFields": ["name", "email"],
"errorCode": "422",
"errorBody": {
"success": false,
"message": "Missing required fields: name and email are required."
}
}
{
"allowPUT": true,
"requiredFields": ["id", "name"],
"errorCode": "422",
"errorBody": {
"success": false,
"message": "Missing required fields: id and name are required for update."
}
}
{
"allowDELETE": true,
"requiredFields": ["id"],
"errorCode": "400",
"errorBody": {
"success": false,
"message": "Field 'id' is required for deletion."
}
}

:::note One method per filter Each Webhook Filter should only have one method enabled (the one that corresponds to its branch). The Router already ensures only the right method arrives on each branch, but having a single method enabled makes the intent explicit. :::


After each Webhook Filter, add the nodes that perform the actual work.

GET branch example — query a database:

Webhook Filter → SQL Query (SELECT * WHERE id = {{data.id}}) → Web Response 200

POST branch example — insert a record:

Webhook Filter → EditFields (format data) → SQL Query (INSERT) → Web Response 201

PUT branch example — update a record:

Webhook Filter → SQL Query (UPDATE WHERE id = {{data.id}}) → Web Response 200

DELETE branch example — delete a record:

Webhook Filter → SQL Query (DELETE WHERE id = {{data.id}}) → Web Response 204

Add a Web Response at the end of each branch with the appropriate HTTP code.

BranchHTTP CodeTypical body
GET (found)200Result data
GET (not found)404{ "error": "Not found" }
POST (created)201Created record
PUT (updated)200Updated record
DELETE (deleted)204(empty body)
Default (wrong method)405{ "error": "Method Not Allowed" }

Web Response 405 configuration (Default branch):

{
"code_response": 405,
"body_response": {
"error": true,
"message": "Method not allowed. Supported methods: GET, POST, PUT, DELETE."
},
"headers": {
"Allow": "GET, POST, PUT, DELETE"
}
}

NodeCountPurpose
Webhook1Single API entry point
Webhook Router1Split traffic by HTTP method
Webhook Filter4Validate payload per branch
[Business logic nodes]4+SQL Query, HTTP, DataStore, etc.
Web Response5+Return HTTP responses

Use Postman, curl, or any HTTP client to test each branch:

Ventana de terminal
# GET — list items
curl -X GET https://your-webhook-url
# POST — create item
curl -X POST https://your-webhook-url \
-H "Content-Type: application/json" \
-d '{"name": "Alice", "email": "alice@example.com"}'
# PUT — update item
curl -X PUT https://your-webhook-url \
-H "Content-Type: application/json" \
-d '{"id": 42, "name": "Alice Updated"}'
# DELETE — delete item
curl -X DELETE https://your-webhook-url \
-H "Content-Type: application/json" \
-d '{"id": 42}'
# PATCH — should return 405
curl -X PATCH https://your-webhook-url

Expected behavior:

RequestExpected response
GET200 + data
POST with name+email201 + created record
POST without email422 + error message
PUT with id+name200 + updated record
DELETE with id204
PATCH405 Method Not Allowed

Variation A — Single Filter instead of Router (simpler API)

Section titled “Variation A — Single Filter instead of Router (simpler API)”

If you only accept POST:

Webhook → Webhook Filter (allowPOST, requiredFields) → Business Logic → Web Response

Use Webhook Router only when you need to handle multiple methods on the same endpoint.

Add an HTTP Request node before the Router to call an auth service:

Gateway with authentication

Variation C — Rate limiting with DataStore

Section titled “Variation C — Rate limiting with DataStore”

Gateway with rate limit