The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"name": "Webhook - MySQL Logger",
"nodes": [
{
"parameters": {
"httpMethod": "POST",
"path": "webhook-mysql-logger",
"responseMode": "responseNode",
"options": {}
},
"id": "02-webhook-trigger",
"name": "Webhook Trigger",
"type": "n8n-nodes-base.webhook",
"typeVersion": 2,
"position": [
-700,
0
]
},
{
"parameters": {
"jsCode": "const body = $json.body || $json;\nconst missing = ['source', 'event_type', 'payload'].filter((field) => body[field] === undefined || body[field] === null || body[field] === '');\nif (missing.length) {\n return [{ json: { ok: false, statusCode: 400, error: `Missing required fields: ${missing.join(', ')}` } }];\n}\nreturn [{ json: { ok: true, body } }];"
},
"id": "02-validate-payload",
"name": "Validate Payload",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-460,
0
]
},
{
"parameters": {
"conditions": {
"boolean": [
{
"value1": "={{$json.ok}}",
"value2": true
}
]
}
},
"id": "02-payload-valid",
"name": "Payload Valid?",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
-220,
0
]
},
{
"parameters": {
"jsCode": "const body = $json.body;\nreturn [{ json: { source: String(body.source).slice(0, 120), event_type: String(body.event_type).slice(0, 120), payload_json: JSON.stringify({ payload: body.payload, timestamp: body.timestamp || new Date().toISOString() }), status: 'received' } }];"
},
"id": "02-normalize-payload",
"name": "Normalize Payload",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
20,
-120
]
},
{
"parameters": {
"operation": "insert",
"table": "webhook_logs",
"columns": "source,event_type,payload_json,status",
"options": {}
},
"id": "02-mysql-insert",
"name": "MySQL Insert",
"type": "n8n-nodes-base.mySql",
"typeVersion": 2.4,
"position": [
260,
-120
],
"credentials": {
"mySql": {
"name": "<your credential>"
}
},
"continueOnFail": true
},
{
"parameters": {
"respondWith": "json",
"responseBody": "={{ { ok: true, status: 'logged' } }}",
"options": {
"responseCode": 201
}
},
"id": "02-success-response",
"name": "Success Response",
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1.1,
"position": [
520,
-120
]
},
{
"parameters": {
"respondWith": "json",
"responseBody": "={{ { ok: false, error: $json.error || 'Failed to log webhook payload' } }}",
"options": {
"responseCode": "={{$json.statusCode || 500}}"
}
},
"id": "02-error-response",
"name": "Error Response",
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1.1,
"position": [
40,
160
]
}
],
"connections": {
"Webhook Trigger": {
"main": [
[
{
"node": "Validate Payload",
"type": "main",
"index": 0
}
]
]
},
"Validate Payload": {
"main": [
[
{
"node": "Payload Valid?",
"type": "main",
"index": 0
}
]
]
},
"Payload Valid?": {
"main": [
[
{
"node": "Normalize Payload",
"type": "main",
"index": 0
}
],
[
{
"node": "Error Response",
"type": "main",
"index": 0
}
]
]
},
"Normalize Payload": {
"main": [
[
{
"node": "MySQL Insert",
"type": "main",
"index": 0
}
]
]
},
"MySQL Insert": {
"main": [
[
{
"node": "Success Response",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {
"executionOrder": "v1"
},
"versionId": "placeholder-02"
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
mySql
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Webhook - MySQL Logger. Uses mySql. Webhook trigger; 7 nodes.
Source: https://github.com/gharisj3/n8n-workflow-library/blob/main/workflows/02-webhook-mysql-logger/workflow.json — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
BP_check. Uses googleSheets, @n-octo-n/n8n-nodes-json-database, httpRequest, itemLists. Webhook trigger; 99 nodes.
v25.1.3. Uses httpRequest, mySql, n8n-nodes-zohozeptomail. Webhook trigger; 98 nodes.
N8Nworkflow. Uses stopAndError, httpRequest, mySql. Webhook trigger; 22 nodes.
This workflow demonstrates how to export SQL to XML and present the data nicely formatted using an XSL Template.