{
  "name": "FLUF — crosslisting error alerts by email",
  "nodes": [
    {
      "name": "FLUF event",
      "type": "n8n-nodes-fluf-connect.flufConnectTrigger",
      "parameters": {
        "event": "crosslisting_error"
      },
      "position": [
        240,
        300
      ],
      "typeVersion": 1,
      "id": "236cd335-ad08-49d7-a7b3-aabdbd24dd36",
      "webhookId": "f93c1983-6536-4a21-b596-42561ea7ca46"
    },
    {
      "name": "Prepare event",
      "type": "n8n-nodes-base.code",
      "parameters": {
        "jsCode": "return $input.all().map((item, i) => {\n const s = item.json;\n if (s.test || s.synthetic || s.event !== \"crosslisting_error\" || !s.event_id || !s.listing_id || !s.channel || !s.error_message) throw new Error('Use a real crosslisting_error event with an event_id and required fields.');\n const clean = v => String(v ?? '').replace(/[\\r\\n]+/g, ' ');\n const row = {subject: 'FLUF listing needs attention: ' + clean(s.listing_id) + ' / ' + clean(s.channel), message: ['A crosslisting attempt failed.', 'Listing ID: ' + s.listing_id, 'Marketplace: ' + s.channel, 'Error: ' + s.error_message, 'Event: ' + s.event_id, 'Open FLUF and review the channel error before retrying.', 'https://fluf.io/connect'].join('\\n')};\n return {json: row, pairedItem: {item: i}};\n});"
      },
      "position": [
        480,
        300
      ],
      "typeVersion": 2,
      "id": "e96f961c-6f78-4bb9-b7ae-7ea244e37f5a"
    },
    {
      "name": "Email your team",
      "type": "n8n-nodes-base.gmail",
      "parameters": {
        "resource": "message",
        "operation": "send",
        "sendTo": "",
        "subject": "={{ $json.subject }}",
        "emailType": "text",
        "message": "={{ $json.message }}",
        "options": {}
      },
      "position": [
        720,
        300
      ],
      "typeVersion": 2.1,
      "id": "78e9178f-0fed-4919-9182-78ad0c375f9f"
    },
    {
      "name": "Start here",
      "type": "n8n-nodes-base.stickyNote",
      "parameters": {
        "content": "## Crosslisting error alerts\nSelect FLUF and Gmail credentials. Set To to your team inbox. Test using an existing real error payload. This workflow does not retry or change listings. Repeated deliveries may send duplicate emails. Do not intentionally break a live listing to obtain a sample.\nSetup: https://fluf.io/support/connect-n8n/#crosslisting-error-email",
        "height": 260,
        "width": 720
      },
      "position": [
        240,
        -20
      ],
      "typeVersion": 1,
      "id": "8aa12484-1f98-4ec3-82f5-af006f9e5500"
    }
  ],
  "connections": {
    "FLUF event": {
      "main": [
        [
          {
            "node": "Prepare event",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare event": {
      "main": [
        [
          {
            "node": "Email your team",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  }
}
