{
  "name": "FLUF — sale alerts by email",
  "nodes": [
    {
      "name": "FLUF event",
      "type": "n8n-nodes-fluf-connect.flufConnectTrigger",
      "parameters": {
        "event": "new_sale"
      },
      "position": [
        240,
        300
      ],
      "typeVersion": 1,
      "id": "66e54fbb-16a5-4fd1-a705-02eebfa6014f",
      "webhookId": "414f3966-1cfd-434c-84ec-8815ae18bf27"
    },
    {
      "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 !== \"new_sale\" || !s.event_id || !s.order_id || !s.channel) throw new Error('Use a real new_sale event with an event_id and required fields.');\n const clean = v => String(v ?? '').replace(/[\\r\\n]+/g, ' ');\n const row = {subject: 'FLUF sale: ' + clean(s.channel) + ' / ' + clean(s.order_id), message: ['A sale was recorded in FLUF.', 'Order: ' + s.order_id, 'Marketplace: ' + s.channel, 'Sold at: ' + (s.sold_at ?? 'Unknown'), 'Order total: ' + (s.order_total ?? 'Unknown') + ' ' + (s.currency ?? ''), 'Items: ' + JSON.stringify(s.items ?? []), 'Event: ' + s.event_id, 'Check payment, cancellation status and shipping details in FLUF before fulfilment.', 'https://fluf.io/connect/orders'].join('\\n')};\n return {json: row, pairedItem: {item: i}};\n});"
      },
      "position": [
        480,
        300
      ],
      "typeVersion": 2,
      "id": "eece963f-8ade-44d9-a9f0-f63b39cffe04"
    },
    {
      "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": "e87576f1-a763-44b6-8c81-364dc595f8e2"
    },
    {
      "name": "Start here",
      "type": "n8n-nodes-base.stickyNote",
      "parameters": {
        "content": "## Sale alerts\nSelect your FLUF and Gmail credentials. Enter your own team email address in To. Use a real sale to test. This sends internal notifications, never buyer messages. Repeated deliveries may send duplicate emails. No payment or shipping action is performed.\nSetup: https://fluf.io/support/connect-n8n/#sale-email",
        "height": 260,
        "width": 720
      },
      "position": [
        240,
        -20
      ],
      "typeVersion": 1,
      "id": "3a99e7a4-90fd-401d-a57f-87aa3b9c5d94"
    }
  ],
  "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"
  }
}
