๐ฅ Manage job records via webhook REST API with PostgreSQL
โก 44 views ยท ๐ฅ HR & Recruitment
Description
Quick overview
This workflow exposes a header-authenticated webhook REST API that performs CRUD operations on a PostgreSQL jobs table, letting you create, list, update, and delete job records and returning either JSON results or an error message to the caller.
How it works
- Receives a POST request via a webhook secured with HTTP header authentication.
- Reads the request bodyโs
actionvalue and routes the request to the matching operation (list, create, update, or delete). - For
list, queries PostgreSQL for up to 100 jobs ordered bycreated_atand returns the rows in the webhook response. - For
create, inserts a new job (title, description, requirements) into PostgreSQL with status set toopenand returns a 200 response. - For
update, updates the specified job in PostgreSQL using the provided id, fields, and status, then returns a 200 response. - For
delete, deletes the specified job by id in PostgreSQL and returns a 200 response. - If any database operation fails, returns a 500 response with an operation-specific error message.
Setup
- Create the required PostgreSQL
jobstable (id, title, description, requirements, status, created_at) and ensure the database is reachable from n8n. - Add a PostgreSQL credential in n8n and select it in the PostgreSQL nodes.
- Create an HTTP Header Auth credential (for example header name
x-api-keywith your secret value) and attach it to the webhook. - Set the webhook path to your desired endpoint and configure your client to send POST requests with the correct JSON body for
action(and required fields likeid,title,status).
๐ Nodes Used
Postgres, Webhook
๐ฅ Import
Download workflow.json and import into n8n:
Workflow menu โ Import from File