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": "wf-owner-toggle",
"nodes": [
{
"parameters": {
"httpMethod": "POST",
"path": "owner-toggle",
"responseMode": "responseNode",
"options": {}
},
"id": "c1b2c3d4-0001-4000-8000-000000000001",
"name": "Owner Toggle Webhook",
"type": "n8n-nodes-base.webhook",
"typeVersion": 2,
"position": [
250,
300
]
},
{
"parameters": {
"jsCode": "// Parse request\nconst message = $input.first().json.body?.body || $input.first().json.body?.message || '';\nconst from = $input.first().json.body?.from || $input.first().json.body?.sender || '';\n\n// Determine action\nconst action = message.toLowerCase().includes('tutup') ? 'close' : 'open';\n\n// Check if message contains PIN (6 digits)\nconst pinMatch = message.match(/\\d{6}/);\nconst pin = pinMatch ? pinMatch[0] : null;\n\nreturn {\n from: from,\n message: message,\n action: action,\n pin: pin,\n needsPin: !pin\n};"
},
"id": "c1b2c3d4-0002-4000-8000-000000000002",
"name": "Parse Request",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
450,
300
]
},
{
"parameters": {
"rules": {
"values": [
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"type": "boolean"
},
"conditions": [
{
"leftValue": "={{ $json.needsPin }}",
"rightValue": true,
"operator": {
"type": "boolean",
"operation": "equals"
}
}
]
},
"renameOutput": true,
"outputKey": "need_pin"
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"type": "boolean"
},
"conditions": [
{
"leftValue": "={{ $json.needsPin }}",
"rightValue": false,
"operator": {
"type": "boolean",
"operation": "equals"
}
}
]
},
"renameOutput": true,
"outputKey": "verify_pin"
}
]
},
"options": {}
},
"id": "c1b2c3d4-0003-4000-8000-000000000003",
"name": "Check PIN Status",
"type": "n8n-nodes-base.switch",
"typeVersion": 3,
"position": [
650,
300
]
},
{
"parameters": {
"jsCode": "// Request PIN\nconst action = $input.first().json.action === 'close' ? 'TUTUP' : 'BUKA';\n\nreturn {\n to: $input.first().json.from,\n message: `Anda akan ${action} LAPAK.\\nMasukkan PIN Owner Anda (6 digit):`\n};"
},
"id": "c1b2c3d4-0004-4000-8000-000000000004",
"name": "Request PIN",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
850,
200
]
},
{
"parameters": {
"url": "http://dashboard-kecamatan-nginx/api/v1/external/owner/verify-pin",
"method": "POST",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={{ { \"phone\": $json.from, \"pin\": $json.pin } }}",
"options": {}
},
"id": "c1b2c3d4-0005-4000-8000-000000000005",
"name": "Verify PIN API",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.1,
"position": [
850,
400
]
},
{
"parameters": {
"jsCode": "// Handle verification result\nconst success = $input.first().json.success;\n\nif (!success) {\n return {\n to: $input.first().json.from,\n message: 'PIN salah. Silakan coba lagi.\\n\\nKetik MENU untuk kembali.'\n };\n}\n\n// PIN verified, now toggle the listing\nconst listingId = $input.first().json.data?.listing_id;\nconst listingType = $input.first().json.data?.listing_type;\nconst listingName = $input.first().json.data?.listing_name;\nconst action = $input.first().json.action;\n\nreturn {\n to: $input.first().json.from,\n pin: $input.first().json.pin,\n listing_id: listingId,\n listing_type: listingType,\n listing_name: listingName,\n action: action,\n verified: true\n};"
},
"id": "c1b2c3d4-0006-4000-8000-000000000006",
"name": "Handle Verification",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1050,
400
]
},
{
"parameters": {
"url": "http://dashboard-kecamatan-nginx/api/v1/external/owner/toggle-listing",
"method": "POST",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={{ { \"phone\": $json.to, \"pin\": $json.pin, \"listing_id\": $json.listing_id, \"listing_type\": $json.listing_type, \"action\": $json.action } }}",
"options": {}
},
"id": "c1b2c3d4-0007-4000-8000-000000000007",
"name": "Toggle Listing API",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.1,
"position": [
1250,
400
]
},
{
"parameters": {
"jsCode": "// Format toggle response\nconst message = $input.first().json.message || 'Lapak berhasil diubah.';\n\nreturn {\n to: $input.first().json.to,\n message: message + '\\n\\nKetik MENU untuk kembali.'\n};"
},
"id": "c1b2c3d4-0008-4000-8000-000000000008",
"name": "Format Response",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1450,
400
]
},
{
"parameters": {
"respondWith": "json",
"responseBody": "={{ { \"to\": $json.to, \"message\": $json.message } }}",
"options": {}
},
"id": "c1b2c3d4-0009-4000-8000-000000000009",
"name": "Respond to Webhook",
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1,
"position": [
1650,
300
]
}
],
"connections": {
"Owner Toggle Webhook": {
"main": [
[
{
"node": "Parse Request",
"type": "main",
"index": 0
}
]
]
},
"Parse Request": {
"main": [
[
{
"node": "Check PIN Status",
"type": "main",
"index": 0
}
]
]
},
"Check PIN Status": {
"main": [
[
{
"node": "Request PIN",
"type": "main",
"index": 0
}
],
[
{
"node": "Verify PIN API",
"type": "main",
"index": 0
}
]
]
},
"Request PIN": {
"main": [
[
{
"node": "Respond to Webhook",
"type": "main",
"index": 0
}
]
]
},
"Verify PIN API": {
"main": [
[
{
"node": "Handle Verification",
"type": "main",
"index": 0
}
]
]
},
"Handle Verification": {
"main": [
[
{
"node": "Toggle Listing API",
"type": "main",
"index": 0
}
]
]
},
"Toggle Listing API": {
"main": [
[
{
"node": "Format Response",
"type": "main",
"index": 0
}
]
]
},
"Format Response": {
"main": [
[
{
"node": "Respond to Webhook",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {
"callerPolicy": "workflowsFromSameOwner",
"availableInMCP": false
},
"staticData": null,
"meta": null
}
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
wf-owner-toggle. Uses httpRequest. Webhook trigger; 9 nodes.
Source: https://github.com/benchoaz/KecamatanSAE_final_version/blob/4b5ffebffbf40b8fd53ea57cd13f9523c085c953/n8n-workflows/wf-owner-toggle.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.
This n8n template provides enterprise-level version control for your workflows using GitHub integration. Stop losing hours to broken workflows and manual exports – get proper commit history, visual di
This flow creates dummy files for every item added in your *Arrs (Radarr/Sonarr) with the tag .
eek-Go v2 (Batch-Then-Review). Uses httpRequest. Webhook trigger; 75 nodes.
This workflow receives webhook requests from a content calendar and uses the X API v2 to publish text posts, threads, image/video posts, and polls, as well as delete existing posts and run a credentia
This workflow acts as a central API gateway for all technical indicator agents in the Binance Spot Market Quant AI system. It listens for incoming webhook requests and dynamically routes them to the c