{
  "name": "Bella - Fireflies \u2192 Notion",
  "nodes": [
    {
      "id": "cd4fd258-0489-46e5-998f-6f20d39dbe45",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        0,
        0
      ],
      "parameters": {
        "httpMethod": "POST",
        "path": "bella-fireflies-hook",
        "responseMode": "responseNode"
      }
    },
    {
      "id": "cd15e5a6-4078-46d5-a7aa-604d93e35d3c",
      "name": "Code: Extract Meeting ID",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        280,
        0
      ],
      "parameters": {
        "jsCode": "const body = $input.first().json.body || $input.first().json;\nconst meetingId = body.meetingId || body.transcriptId || body.id || '';\nreturn [{ json: { meetingId, raw: body } }];"
      }
    },
    {
      "id": "75cf1178-06a8-4113-b6c6-0e062a74e5f1",
      "name": "Fireflies: Get Transcript",
      "type": "@firefliesai/n8n-nodes-fireflies.fireflies",
      "typeVersion": 1,
      "position": [
        560,
        0
      ],
      "parameters": {
        "resource": "transcript",
        "operation": "get",
        "transcriptId": "={{ $json.meetingId }}"
      }
    },
    {
      "id": "87979dfb-4ddc-4cd9-bf52-a8651c349604",
      "name": "Code: Filter Bella Meetings",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        840,
        0
      ],
      "parameters": {
        "jsCode": "const transcript = $input.first().json;\nconst participants = transcript.participants || transcript.attendees || [];\nconst isBella = participants.some(p => {\n  const email = (p.email || p.emailAddress || '').toLowerCase();\n  return email.includes('@itsbella.ai');\n});\nreturn [{ json: { ...transcript, is_bella_meeting: isBella, participants } }];"
      }
    },
    {
      "id": "56c24d8d-2a0b-46b7-9e45-92f029a3b0f1",
      "name": "If: Is Bella Meeting",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        1120,
        0
      ],
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": false,
            "leftValue": "",
            "typeValidation": "strict"
          },
          "conditions": [
            {
              "leftValue": "={{ $json.is_bella_meeting }}",
              "rightValue": true,
              "operator": {
                "type": "boolean",
                "operation": "true"
              }
            }
          ],
          "combinator": "and"
        }
      }
    },
    {
      "id": "66cf0064-a91d-4bb3-8aa9-91e553453c36",
      "name": "AI: Format Meeting Summary",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "typeVersion": 1,
      "position": [
        1400,
        -150
      ],
      "parameters": {
        "model": "claude-sonnet-4-6",
        "messages": {
          "values": [
            {
              "role": "user",
              "content": "Format this meeting data into a clean, human-readable summary for a busy team. Write structured notes with these sections: Meeting Title, Date, Attendees, Key Decisions, Action Items, Next Steps. Under 400 words. Use plain text, no JSON.\n\nMeeting data: {{ JSON.stringify($json) }}"
            }
          ]
        }
      }
    },
    {
      "id": "3ec3f510-d126-44c0-a6a8-db87284570c4",
      "name": "Note: Notion DB ID",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1680,
        -270
      ],
      "parameters": {
        "content": "\u26a0\ufe0f Set your Notion Meeting Notes database ID here \u2014 replace BELLA_NOTION_DATABASE_ID.",
        "height": 80,
        "width": 360,
        "color": 4
      }
    },
    {
      "id": "7084e137-d79d-4b7c-a3cc-14eb0cced24c",
      "name": "Notion: Create Page",
      "type": "n8n-nodes-base.notion",
      "typeVersion": 2,
      "position": [
        1680,
        -150
      ],
      "parameters": {
        "resource": "page",
        "operation": "create",
        "databaseId": {
          "__rl": true,
          "value": "BELLA_NOTION_DATABASE_ID",
          "mode": "id"
        },
        "title": "={{ $('Fireflies: Get Transcript').first().json.title || 'Bella Meeting' }}",
        "propertiesUi": {
          "propertyValues": [
            {
              "key": "Name",
              "title": "={{ $('Fireflies: Get Transcript').first().json.title || 'Bella Meeting' }}"
            }
          ]
        },
        "blockUi": {
          "blockValues": [
            {
              "type": "paragraph",
              "textContent": "={{ $json.content || $json.text || 'Summary not available' }}"
            }
          ]
        }
      }
    },
    {
      "id": "b3f8555f-316f-49cd-a277-4387871ee042",
      "name": "No Operation",
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        1400,
        100
      ],
      "parameters": {}
    },
    {
      "id": "188367a7-0719-400b-9c86-c36509795d3a",
      "name": "Respond to Webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1,
      "position": [
        1960,
        0
      ],
      "parameters": {
        "respondWith": "json",
        "responseBody": "={ \"success\": true }"
      }
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Code: Extract Meeting ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code: Extract Meeting ID": {
      "main": [
        [
          {
            "node": "Fireflies: Get Transcript",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fireflies: Get Transcript": {
      "main": [
        [
          {
            "node": "Code: Filter Bella Meetings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code: Filter Bella Meetings": {
      "main": [
        [
          {
            "node": "If: Is Bella Meeting",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If: Is Bella Meeting": {
      "main": [
        [
          {
            "node": "AI: Format Meeting Summary",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Operation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI: Format Meeting Summary": {
      "main": [
        [
          {
            "node": "Notion: Create Page",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Notion: Create Page": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "No Operation": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  }
}