AutomationFlowsGeneral › Basic Nats Pub/sub Example

Basic Nats Pub/sub Example

Basic NATS Pub/Sub Example. Uses n8n-nodes-synadia. Event-driven trigger; 4 nodes.

Event trigger★★☆☆☆ complexity4 nodesN8N Nodes Synadia
General Trigger: Event Nodes: 4 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": "Basic NATS Pub/Sub Example",
  "nodes": [
    {
      "parameters": {},
      "id": "e3e9ef5e-8e8f-4e5a-b8ea-c8f51a7e8d51",
      "name": "When clicking \"Execute Workflow\"",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        240,
        300
      ]
    },
    {
      "parameters": {
        "subject": "test.messages",
        "data": "={{JSON.stringify({\"timestamp\": $now.toISO(), \"message\": \"Hello from n8n!\", \"workflow\": \"Basic Pub/Sub\"})}}",
        "config": {}
      },
      "id": "a1b2c3d4-e5f6-4a5b-8c9d-0e1f2a3b4c5d",
      "name": "Publish to NATS",
      "type": "n8n-nodes-synadia.nats",
      "typeVersion": 1,
      "position": [
        460,
        300
      ],
      "credentials": {
        "natsApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "subject": "test.messages",
        "config": {}
      },
      "id": "f1e2d3c4-b5a6-4958-8b7c-6d5e4f3a2b1c",
      "name": "Subscribe to NATS",
      "type": "n8n-nodes-synadia.natsTrigger",
      "typeVersion": 1,
      "position": [
        680,
        300
      ],
      "credentials": {
        "natsApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "values": {
          "string": [
            {
              "name": "receivedAt",
              "value": "={{$now.toISO()}}"
            },
            {
              "name": "subject",
              "value": "={{$json.subject}}"
            }
          ]
        },
        "config": {}
      },
      "id": "d4c3b2a1-f5e6-4d5c-8a9b-7e6f5d4c3b2a",
      "name": "Process Message",
      "type": "n8n-nodes-base.set",
      "typeVersion": 2,
      "position": [
        900,
        300
      ]
    }
  ],
  "connections": {
    "When clicking \"Execute Workflow\"": {
      "main": [
        [
          {
            "node": "Publish to NATS",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Subscribe to NATS": {
      "main": [
        [
          {
            "node": "Process Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {},
  "versionId": "01234567-89ab-cdef-0123-456789abcdef",
  "id": "1",
  "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

Basic NATS Pub/Sub Example. Uses n8n-nodes-synadia. Event-driven trigger; 4 nodes.

Source: https://github.com/synadia-labs/n8n-nodes-synadia/blob/b183e0ca9467695f9fa3f49ff01f2cd66e613aed/examples/basic-pubsub.json — original creator credit. Request a take-down →

More General workflows → · Browse all categories →

Related workflows

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

General

03 - Flow Control Demo (Loop) V2. Event-driven trigger; 11 nodes.

General

Report Examples Demo. Event-driven trigger; 7 nodes.

General

Google Sheets UI for n8n Workflow. Uses manualTrigger, stickyNote, splitInBatches, googleSheets. Event-driven trigger; 6 nodes.

Google Sheets
General

Reusable and Independently Testable Sub-workflow. Uses executeWorkflowTrigger, manualTrigger, stickyNote. Event-driven trigger; 6 nodes.

Execute Workflow Trigger
General

example_1. Uses n8nTrainingCustomerDatastore. Event-driven trigger; 6 nodes.

N8N Training Customer Datastore