Skip to content

Instantly share code, notes, and snippets.

@shuantsu
Last active May 4, 2026 00:19
Show Gist options
  • Select an option

  • Save shuantsu/ca7049f12f11342090c9823fd8f131d7 to your computer and use it in GitHub Desktop.

Select an option

Save shuantsu/ca7049f12f11342090c9823fd8f131d7 to your computer and use it in GitHub Desktop.
n8n pwa
{
"nodes": [
{
"parameters": {
"path": "meu-pwa",
"responseMode": "responseNode",
"options": {}
},
"type": "n8n-nodes-base.webhook",
"typeVersion": 2.1,
"position": [
-672,
240
],
"id": "4440713b-8a9b-48e8-bbba-31501bc09407",
"name": "Webhook",
"webhookId": "a9226b44-a7bc-45c8-a853-61231eea268f"
},
{
"parameters": {
"mode": "expression",
"numberOutputs": 3,
"output": "={{ ['sw','manifest'].indexOf($json.query.file) + 1 }}"
},
"type": "n8n-nodes-base.switch",
"typeVersion": 3.4,
"position": [
-448,
224
],
"id": "d5ef387a-6e31-4f3e-bf71-bc0b5f254700",
"name": "Router",
"notesInFlow": true
},
{
"parameters": {
"respondWith": "text",
"responseBody": "self.addEventListener('fetch', (event) => {});",
"options": {
"responseHeaders": {
"entries": [
{
"name": "Content-Type",
"value": "application/javascript"
}
]
}
}
},
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1.5,
"position": [
-224,
240
],
"id": "aae1fd71-291f-4a16-b531-6e98d447295c",
"name": "Service Worker"
},
{
"parameters": {
"respondWith": "text",
"responseBody": "{\n \"name\": \"N8N App\",\n \"short_name\": \"n8n\",\n \"display\": \"standalone\",\n \"start_url\": \"/webhook/meu-pwa\",\n \"background_color\": \"#ffffff\",\n \"theme_color\": \"#ff6d5a\",\n \"icons\": [\n {\n \"src\": \"https://www.gstatic.com/images/branding/product/2x/googleg_96dp.png\",\n \"sizes\": \"192x192\",\n \"type\": \"image/png\",\n \"purpose\": \"any maskable\"\n }\n ]\n}",
"options": {
"responseHeaders": {
"entries": [
{
"name": "Content-Type",
"value": "application/json"
}
]
}
}
},
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1.5,
"position": [
-224,
432
],
"id": "02589125-d0a0-448a-9152-9fc1ee7f2bee",
"name": "Manifest"
},
{
"parameters": {
"respondWith": "text",
"responseBody": "<!DOCTYPE html>\n<html>\n <head>\n <meta charset=\"UTF-8\"><link rel=\"manifest\" href=\"/webhook/meu-pwa?file=manifest\">\n </head>\n <body>\n <h1>App n8n</h1>\n <script>if (\"serviceWorker\" in navigator) { navigator.serviceWorker.register(\"/webhook/meu-pwa?file=sw\").then(() => console.log(\"SW registrado!\")); }\n </script>\n </body>\n</html>",
"options": {
"responseHeaders": {
"entries": [
{
"name": "Content-Type",
"value": "text/html"
}
]
}
}
},
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1.5,
"position": [
-224,
48
],
"id": "b9d5c6cf-f9dd-4424-95d0-9f258a97ecfa",
"name": "App"
}
],
"connections": {
"Webhook": {
"main": [
[
{
"node": "Router",
"type": "main",
"index": 0
}
]
]
},
"Router": {
"main": [
[
{
"node": "App",
"type": "main",
"index": 0
}
],
[
{
"node": "Service Worker",
"type": "main",
"index": 0
}
],
[
{
"node": "Manifest",
"type": "main",
"index": 0
}
]
]
}
},
"pinData": {},
"meta": {
"instanceId": "68c5b1e7d4ce7d3520d2dbfe422bbdf31a153397dbe227bfcd16a1fdfa065f0d"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment