AutomationFlowsGeneral › Create Communication

Create Communication

Create Communication. Uses mySql, respondToWebhook. Webhook trigger; 5 nodes.

Webhook trigger★★★★☆ complexity5 nodesMy Sql
General Trigger: Webhook Nodes: 5 Complexity: ★★★★☆

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
{
  "id": "whO4Gv3i9lHJweWY",
  "name": "Create Communication",
  "description": null,
  "active": true,
  "isArchived": false,
  "nodes": [
    {
      "parameters": {
        "path": "create-communication",
        "httpMethod": "POST",
        "responseMode": "responseNode",
        "options": {}
      },
      "id": "webhook-1",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2.1,
      "position": [
        240,
        300
      ]
    },
    {
      "parameters": {
        "jsCode": "const body = $input.item.json.body || $input.item.json;\nconst { \n  plan_id, \n  from_agent = 'claude',\n  to_agent = 'any',\n  type,\n  subject,\n  message,\n  created_by\n} = body;\n\n// Default created_by to from_agent if not provided\nconst finalCreatedBy = created_by || from_agent;\n\nif (!plan_id) {\n  throw new Error('plan_id is required');\n}\n\nif (!type) {\n  throw new Error('type is required');\n}\n\nif (!subject) {\n  throw new Error('subject is required');\n}\n\nif (!message) {\n  throw new Error('message is required');\n}\n\nconst validTypes = ['guidance', 'status', 'analysis', 'technique', 'discussion', 'decision'];\nif (!validTypes.includes(type)) {\n  throw new Error(`Invalid type. Must be one of: ${validTypes.join(', ')}`);\n}\n\nreturn {\n  json: {\n    plan_id,\n    from_agent,\n    to_agent,\n    type,\n    subject,\n    message,\n    created_by: finalCreatedBy\n  }\n};"
      },
      "id": "validate-comm",
      "name": "Validate Communication",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        460,
        300
      ]
    },
    {
      "parameters": {
        "operation": "insert",
        "table": "plan_communications",
        "columns": "plan_id, from_agent, to_agent, type, subject, message, created_by",
        "options": {}
      },
      "id": "insert-comm",
      "name": "Insert Communication",
      "type": "n8n-nodes-base.mySql",
      "typeVersion": 2.5,
      "position": [
        680,
        300
      ],
      "credentials": {
        "mySql": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "const comm = $('Validate Communication').item.json;\nconst insertResult = $input.item.json;\n\nreturn [{\n  json: {\n    success: true,\n    comm_id: insertResult.insertId || insertResult.id,\n    communication: {\n      plan_id: comm.plan_id,\n      from_agent: comm.from_agent,\n      to_agent: comm.to_agent,\n      type: comm.type,\n      subject: comm.subject\n    },\n    timestamp: comm.timestamp\n  }\n}];"
      },
      "id": "format-response",
      "name": "Format Response",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        900,
        300
      ]
    },
    {
      "parameters": {
        "respondWith": "allIncomingItems",
        "options": {}
      },
      "id": "webhook-response",
      "name": "Respond to Webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.5,
      "position": [
        1120,
        300
      ]
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Validate Communication",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validate Communication": {
      "main": [
        [
          {
            "node": "Insert Communication",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Insert Communication": {
      "main": [
        [
          {
            "node": "Format Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Response": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1",
    "callerPolicy": "workflowsFromSameOwner",
    "availableInMCP": true
  },
  "staticData": null,
  "versionId": "3b20caf0-c92b-4f85-b876-dd8f59a39344",
  "createdAt": "2025-12-21 02:18:02.404",
  "updatedAt": "2025-12-25 19:16:13.961"
}

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.

About this workflow

Create Communication. Uses mySql, respondToWebhook. Webhook trigger; 5 nodes.

Source: https://github.com/pchambless/wf-monorepo/blob/47cd16469735c59a12b7c76e2552861f899e335d/.n8n/workflows/create-communication.json — original creator credit. Request a take-down →

More General workflows → · Browse all categories →