๐ฌ Extract structured JSON from web pages via a webhook API with Gaffa
โก 0 views ยท ๐ฌ Document Extraction & Analysis
Description
Quick overview
This workflow exposes a secured webhook that accepts a URL and a field schema, then uses Gaffa to load the web page and return structured JSON for the requested fields, with caching support and clear 400/502 error responses.
How it works
- Receives a POST request on a webhook endpoint secured with Header Auth.
- Validates the JSON body (url, optional selector, and a non-empty fields schema with supported types) and returns HTTP 400 with an error message if validation fails.
- Builds a Gaffa
parse_jsonextraction request, including a configurablemax_cache_ageto allow cached results. - Sends the request to Gaffa to render the page and extract the requested fields into structured JSON.
- Returns HTTP 200 with the extracted data and a
from_cacheflag when extraction succeeds, or HTTP 502 with Gaffaโs error message when it fails.
Setup
- Install the community node
@gaffa-dev/n8n-nodes-gaffain your n8n instance. - Create a Gaffa account, generate an API key, and add it in n8n as a Gaffa API credential.
- Create a Header Auth credential (for example,
X-API-Key) and select it on the webhook so callers must include the secret header. - Deploy the workflow and configure your client to POST JSON to the production webhook URL with
Content-Type: application/json, includingurl,fields, and optionalselector.
๐ Nodes Used
Webhook
๐ฅ Import
Download workflow.json and import into n8n:
Workflow menu โ Import from File