{ "id": "ReXF4z8ZKcEd6Kea", "meta": { "instanceId": "workflow-63ed8b14", "versionId": "1.0.0", "createdAt": "2025-09-29T07:07:50.076384", "updatedAt": "2025-09-29T07:07:50.076403", "owner": "n8n-user", "license": "MIT", "category": "automation", "status": "active", "priority": "high", "environment": "production" }, "name": "dub.co URL Shortener", "tags": [ "automation", "n8n", "production-ready", "excellent", "optimized" ], "nodes": [ { "id": "63170148-b769-43b6-9a7a-02baa9f76b02", "name": "Sticky Note1", "type": "n8n-nodes-base.stickyNote", "position": [ 1480, 1100 ], "parameters": { "color": 4, "width": 346.4519761795601, "height": 227.3959699655325, "content": "## Dub.co API Limits:\nDub’s API is capped at 10 requests per second per user." }, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow." }, { "id": "defd82ef-25a0-4aa4-8681-d352e5fe8275", "name": "When clicking \"Test Workflow\"", "type": "n8n-nodes-base.manualTrigger", "position": [ 1231, 560 ], "parameters": {}, "typeVersion": 1, "notes": "This manualTrigger node performs automated tasks as part of the workflow." }, { "id": "fec7fb8a-3f88-4de9-8392-5c7929a712e7", "name": "Sticky Note4", "type": "n8n-nodes-base.stickyNote", "disabled": true, "position": [ 1480, 460 ], "parameters": { "color": 4, "width": 826.4578951225271, "height": 605.7992490141105, "content": "## Dub.co API\n**Create** Link. [Based on their API docs]({{ $env.API_BASE_URL }}" }, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow." }, { "id": "8c87aad8-519c-491b-b272-f21dfd5b069f", "name": "Sticky Note5", "type": "n8n-nodes-base.stickyNote", "position": [ 1171, 460 ], "parameters": { "height": 870.5323777622334, "content": "## Control Stack" }, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow." }, { "id": "a6cfe224-95d9-47d6-a900-667eed065264", "name": "Sticky Note6", "type": "n8n-nodes-base.stickyNote", "position": [ 486, 460 ], "parameters": { "width": 655.6800599837106, "height": 462.29577922809585, "content": "# README\n\n## Dub.co API Workflow Configuration\n| Required | Input Field | Description |\n|----------|-----------------------|--------------------------------------------------|\n|✓| **`Dub API Key`** | _API Key for Dub.co integration._ |\n|✓| **`Long URL`** | _The long URL to be shortened._ |\n| | **`Custom Slug`** | _Slug is the path of shortened URL - default is random 7 characters._ |\n|✓| **`Project Slug`** | _Enter Your Dub project slug, The slug for the project to create links for. E.g. for app.dub.co/acme, the project slug is 'acme'._ |\n| | **`Custom Domain`** | _Custom domain linked to Dub.co._ |\n\n\n\n\n\n\n\nYou'll need to add the details listed above in the \"API Auth\" node by clicking on it and filling the fields ==>" }, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow." }, { "id": "f3164150-9730-4d20-9aef-9ae7f84e73fc", "name": "API Auth", "type": "n8n-nodes-base.set", "position": [ 1240, 820 ], "parameters": { "fields": { "values": [ { "name": "Dub API Key", "stringValue": "=" }, { "name": "Long URL", "stringValue": "{{ $env.WEBHOOK_URL }}" }, { "name": "Custom Slug", "stringValue": "=" }, { "name": "Project Slug", "stringValue": "=" }, { "name": "Custom Domain", "stringValue": "=" } ] }, "options": {} }, "typeVersion": 3.2, "notes": "This set node performs automated tasks as part of the workflow." }, { "id": "a2279ab1-6550-43ef-a41d-c24c669bb2b6", "name": "CREATE", "type": "n8n-nodes-base.httpRequest", "notes": "Create Link", "position": [ 1540, 560 ], "parameters": { "url": "{{ $env.API_BASE_URL }}", "method": "POST", "options": { "batching": { "batch": { "batchSize": 10, "batchInterval": 60000 } }, "redirect": { "redirect": {} }, "response": { "response": { "neverError": true, "fullResponse": true } }, "allowUnauthorizedCerts": true }, "jsonBody": "={\n{{ $ifEmpty(`\"domain\": \"${$json[\"Custom Domain\"] || \"undefined\"}\",`, \"\").replace('\"domain\": \"\",', \"\").replace('\"domain\": \"undefined\",', \"\") }}\n{{ $ifEmpty(`\"key\": \"${$json[\"Custom Slug\"] || \"undefined\"}\",`, \"\").replace('\"key\": \"\",', \"\").replace('\"key\": \"undefined\",', \"\") }}\n \"url\": \"{{ $json[\"Long URL\"] }}\",\n \"comments\": \"Updated using N8N.io workflow: {{$workflow.name}}\"\n}", "sendBody": true, "sendQuery": true, "sendHeaders": true, "specifyBody": "json", "queryParameters": { "parameters": [ { "name": "projectSlug", "value": "={{ $json[\"Project Slug\"] }}" } ] }, "headerParameters": { "parameters": [ { "name": "Authorization", "value": "=Bearer {{ $json['Dub API Key'] }}" } ] } }, "notesInFlow": true, "typeVersion": 4.1, "alwaysOutputData": true }, { "id": "970d062f-9206-4ec6-acdd-3fc1cc87db69", "name": "IF Slug available", "type": "n8n-nodes-base.if", "position": [ 1760, 560 ], "parameters": { "conditions": { "string": [ { "value1": "={{ $json.statusCode }}", "value2": "200", "operation": "regex" } ] } }, "typeVersion": 1, "notes": "This if node performs automated tasks as part of the workflow." }, { "id": "d25eedfd-95a7-4c17-8a76-1cdfae6670d1", "name": "RETRIEVE", "type": "n8n-nodes-base.httpRequest", "notes": "Retrieve the link id", "position": [ 1540, 840 ], "parameters": { "url": "{{ $env.BASE_URL }}", "options": { "batching": { "batch": { "batchSize": 10, "batchInterval": 60000 } }, "redirect": { "redirect": {} }, "response": { "response": { "neverError": true, "fullResponse": true } }, "allowUnauthorizedCerts": true }, "sendQuery": true, "sendHeaders": true, "queryParameters": { "parameters": [ { "name": "projectSlug", "value": "={{ $('API Auth').item.json[\"Project Slug\"] }}" }, { "name": "key", "value": "={{ $('API Auth').item.json[\"Custom Slug\"] }}" }, { "name": "domain", "value": "={{ $('API Auth').item.json[\"Custom Domain\"] }}" } ] }, "headerParameters": { "parameters": [ { "name": "Authorization", "value": "=Bearer {{ $('API Auth').item.json[\"Dub API Key\"] }}" } ] } }, "notesInFlow": true, "typeVersion": 4.1, "alwaysOutputData": true }, { "id": "18bf5187-422c-486e-84c4-c2f79855ba25", "name": "UPDATE", "type": "n8n-nodes-base.httpRequest", "notes": "Update Link", "position": [ 1780, 840 ], "parameters": { "url": "{{ $env.BASE_URL }}", "method": "PUT", "options": { "batching": { "batch": { "batchSize": 10, "batchInterval": 60000 } }, "redirect": { "redirect": {} }, "response": { "response": { "neverError": true, "fullResponse": true } }, "allowUnauthorizedCerts": true }, "jsonBody": "={\n {{ $ifEmpty(`\"domain\": \"${$('API Auth').item.json[\"Custom Domain\"] || \"undefined\"}\",`, \"\").replace('\"domain\": \"\",', \"\").replace('\"domain\": \"undefined\",', \"\") }}\n{{ $ifEmpty(`\"key\": \"${$('API Auth').item.json[\"Custom Slug\"] || \"undefined\"}\",`, \"\").replace('\"key\": \"\",', \"\").replace('\"key\": \"undefined\",', \"\") }}\n\n \"url\": \"{{ $('API Auth').item.json[\"Long URL\"] }}\",\n \"comments\": \"Updated using N8N.io workflow: {{$workflow.name}}\"\n}", "sendBody": true, "sendQuery": true, "sendHeaders": true, "specifyBody": "json", "queryParameters": { "parameters": [ { "name": "projectSlug", "value": "={{ $('API Auth').item.json[\"Project Slug\"] }}" } ] }, "headerParameters": { "parameters": [ { "name": "Authorization", "value": "=Bearer {{ $('API Auth').item.json[\"Dub API Key\"] }}" } ] } }, "notesInFlow": true, "typeVersion": 4.1, "alwaysOutputData": true }, { "id": "c16dc19b-f807-4784-a323-5d790cebe718", "name": "Shortened URL", "type": "n8n-nodes-base.set", "position": [ 2120, 840 ], "parameters": { "values": { "string": [ { "name": "Shortened URL", "value": "={{ $json.body.shortLink }}" } ] }, "options": {}, "keepOnlySet": true }, "typeVersion": 2, "notes": "This set node performs automated tasks as part of the workflow." }, { "id": "44d31a47-dd84-4b07-a606-2da99a73cad1", "name": "Done", "type": "n8n-nodes-base.set", "position": [ 1240, 1060 ], "parameters": { "options": {} }, "typeVersion": 3.2, "notes": "This set node performs automated tasks as part of the workflow." } ], "active": false, "pinData": {}, "settings": { "executionOrder": "v1", "saveManualExecutions": true, "callerPolicy": "workflowsFromSameOwner", "errorWorkflow": null, "timezone": "UTC", "executionTimeout": 3600, "maxExecutions": 1000, "retryOnFail": true, "retryCount": 3, "retryDelay": 1000 }, "versionId": "3b5edd9c-e373-4dc1-95d0-b320beb47020", "connections": { "a2279ab1-6550-43ef-a41d-c24c669bb2b6": { "main": [ [ { "node": "error-handler-a2279ab1-6550-43ef-a41d-c24c669bb2b6", "type": "main", "index": 0 } ], [ { "node": "error-handler-a2279ab1-6550-43ef-a41d-c24c669bb2b6-1e7b5c37", "type": "main", "index": 0 } ], [ { "node": "error-handler-a2279ab1-6550-43ef-a41d-c24c669bb2b6-c124dbd3", "type": "main", "index": 0 } ], [ { "node": "error-handler-a2279ab1-6550-43ef-a41d-c24c669bb2b6-c6bc496d", "type": "main", "index": 0 } ], [ { "node": "error-handler-a2279ab1-6550-43ef-a41d-c24c669bb2b6-552555c5", "type": "main", "index": 0 } ] ] }, "d25eedfd-95a7-4c17-8a76-1cdfae6670d1": { "main": [ [ { "node": "error-handler-d25eedfd-95a7-4c17-8a76-1cdfae6670d1", "type": "main", "index": 0 } ], [ { "node": "error-handler-d25eedfd-95a7-4c17-8a76-1cdfae6670d1-c1076b59", "type": "main", "index": 0 } ], [ { "node": "error-handler-d25eedfd-95a7-4c17-8a76-1cdfae6670d1-7e8c6c8e", "type": "main", "index": 0 } ], [ { "node": "error-handler-d25eedfd-95a7-4c17-8a76-1cdfae6670d1-18555da3", "type": "main", "index": 0 } ], [ { "node": "error-handler-d25eedfd-95a7-4c17-8a76-1cdfae6670d1-84f45816", "type": "main", "index": 0 } ] ] }, "18bf5187-422c-486e-84c4-c2f79855ba25": { "main": [ [ { "node": "error-handler-18bf5187-422c-486e-84c4-c2f79855ba25", "type": "main", "index": 0 } ], [ { "node": "error-handler-18bf5187-422c-486e-84c4-c2f79855ba25-9b18f6a1", "type": "main", "index": 0 } ], [ { "node": "error-handler-18bf5187-422c-486e-84c4-c2f79855ba25-52618c7d", "type": "main", "index": 0 } ], [ { "node": "error-handler-18bf5187-422c-486e-84c4-c2f79855ba25-a9dba7fb", "type": "main", "index": 0 } ], [ { "node": "error-handler-18bf5187-422c-486e-84c4-c2f79855ba25-aa6ede9f", "type": "main", "index": 0 } ] ] } }, "description": "Automated workflow: dub.co URL Shortener. This workflow integrates 6 different services: stickyNote, httpRequest, set, stopAndError, manualTrigger. It contains 18 nodes and follows best practices for error handling and security.", "notes": "Excellent quality workflow: dub.co URL Shortener. This workflow has been optimized for production use with comprehensive error handling, security, and documentation." }