Gmail 레이블에서 GPT-4O + QuickBooks를 사용하여 자동으로 청구서 생성
고급
이것은Invoice Processing, AI Summarization분야의자동화 워크플로우로, 23개의 노드를 포함합니다.주로 Code, Gmail, Quickbooks, Agent, ScheduleTrigger 등의 노드를 사용하며. Gmail 레이블에서 GPT-4O + QuickBooks를 사용하여 자동으로 청구서 생성
사전 요구사항
- •Google 계정 및 Gmail API 인증 정보
- •OpenAI API Key
워크플로우 미리보기
노드 연결 관계를 시각적으로 표시하며, 확대/축소 및 이동을 지원합니다
워크플로우 내보내기
다음 JSON 구성을 복사하여 n8n에 가져오면 이 워크플로우를 사용할 수 있습니다
{
"meta": {
"instanceId": "d6e2f2f655b1125bbcac14a4cac6d2e46c7a150e927f85fc96fdca1a6dc39e0e",
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "5f0e5680-7bb4-4c96-b427-233f0fd35d9a",
"name": "QBO에 고객 추가",
"type": "n8n-nodes-base.quickbooks",
"onError": "continueRegularOutput",
"position": [
540,
500
],
"parameters": {
"operation": "create",
"displayName": "={{ $json.output.company_name ? $json.output.company_name : $json.output.client_full_name }}",
"additionalFields": {
"BillAddr": {
"details": {
"City": "={{ $json.output.city }}",
"Line1": "={{ $json.output.address_line_1 }}",
"PostalCode": "={{ $json.output.postal_code }}",
"CountrySubDivisionCode": "CA"
}
},
"GivenName": "={{ $json.output.client_first_name }}",
"FamilyName": "={{ $json.output.client_last_name }}",
"CompanyName": "={{ $json.output.company_name ? $json.output.company_name : \"\" }}",
"PrimaryPhone": "={{ $json.output.client_phone }}",
"PrimaryEmailAddr": "={{ $json.output.client_email }}"
}
},
"credentials": {
"quickBooksOAuth2Api": {
"id": "6ufAa1KkttZDj17m",
"name": "QuickBooks Online account"
}
},
"typeVersion": 1
},
{
"id": "8d3af3f2-77ab-4788-8a92-2efc7be5ca42",
"name": "청구서 필요 라벨이 있는 메시지 가져오기",
"type": "n8n-nodes-base.gmail",
"position": [
220,
20
],
"webhookId": "1cb550a2-0c63-45a3-baa5-c04cd8d03f68",
"parameters": {
"simple": false,
"filters": {
"labelIds": [
"Label_6581962793477761592"
]
},
"options": {},
"operation": "getAll",
"returnAll": true
},
"credentials": {
"gmailOAuth2": {
"id": "YVZiLPppXZw84rIU",
"name": "Gmail account"
}
},
"typeVersion": 2.1
},
{
"id": "c76c499b-fd1b-440e-be22-3737a223c02c",
"name": "OpenAI Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
60,
720
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "XqsFFpRk48U68Fou",
"name": "OpenAi account"
}
},
"typeVersion": 1.2
},
{
"id": "6ef8c67e-c5ba-4dc0-97e9-eebfc1a47db0",
"name": "Structured Output Parser",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
280,
720
],
"parameters": {
"schemaType": "manual",
"inputSchema": "{\n\t\"type\": \"object\",\n\t\"properties\": {\n\t\t\"client_first_name\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n \"client_last_name\": {\n \t\t\t\"type\": \"string\"\n \t\t},\n \"client_full_name\": {\n \t\t\t\"type\": \"string\"\n \t\t},\n \"company_name\": {\n \t\t\t\"type\": \"string\"\n \t\t},\n \"client_email\": {\n \t\t\t\"type\": \"string\"\n \t\t},\n \"client_phone\": {\n \t\t\t\"type\": \"string\"\n \t\t},\n \"address_line_1\": {\n \t\t\t\"type\": \"string\"\n \t\t},\n \"city\": {\n \t\t\t\"type\": \"string\"\n \t\t},\n \"province\": {\n \t\t\t\"type\": \"string\"\n \t\t},\n \"postal_code\": {\n \t\t\t\"type\": \"string\"\n \t\t},\n \"invoiceAmount\": {\n \t\t\t\"type\": \"double\"\n \t\t},\n \"invoiceDescription\": {\n \t\t\t\"type\": \"text\"\n \t\t}\n\t}\n}"
},
"typeVersion": 1.2
},
{
"id": "8e74cb95-64fa-4969-88ef-782631a1dbe9",
"name": "기존 고객 찾기",
"type": "n8n-nodes-base.quickbooks",
"position": [
800,
500
],
"parameters": {
"limit": 1,
"filters": {
"query": "=WHERE DisplayName = '{{ $('AI Agent: Extract Customer & Invoice Details').item.json.output.company_name ? $('AI Agent: Extract Customer & Invoice Details').item.json.output.company_name : $('AI Agent: Extract Customer & Invoice Details').item.json.output.client_full_name }}'"
},
"operation": "getAll"
},
"credentials": {
"quickBooksOAuth2Api": {
"id": "6ufAa1KkttZDj17m",
"name": "QuickBooks Online account"
}
},
"typeVersion": 1
},
{
"id": "4c7cb8d6-97d2-49a7-9307-9faeb04b2573",
"name": "새 청구서 생성",
"type": "n8n-nodes-base.quickbooks",
"position": [
1060,
520
],
"parameters": {
"Line": [
{
"Amount": "={{ $('AI Agent: Extract Customer & Invoice Details').item.json.output.invoiceAmount }}",
"itemId": "13",
"DetailType": "SalesItemLineDetail",
"TaxCodeRef": "5",
"Description": "={{ $('AI Agent: Extract Customer & Invoice Details').item.json.output.invoiceDescription }}"
}
],
"resource": "invoice",
"operation": "create",
"CustomerRef": "={{ $json.Id ? $json.Id : $('Add Client to QBO').item.json.Id }}",
"additionalFields": {
"DueDate": "={{ $now }}"
}
},
"credentials": {
"quickBooksOAuth2Api": {
"id": "6ufAa1KkttZDj17m",
"name": "QuickBooks Online account"
}
},
"typeVersion": 1
},
{
"id": "1df01733-3f95-478f-bc2e-2eba2d3da4a9",
"name": "청구서 다운로드",
"type": "n8n-nodes-base.quickbooks",
"position": [
640,
940
],
"parameters": {
"download": true,
"fileName": "=Invoice - {{ $json.CustomerRef.name ? $json.CustomerRef.name : $json.TxnDate }}.pdf",
"resource": "invoice",
"invoiceId": "={{ $json.Id }}",
"binaryProperty": "invoice"
},
"credentials": {
"quickBooksOAuth2Api": {
"id": "6ufAa1KkttZDj17m",
"name": "QuickBooks Online account"
}
},
"typeVersion": 1
},
{
"id": "6ca60364-5d5b-45e0-9d73-63c34b20c47d",
"name": "고객에게 답장 초안 작성",
"type": "n8n-nodes-base.gmail",
"position": [
920,
940
],
"webhookId": "433b7c52-32b5-4bac-8d88-9b0cc63da43b",
"parameters": {
"message": "=<p>Hello {{ $('AI Agent: Extract Customer & Invoice Details').item.json.output.client_first_name }},</p>\n<p>Please see attached for your invoice:</p>\n<p>Best,<br>An Efficient Person</p>",
"options": {
"threadId": "={{ $('Combine all Messages in a Thread').item.json.threadId }}",
"attachmentsUi": {
"attachmentsBinary": [
{
"property": "invoice"
}
]
}
},
"subject": "=",
"resource": "draft",
"emailType": "html"
},
"credentials": {
"gmailOAuth2": {
"id": "YVZiLPppXZw84rIU",
"name": "Gmail account"
}
},
"typeVersion": 2.1
},
{
"id": "f5c6f49d-5e21-48ae-bc4e-750cd4d5bd4a",
"name": "Schedule Trigger",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
-40,
20
],
"parameters": {
"rule": {
"interval": [
{
"field": "hours"
}
]
}
},
"typeVersion": 1.2
},
{
"id": "c01cc24c-99cd-4c16-80db-db71a6362859",
"name": "AI 에이전트: 고객 및 청구서 세부 정보 추출",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
60,
500
],
"parameters": {
"options": {
"systemMessage": "You are a helpful assistant who needs to create an invoice based on the email(s) provided. Please extract the necessary details to create an invoice:\n- Customer name and/or company name (if provided) (Required)\n- The amount of the invoice before taxes (Required)\n- The description of the product/service being purchased\n- Billing Address\n- client phone number\n- client email address\n- "
},
"hasOutputParser": true
},
"typeVersion": 1.9
},
{
"id": "60aeb85f-b6ef-4c47-bb88-d2431a95f7f2",
"name": "청구서 필요 라벨 제거",
"type": "n8n-nodes-base.gmail",
"position": [
1180,
940
],
"webhookId": "406d3985-d16c-421e-b6a8-5e36b5df7db8",
"parameters": {
"labelIds": [
"Label_6581962793477761592"
],
"resource": "thread",
"threadId": "={{ $json.message.threadId }}",
"operation": "removeLabels"
},
"credentials": {
"gmailOAuth2": {
"id": "YVZiLPppXZw84rIU",
"name": "Gmail account"
}
},
"typeVersion": 2.1
},
{
"id": "13d90021-d6b4-464c-bbf4-d2866e4452b8",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-800,
-280
],
"parameters": {
"width": 660,
"height": 1700,
"content": "## Automatically Create and Draft Invoices from Labeled Emails Using AI + QuickBooks\n\n## What It Does\nThis workflow reads Gmail threads labeled `Invoice Needed`, extracts invoice and client details using an AI agent, and creates a draft invoice in QuickBooks Online. It then downloads the invoice as a PDF and drafts a reply email with the invoice attached — all automatically.\n\nPerfect for freelancers, agencies, or small businesses looking to streamline client billing from email.\n\n## Prerequisites\nTo use this workflow, you’ll need:\n\n- A Gmail OAuth2 credential\n- A QuickBooks OAuth2 credential\n- An OpenAI credential (for AI-powered data extraction)\n\n## How to Label Threads\n- In Gmail, apply the label `Invoice Needed` to any email thread that contains details for an invoice request.\n- The workflow will process only those threads.\n\n## How It Works\n1. **Trigger:** The workflow runs on a schedule (e.g., every hour)\n2. **Fetch Emails:** Gmail node pulls all threads with the `Invoice Needed` label\n3. **Group Messages:** Emails in each thread are grouped together\n4. **AI Extraction:** An OpenAI-powered agent extracts client info, billing address, invoice amount, and description\n5. **Add a New Client:** This node will attempt to create a new client in QuickBooks\n6. **Find Existing Client** If the client already exists, this node will find the client's id\n7. **Create Invoice:** An invoice is created based on the extracted details\n8. **Download PDF:** The invoice is saved as a PDF\n9. **Draft Reply:** A Gmail draft is created with a template message and the invoice attached\n10. **Remove Label:** The processed thread is untagged to avoid duplicates\n\n## Example Use Cases\n- Automatically generate invoices from client emails\n- Use AI to extract invoice data without manual input\n- Ensure consistent and timely billing\n- Create a paper trail with attached PDFs in replies\n- Free up your inbox by processing and clearing labeled threads\n\n## How to Use\n- Set your schedule (e.g., every hour or more often if needed)\n- Select a product in the `Create A New Invoice` node\n- Ask the client to provide invoice details if needed (company name, billing address)\n- Add the `Invoice Needed` label to threads manually, via a Gmail filter or via another workflow\n- Review and send the drafted replies in Gmail\n- Optionally, add your branding or custom template to the email message\n\n## Optimization Instructions:\n- For larger companies with frequent invoice requests, consider shortening the interval between workflow runs. This helps prevent the system from processing too many labeled threads at once, ensuring smoother performance and faster response times.\n\n## Customization Options\n- Add line multiple items based on the product or service purchased instead of a single invoice row\n- Add conditional logic to skip certain threads\n- Auto-send emails instead of saving drafts (after testing)\n- Use custom prompts to extract additional fields\n\n## Why It's Useful\nThis workflow eliminates the manual labor of crafting invoices from scratch by automating the entire process—from email to invoice. It reduces the need to switch between multiple apps, since you no longer have to open QuickBooks Online to create an invoice. By streamlining your billing workflow, it saves time, minimizes errors, and lets you stay focused on your actual work while still keeping full control over outgoing communications."
},
"typeVersion": 1
},
{
"id": "124c54fc-301d-48dc-8569-083ae9350cbf",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-100,
-160
],
"parameters": {
"color": 7,
"height": 360,
"content": "## Schedule\nThis node determines how often the workflow should check for newly labeled emails. Adjust this to control how responsive or resource-efficient your automation is.\n\n"
},
"typeVersion": 1
},
{
"id": "3657dde0-5110-4ea8-95bc-0301e9da5045",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
160,
-160
],
"parameters": {
"color": 7,
"height": 360,
"content": "## Gmail\nConnects to Gmail and pulls email threads that have the \"Invoice Needed\" label. This is the trigger for creating a new invoice."
},
"typeVersion": 1
},
{
"id": "4d6af4d6-99a3-418b-9e05-7364ae71df30",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
420,
-160
],
"parameters": {
"color": 7,
"height": 360,
"content": "## Combine All Messages\nGroups together all messages within a thread so AI can see the full conversation context — crucial for extracting accurate invoice details."
},
"typeVersion": 1
},
{
"id": "1adecc9c-446b-4f4d-a9dd-c333773ca0e3",
"name": "스레드 내 모든 메시지 결합",
"type": "n8n-nodes-base.code",
"position": [
480,
40
],
"parameters": {
"jsCode": "const threads = {};\n\nfor (const item of items) {\n const msg = item.json;\n const threadId = msg.threadId;\n\n if (!threads[threadId]) {\n threads[threadId] = [];\n }\n\n // Add To and From Addresses\n let finalMessage = \"From: \" + msg.headers.from;\n finalMessage += \"To: \" + msg.headers.to;\n finalMessage += \"Message: \" + msg.textAsHtml\n\n threads[threadId].push(finalMessage);\n}\n\nreturn Object.keys(threads).map(threadId => ({\n json: {\n threadId,\n chatInput: threads[threadId],\n }\n}));\n"
},
"typeVersion": 2
},
{
"id": "276e3175-c11a-4ae9-94ab-9703e20b89bf",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
20,
300
],
"parameters": {
"color": 7,
"width": 440,
"height": 560,
"content": "## AI Agent: Extract Customer & Invoice Details\nUses OpenAI to read the email content and extract structured invoice data like name, company, amount, description, and contact info."
},
"typeVersion": 1
},
{
"id": "de08bb58-b868-4c70-80b9-b63c5f607856",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"position": [
480,
300
],
"parameters": {
"color": 7,
"height": 380,
"content": "## Add Client to QBO\nTries to add a new customer to QuickBooks"
},
"typeVersion": 1
},
{
"id": "3344c904-9c17-4cf0-9d15-bbf1ce4d856d",
"name": "Sticky Note6",
"type": "n8n-nodes-base.stickyNote",
"position": [
740,
300
],
"parameters": {
"color": 7,
"height": 380,
"content": "## Find Existing Customer\nSearches your QuickBooks account for a customer with the same display name"
},
"typeVersion": 1
},
{
"id": "88e1b763-ca25-4e0e-8881-d03d32003f14",
"name": "Sticky Note7",
"type": "n8n-nodes-base.stickyNote",
"position": [
1000,
300
],
"parameters": {
"color": 7,
"height": 380,
"content": "## Create A New Invoice\nBuilds a draft invoice in QBO using the client info and line item details (amount + description) from the AI extraction. Please select a Product or Service to Sell\n"
},
"typeVersion": 1
},
{
"id": "cb087959-e777-4749-b734-d31ed64c09c1",
"name": "Sticky Note8",
"type": "n8n-nodes-base.stickyNote",
"position": [
600,
760
],
"parameters": {
"color": 7,
"height": 360,
"content": "## Download Invoice\nPulls the PDF version of the invoice from QBO so it can be attached to your email reply."
},
"typeVersion": 1
},
{
"id": "b7a83ee4-678a-4477-9b54-a21dd6099412",
"name": "Sticky Note9",
"type": "n8n-nodes-base.stickyNote",
"position": [
860,
760
],
"parameters": {
"color": 7,
"height": 360,
"content": "## Write Draft Reply to Client\nCreates a draft email reply to the original thread in Gmail with the invoice attached — ready for you to review and send."
},
"typeVersion": 1
},
{
"id": "4faa7895-c3dd-4607-9f55-35ee5e19728e",
"name": "Sticky Note10",
"type": "n8n-nodes-base.stickyNote",
"position": [
1120,
760
],
"parameters": {
"color": 7,
"height": 360,
"content": "## Remove Invoice Needed Label\nRemoves the \"Invoice Needed\" label from the email thread to mark it as processed and avoid double-handling."
},
"typeVersion": 1
}
],
"pinData": {},
"connections": {
"1df01733-3f95-478f-bc2e-2eba2d3da4a9": {
"main": [
[
{
"node": "6ca60364-5d5b-45e0-9d73-63c34b20c47d",
"type": "main",
"index": 0
}
]
]
},
"f5c6f49d-5e21-48ae-bc4e-750cd4d5bd4a": {
"main": [
[
{
"node": "8d3af3f2-77ab-4788-8a92-2efc7be5ca42",
"type": "main",
"index": 0
}
]
]
},
"5f0e5680-7bb4-4c96-b427-233f0fd35d9a": {
"main": [
[
{
"node": "8e74cb95-64fa-4969-88ef-782631a1dbe9",
"type": "main",
"index": 0
}
]
]
},
"c76c499b-fd1b-440e-be22-3737a223c02c": {
"ai_languageModel": [
[
{
"node": "c01cc24c-99cd-4c16-80db-db71a6362859",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"4c7cb8d6-97d2-49a7-9307-9faeb04b2573": {
"main": [
[
{
"node": "1df01733-3f95-478f-bc2e-2eba2d3da4a9",
"type": "main",
"index": 0
}
]
]
},
"8e74cb95-64fa-4969-88ef-782631a1dbe9": {
"main": [
[
{
"node": "4c7cb8d6-97d2-49a7-9307-9faeb04b2573",
"type": "main",
"index": 0
}
]
]
},
"6ef8c67e-c5ba-4dc0-97e9-eebfc1a47db0": {
"ai_outputParser": [
[
{
"node": "c01cc24c-99cd-4c16-80db-db71a6362859",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"6ca60364-5d5b-45e0-9d73-63c34b20c47d": {
"main": [
[
{
"node": "60aeb85f-b6ef-4c47-bb88-d2431a95f7f2",
"type": "main",
"index": 0
}
]
]
},
"1adecc9c-446b-4f4d-a9dd-c333773ca0e3": {
"main": [
[
{
"node": "c01cc24c-99cd-4c16-80db-db71a6362859",
"type": "main",
"index": 0
}
]
]
},
"8d3af3f2-77ab-4788-8a92-2efc7be5ca42": {
"main": [
[
{
"node": "1adecc9c-446b-4f4d-a9dd-c333773ca0e3",
"type": "main",
"index": 0
}
]
]
},
"c01cc24c-99cd-4c16-80db-db71a6362859": {
"main": [
[
{
"node": "5f0e5680-7bb4-4c96-b427-233f0fd35d9a",
"type": "main",
"index": 0
}
]
]
}
}
}자주 묻는 질문
이 워크플로우를 어떻게 사용하나요?
위의 JSON 구성 코드를 복사하여 n8n 인스턴스에서 새 워크플로우를 생성하고 "JSON에서 가져오기"를 선택한 후, 구성을 붙여넣고 필요에 따라 인증 설정을 수정하세요.
이 워크플로우는 어떤 시나리오에 적합한가요?
고급 - 청구서 처리, AI 요약
유료인가요?
이 워크플로우는 완전히 무료이며 직접 가져와 사용할 수 있습니다. 다만, 워크플로우에서 사용하는 타사 서비스(예: OpenAI API)는 사용자 직접 비용을 지불해야 할 수 있습니다.
관련 워크플로우 추천
AI Gmail 영수증 자동 저장
AI자동保存Gmail收据로Google表格및Google云端硬盘
Set
Gmail
Merge
+
Set
Gmail
Merge
14 노드Matt Chong
청구서 처리
인보이스 알림: Gmail에서 Tasks로
Gmail 및 Google Tasks를 활용한 인보이스 자동 감지 및 알림 생성
If
Gmail
Google Tasks
+
If
Gmail
Google Tasks
13 노드Matt Chong
청구서 처리
n8n 릴리스 노트 알림 예약 발송(Gmail)
AI 기반 n8n 릴리스 노트 요약 알림(Gmail 및 GPT-5-Mini 통해)
Set
Code
Html
+
Set
Code
Html
16 노드Jeff Huera
개인 생산성
23 고객 생애 가치 분석
GPT-4와 Bright Data MCP를 사용하여 고객 가치 고객 분석 및 타겟팅
If
Set
Code
+
If
Set
Code
20 노드Yaron Been
시장 조사
지역별 성과 분석
Bright Data MCP 및 GPT-4o를 사용하여 판매 지역 성과 분석
Set
Code
Gmail
+
Set
Code
Gmail
17 노드Yaron Been
고객관계관리
16 경쟁사 가격 모니터링
Bright Data MCP 및 Google Sheets 기반 경쟁사 가격 자동 모니터링
Set
Code
Gmail
+
Set
Code
Gmail
18 노드Yaron Been
시장 조사