{
  "name": "Bella Plugin \u2014 Fireflies Get Latest Bella Meeting",
  "nodes": [
    {
      "id": "5d12ef16-13d8-449f-929e-7e1a058ab799",
      "name": "Execute Workflow Trigger",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "typeVersion": 1,
      "position": [
        0,
        0
      ],
      "parameters": {}
    },
    {
      "id": "38bdbdd2-0c0e-42a2-9e4f-51d0f9a6f83f",
      "name": "Fireflies: List Recent Transcripts",
      "type": "@firefliesai/n8n-nodes-fireflies.fireflies",
      "typeVersion": 1,
      "position": [
        280,
        0
      ],
      "parameters": {
        "resource": "transcript",
        "operation": "getAll",
        "limit": 10
      }
    },
    {
      "id": "702bd8d8-fb23-4820-851e-6a68b71635e6",
      "name": "Code: Filter Bella Meetings",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        560,
        0
      ],
      "parameters": {
        "jsCode": "const items = $input.all();\nconst bellaItems = items.filter(item => {\n  const participants = item.json.participants || item.json.attendees || [];\n  return participants.some(p => {\n    const email = (p.email || p.emailAddress || '').toLowerCase();\n    return email.includes('@itsbella.ai');\n  });\n});\nbellaItems.sort((a, b) => {\n  const dateA = new Date(a.json.date || a.json.dateString || 0);\n  const dateB = new Date(b.json.date || b.json.dateString || 0);\n  return dateB - dateA;\n});\nconst latest = bellaItems[0];\nif (!latest) return [{ json: { found: false } }];\nreturn [{ json: { found: true, ...latest.json } }];"
      }
    },
    {
      "id": "bccaa1cc-e179-4bb9-b24e-4df40574d850",
      "name": "If: Found Meeting",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        840,
        0
      ],
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": false,
            "leftValue": "",
            "typeValidation": "strict"
          },
          "conditions": [
            {
              "leftValue": "={{ $json.found }}",
              "rightValue": true,
              "operator": {
                "type": "boolean",
                "operation": "true"
              }
            }
          ],
          "combinator": "and"
        }
      }
    },
    {
      "id": "1135f377-965f-4f8c-adc4-a2c37020e1a5",
      "name": "Fireflies: Get Full Summary",
      "type": "@firefliesai/n8n-nodes-fireflies.fireflies",
      "typeVersion": 1,
      "position": [
        1120,
        -100
      ],
      "parameters": {
        "resource": "transcript",
        "operation": "get",
        "transcriptId": "={{ $json.id }}"
      }
    },
    {
      "id": "6eec26c3-f6aa-4d5a-9d8c-bc8e25f3fbcb",
      "name": "Set: Meeting Output",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3,
      "position": [
        1400,
        -100
      ],
      "parameters": {
        "mode": "manual",
        "assignments": {
          "assignments": [
            {
              "id": "fa7edc9d-8448-4b6e-ac7d-5c99dffbdd44",
              "name": "found",
              "value": true,
              "type": "boolean"
            },
            {
              "id": "639f4042-008b-4791-a4c0-015471c7a670",
              "name": "meeting_id",
              "value": "={{ $json.id }}",
              "type": "string"
            },
            {
              "id": "ef5be2fc-044a-4a57-ade3-cbf78b68c51b",
              "name": "title",
              "value": "={{ $json.title }}",
              "type": "string"
            },
            {
              "id": "51273849-1099-4b53-a946-08126f58595d",
              "name": "date",
              "value": "={{ $json.date || $json.dateString }}",
              "type": "string"
            },
            {
              "id": "3b0eac5a-f2d2-409f-ab82-58584bbbe0c3",
              "name": "participants",
              "value": "={{ $json.participants }}",
              "type": "array"
            },
            {
              "id": "cc1bde46-87a6-4274-bb72-dede15aafa02",
              "name": "summary",
              "value": "={{ $json.summary }}",
              "type": "string"
            },
            {
              "id": "086d4321-756f-4c84-ac6c-7cebc9d8657f",
              "name": "action_items",
              "value": "={{ $json.action_items || $json.actionItems }}",
              "type": "array"
            },
            {
              "id": "3f859731-5eee-45ca-9e57-c0e5b386301c",
              "name": "overview",
              "value": "={{ $json.overview }}",
              "type": "string"
            }
          ]
        }
      }
    },
    {
      "id": "da7a6e59-456c-48c0-8e9d-f52556abdc4c",
      "name": "Set: No Meeting Found",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3,
      "position": [
        1120,
        100
      ],
      "parameters": {
        "mode": "manual",
        "assignments": {
          "assignments": [
            {
              "id": "bd763f39-c37e-41fa-8b53-67f63842a960",
              "name": "found",
              "value": false,
              "type": "boolean"
            },
            {
              "id": "350acc92-fb2c-4151-ac0e-4a517a334590",
              "name": "message",
              "value": "No Bella meetings found in the last 10 transcripts",
              "type": "string"
            }
          ]
        }
      }
    }
  ],
  "connections": {
    "Execute Workflow Trigger": {
      "main": [
        [
          {
            "node": "Fireflies: List Recent Transcripts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fireflies: List Recent Transcripts": {
      "main": [
        [
          {
            "node": "Code: Filter Bella Meetings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code: Filter Bella Meetings": {
      "main": [
        [
          {
            "node": "If: Found Meeting",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If: Found Meeting": {
      "main": [
        [
          {
            "node": "Fireflies: Get Full Summary",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Set: No Meeting Found",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fireflies: Get Full Summary": {
      "main": [
        [
          {
            "node": "Set: Meeting Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  }
}