AutomationFlowsData & Sheets › Technical Test Chat2desk Message API

Technical Test Chat2desk Message API

technical-test-chat2desk-message-api. Uses supabase. Webhook trigger; 13 nodes.

Webhook trigger★★★★☆ complexity13 nodesSupabase
Data & Sheets Trigger: Webhook Nodes: 13 Complexity: ★★★★☆ Added:

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 →

Download .json
{
  "name": "technical-test-chat2desk-message-api",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "api/auth/login",
        "responseMode": "lastNode",
        "options": {}
      },
      "id": "e92ef725-05bf-4630-b3df-f9d6d03b53c6",
      "name": "Webhook Login",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [
        0,
        0
      ],
      "alwaysOutputData": true
    },
    {
      "parameters": {
        "functionCode": "const jwt = require('jsonwebtoken');\n\n// Pega input do Webhook\nconst input = $json[0] || $items()[0].json;\nconst { username, password } = input.body || input;\n\n// 1. Valida\u00e7\u00e3o de campos\nif (!username || !password) {\n  return [{\n    json: {\n      type: \"https://example.com/probs/invalid-input\",\n      title: \"Invalid input\",\n      status: 400,\n      detail: \"username and password required\",\n      instance: \"/api/auth/login\"\n    }\n  }];\n}\n\n// 2. Usu\u00e1rio dummy\nconst DUMMY_USER = \"candidate\";\nconst DUMMY_PASS = \"secret\";\n\nif (username !== DUMMY_USER || password !== DUMMY_PASS) {\n  return [{\n    json: {\n      type: \"https://example.com/probs/invalid-input\",\n      title: \"Invalid credentials\",\n      status: 401,\n      detail: \"Username or password is incorrect\",\n      instance: \"/api/auth/login\"\n    }\n  }];\n}\n\n// 3. Criar JWT\nconst token = jwt.sign(\n  { username },\n  process.env.JWT_SECRET || 'minha_chave_teste',\n  { expiresIn: 3600 }\n);\n\n// 4. Retornar JSON para Postman\nreturn [{\n  json: {\n    accessToken: token,\n    tokenType: \"Bearer\",\n    expiresIn: 3600\n  }\n}];\n"
      },
      "id": "5737d0ee-97b9-42d0-bcba-3f6db7c4ee58",
      "name": "Login Function (JWT)",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        304,
        0
      ]
    },
    {
      "parameters": {
        "path": "messages",
        "responseMode": "responseNode",
        "options": {}
      },
      "id": "9b1307fa-ba6e-409d-8413-70417fecabd5",
      "name": "Webhook GET Messages",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [
        -16,
        432
      ]
    },
    {
      "parameters": {
        "operation": "getAll",
        "tableId": "messages"
      },
      "id": "ee0eb23c-61c0-4385-a759-712a07275cc3",
      "name": "Supabase Select Messages",
      "type": "n8n-nodes-base.supabase",
      "typeVersion": 1,
      "position": [
        304,
        432
      ],
      "alwaysOutputData": true,
      "credentials": {
        "supabaseApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "api/messages/",
        "responseMode": "responseNode",
        "options": {}
      },
      "id": "f604d966-6657-4b9a-8399-d1b8d6618d8c",
      "name": "Webhook POST Message",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [
        0,
        224
      ]
    },
    {
      "parameters": {
        "tableId": "messages",
        "fieldsUi": {
          "fieldValues": [
            {
              "fieldId": "title",
              "fieldValue": "={{$json[\"body\"][\"title\"]}}"
            },
            {
              "fieldId": "body",
              "fieldValue": "={{$json[\"body\"][\"body\"]}}"
            },
            {
              "fieldId": "author",
              "fieldValue": "={{$json[\"body\"][\"author\"]}}"
            },
            {
              "fieldId": "status",
              "fieldValue": "={{$json[\"body\"][\"status\"]}}"
            }
          ]
        }
      },
      "id": "49ea5e5f-0c83-48c5-82aa-debb12c9b7c9",
      "name": "Supabase Insert Message",
      "type": "n8n-nodes-base.supabase",
      "typeVersion": 1,
      "position": [
        304,
        224
      ],
      "alwaysOutputData": true,
      "executeOnce": false,
      "retryOnFail": false,
      "credentials": {
        "supabaseApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "path": "api/messages/:id",
        "responseMode": "lastNode",
        "options": {}
      },
      "id": "27507844-2d81-4313-922c-636c821cf6f1",
      "name": "Webhook GET Message by ID",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [
        0,
        640
      ]
    },
    {
      "parameters": {
        "operation": "get",
        "tableId": "messages",
        "filters": {
          "conditions": [
            {
              "keyName": "id",
              "keyValue": "={{ $json.params.id }}"
            }
          ]
        }
      },
      "id": "9c754af0-e48a-4c04-8fb0-22a02c098ffe",
      "name": "Supabase Get by ID",
      "type": "n8n-nodes-base.supabase",
      "typeVersion": 1,
      "position": [
        304,
        640
      ],
      "alwaysOutputData": true,
      "credentials": {
        "supabaseApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "httpMethod": "PUT",
        "path": "api/messages/:id",
        "responseMode": "lastNode",
        "options": {}
      },
      "id": "46fd8433-dfec-4a03-9530-76340ad3d142",
      "name": "Webhook PUT Message",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [
        0,
        848
      ]
    },
    {
      "parameters": {
        "operation": "update",
        "tableId": "messages",
        "filters": {
          "conditions": [
            {
              "keyName": "id",
              "condition": "eq",
              "keyValue": "={{ $json.params.id }}"
            }
          ]
        },
        "fieldsUi": {
          "fieldValues": [
            {
              "fieldId": "title",
              "fieldValue": "={{ $json.body.title }}"
            },
            {
              "fieldId": "body",
              "fieldValue": "={{ $json.body.body }}"
            },
            {
              "fieldId": "status",
              "fieldValue": "={{ $json.body.status }}"
            }
          ]
        }
      },
      "id": "427f2068-5677-4ff6-9511-941b6eaaf9dd",
      "name": "Supabase Update Message",
      "type": "n8n-nodes-base.supabase",
      "typeVersion": 1,
      "position": [
        304,
        848
      ],
      "alwaysOutputData": true,
      "credentials": {
        "supabaseApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "httpMethod": "DELETE",
        "path": "api/messages/:id",
        "responseMode": "lastNode",
        "options": {}
      },
      "id": "2a996219-cc85-4f0b-a488-4f24ee353f10",
      "name": "Webhook DELETE Message",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [
        0,
        1072
      ]
    },
    {
      "parameters": {
        "operation": "delete",
        "tableId": "messages",
        "filters": {
          "conditions": [
            {
              "keyName": "id",
              "condition": "eq",
              "keyValue": "={{ $json.params.id }}"
            }
          ]
        }
      },
      "id": "68755ab6-f26e-4d71-bd21-8031d5434572",
      "name": "Supabase Delete Message",
      "type": "n8n-nodes-base.supabase",
      "typeVersion": 1,
      "position": [
        304,
        1072
      ],
      "alwaysOutputData": true,
      "credentials": {
        "supabaseApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ $items() }}",
        "options": {
          "responseCode": 200
        }
      },
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.4,
      "position": [
        512,
        432
      ],
      "id": "5492c2d0-c5d5-40a3-957f-d5f948ffca5c",
      "name": "Respond to Webhook"
    }
  ],
  "connections": {
    "Webhook Login": {
      "main": [
        [
          {
            "node": "Login Function (JWT)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook GET Messages": {
      "main": [
        [
          {
            "node": "Supabase Select Messages",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook POST Message": {
      "main": [
        [
          {
            "node": "Supabase Insert Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook GET Message by ID": {
      "main": [
        [
          {
            "node": "Supabase Get by ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook PUT Message": {
      "main": [
        [
          {
            "node": "Supabase Update Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook DELETE Message": {
      "main": [
        [
          {
            "node": "Supabase Delete Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Supabase Select Messages": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "de5f275a-511f-4ab6-889f-294690c0f9dc",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "uDKcthYEmcHy75zs",
  "tags": []
}

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.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

technical-test-chat2desk-message-api. Uses supabase. Webhook trigger; 13 nodes.

Source: https://github.com/luixsouza/technical-test-chat2desk/blob/b6a8310c1f2f5ba440872873e5c01aed77271152/n8n/flows.json — original creator credit. Request a take-down →

More Data & Sheets workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Data & Sheets

webhook - simulador PDV (fluxo). Uses supabase. Webhook trigger; 55 nodes.

Supabase
Data & Sheets

This workflow automates raw materials inventory management for businesses, eliminating manual stock updates, delayed material issue approvals, and missed low stock alerts. It ensures real-time stock t

Google Sheets, Gmail, Supabase +1
Data & Sheets

booking no duplicate. Uses httpRequest, supabase. Webhook trigger; 38 nodes.

HTTP Request, Supabase
Data & Sheets

Backend Erick. Uses supabase, n8n-nodes-evolution-api. Webhook trigger; 36 nodes.

Supabase, N8N Nodes Evolution Api
Data & Sheets

01-intake-storage. Uses airtable, supabase, stopAndError, httpRequest. Webhook trigger; 33 nodes.

Airtable, Supabase, Stop And Error +2