Automatisches Senden des wöchentlichen Square-Verkaufsberichts per Outlook
Experte
Dies ist ein CRM-Bereich Automatisierungsworkflow mit 16 Nodes. Hauptsächlich werden If, Code, SplitOut, HttpRequest, ConvertToFile und andere Nodes verwendet. Automatisches Senden des wöchentlichen Square-Verkaufsberichts per Outlook
Voraussetzungen
- •Möglicherweise sind Ziel-API-Anmeldedaten erforderlich
Verwendete Nodes (16)
Kategorie
Workflow-Vorschau
Visualisierung der Node-Verbindungen, mit Zoom und Pan
Workflow exportieren
Kopieren Sie die folgende JSON-Konfiguration und importieren Sie sie in n8n
{
"meta": {
"instanceId": "d6e2f2f655b1125bbcac14a4cac6d2e46c7a150e927f85fc96fdca1a6dc39e0e",
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "8e75b42e-ddb0-44f0-a8b8-1d2466ae42bc",
"name": "Square-Standorte abrufen",
"type": "n8n-nodes-base.httpRequest",
"position": [
1312,
544
],
"parameters": {
"url": "https://connect.squareup.com/v2/locations",
"options": {},
"sendHeaders": true,
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
}
},
"credentials": {
"httpHeaderAuth": {
"id": "n1GRrdbh899dbLYB",
"name": "Square Header Auth"
}
},
"typeVersion": 4.2
},
{
"id": "cd048483-5b68-409f-9b84-466286328914",
"name": "Standorte in Liste umwandeln",
"type": "n8n-nodes-base.splitOut",
"position": [
1536,
544
],
"parameters": {
"include": "selectedOtherFields",
"options": {},
"fieldToSplitOut": "locations",
"fieldsToInclude": "id"
},
"typeVersion": 1
},
{
"id": "9af52034-58d4-42f8-9114-cde595cfa295",
"name": "Standorte ohne Verkäufe ignorieren",
"type": "n8n-nodes-base.if",
"position": [
2032,
544
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "498f5fab-6930-4e89-9fbe-0d67671da8d2",
"operator": {
"type": "array",
"operation": "notEmpty",
"singleValue": true
},
"leftValue": "={{ $json.orders }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "5b5b2ddc-b193-481a-992d-aae65beda387",
"name": "Verkäufe von Square abrufen",
"type": "n8n-nodes-base.httpRequest",
"position": [
1792,
544
],
"parameters": {
"url": "https://connect.squareup.com/v2/orders/search",
"method": "POST",
"options": {},
"jsonBody": "={\n \"location_ids\": [\"{{ $json.locations.id }}\"],\n \"query\": {\n \"filter\": {\n \"state_filter\": {\n \"states\": [\"COMPLETED\"]\n },\n \"date_time_filter\": {\n \"created_at\": {\n \"start_at\": \"{{ $('Get Dates From Last Week').item.json.date }}T00:00:00-05:00\",\n \"end_at\": \"{{ $('Get Dates From Last Week').item.json.date }}T23:59:59-05:00\"\n }\n }\n }\n },\n \"limit\": 1000,\n \"return_entries\": false\n}",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
}
},
"credentials": {
"httpHeaderAuth": {
"id": "n1GRrdbh899dbLYB",
"name": "Square Header Auth"
}
},
"typeVersion": 4.2
},
{
"id": "9e2de8fb-60ea-4cea-9b5c-7c033b92b395",
"name": "Verkaufsberichte zusammenstellen",
"type": "n8n-nodes-base.code",
"position": [
2320,
544
],
"parameters": {
"mode": "runOnceForEachItem",
"jsCode": "// Date and Location Metadata\nconst date = $('Get Dates From Last Week').item.json.date;\nconst location_id = $json.orders[0].location_id || null;\nconst location_name = $('Get Square Locations').item.json.locations.find(locations => locations.id === location_id)?.name;\n\n// Our Result Variables\nlet total_money = 0;\nlet total_tax = 0;\nlet total_discount = 0;\nlet total_tip = 0;\nlet total_returns = 0;\nlet cash_rounding = 0;\n\nlet cash_tender = 0;\nlet card_tender = 0;\nlet gift_card_tender = 0;\nlet other_tender = 0;\nlet fees = 0;\n\n// Loop Through Each Order\nfor (const sale of $json.orders) {\n\n // Add the sales, taxes, discounts and tips\n total_money += sale.total_money?.amount || 0;\n total_tax += sale.total_tax_money?.amount || 0;\n total_discount += -(sale.total_discount_money?.amount || 0);\n total_tip += sale.total_tip_money?.amount || 0;\n if (sale.rounding_adjustment) {\n cash_rounding += sale.rounding_adjustment.amount_money?.amount || 0;\n }\n\n \n if (sale.return_amounts) {\n // If there are returns, subtract from sales totals and add to return amount total\n total_money -= sale.return_amounts?.total_money?.amount || 0;\n total_tax -= sale.return_amounts?.tax_money?.amount || 0;\n total_discount -= sale.return_amounts?.discount_money?.amount || 0;\n total_tip -= sale.return_amounts?.tip_money?.amount || 0;\n \n total_returns += -(sale.return_amounts?.total_money?.amount || 0);\n total_returns -= -(sale.return_amounts?.tax_money?.amount || 0);\n total_returns -= -(sale.return_amounts?.tip_money?.amount || 0);\n total_returns -= -(sale.return_amounts?.discount_money?.amount || 0);\n \n // If an array of refunds is provided\n for (const refund of sale.refunds || []) {\n const transaction_id = refund.transaction_id;\n \n // Look for the original sale this refund refers to\n const original_sale = $json.orders.find(original =>\n original.id && transaction_id && original.id.includes(transaction_id)\n );\n \n if (original_sale) {\n if (original_sale.rounding_adjustment) {\n const amount = original_sale.rounding_adjustment.amount_money?.amount || 0;\n cash_rounding -= amount;\n total_returns += amount;\n }\n \n if (original_sale.tenders) {\n for (const tender of original_sale.tenders) {\n if (tender.id === refund.tender_id) {\n const amount = refund.amount_money?.amount || 0;\n if (tender.type === 'CARD') card_tender -= amount;\n else if (tender.type === 'CASH') cash_tender -= amount;\n else if (tender.type === 'SQUARE_GIFT_CARD') gift_card_tender -= amount;\n else other_tender -= amount;\n \n if (refund.processing_fee_money && tender.id === refund.tender_id) {\n fees -= refund.processing_fee_money.amount || 0;\n }\n }\n }\n }\n }\n }\n }\n \n if (sale.tenders) {\n for (const tender of sale.tenders) {\n const amount = tender.amount_money?.amount || 0;\n if (tender.type === 'CARD') card_tender += amount;\n else if (tender.type === 'CASH') cash_tender += amount;\n else if (tender.type === 'SQUARE_GIFT_CARD') gift_card_tender += amount;\n else other_tender += amount;\n \n if (tender.processing_fee_money) {\n fees -= tender.processing_fee_money.amount || 0;\n }\n }\n }\n \n}\n\n// Final computed values\nconst net_sales = total_money - total_tip - total_tax - cash_rounding;\nconst gross_sales = net_sales - total_discount - total_returns;\nconst net_total = cash_tender + card_tender + gift_card_tender + other_tender + fees;\n\nreturn {\n json: {\n date,\n location_id,\n location_name,\n gross_sales: gross_sales / 100.0,\n total_returns: total_returns / 100.0,\n total_discount: total_discount / 100.0,\n net_sales: net_sales / 100.0,\n total_tax: total_tax / 100.0,\n total_tip: total_tip / 100.0,\n cash_rounding: cash_rounding / 100.0,\n total_payments_collected: total_money / 100.0,\n cash: cash_tender / 100.0,\n card: card_tender / 100.0,\n gift_card: gift_card_tender / 100.0,\n other: other_tender / 100.0,\n fees: fees / 100.0,\n net_total: net_total / 100.0,\n }\n};"
},
"typeVersion": 2
},
{
"id": "c362abb1-7f4c-4d19-a13e-bfe4b12e29d8",
"name": "Kurznotiz1",
"type": "n8n-nodes-base.stickyNote",
"position": [
704,
352
],
"parameters": {
"color": 5,
"height": 420,
"content": "## Trigger \n- This workflow runs every Monday at 8:00 AM. \n- Each week, it pulls the previous week's sales data from Square.\n"
},
"typeVersion": 1
},
{
"id": "bb2e06af-2327-4353-93b0-277495986789",
"name": "Kurznotiz2",
"type": "n8n-nodes-base.stickyNote",
"position": [
1232,
352
],
"parameters": {
"color": 5,
"width": 460,
"height": 420,
"content": "## Get Square Locations and Process Each One Separately \n- This HTTP node connects to the Square Locations API to fetch all your locations.\n"
},
"typeVersion": 1
},
{
"id": "4f2ec8f5-a05d-46f6-b1f2-c0f0ed668322",
"name": "Kurznotiz3",
"type": "n8n-nodes-base.stickyNote",
"position": [
1712,
352
],
"parameters": {
"color": 5,
"height": 420,
"content": "## Get Sales from Square \n- This HTTP node retrieves all orders for the given location on the specified date."
},
"typeVersion": 1
},
{
"id": "3f652e9c-aca8-4307-8826-2abcaa8e3aee",
"name": "Kurznotiz4",
"type": "n8n-nodes-base.stickyNote",
"position": [
2256,
352
],
"parameters": {
"color": 5,
"height": 420,
"content": "## Compile a Report for Each Location \n- This code node calculates totals for each location. \n- Please ensure the numbers match EXACTLY with the Square Sales Summary Dashboard.\n"
},
"typeVersion": 1
},
{
"id": "48a5e23b-dff0-42d2-bc5d-6f41d03c8f73",
"name": "Zeitplan-Trigger",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
784,
544
],
"parameters": {
"rule": {
"interval": [
{
"field": "weeks",
"triggerAtDay": [
1
],
"triggerAtHour": 8
}
]
}
},
"typeVersion": 1.2
},
{
"id": "55d3ef5c-4453-451a-81ed-d137ff58fc91",
"name": "Kurznotiz5",
"type": "n8n-nodes-base.stickyNote",
"position": [
2512,
352
],
"parameters": {
"color": 5,
"height": 420,
"content": "## Convert the Square Sales Summary into a CSV File \n"
},
"typeVersion": 1
},
{
"id": "4cf05def-64fe-4b74-9be0-d30726c43e09",
"name": "Verkaufszusammenfassung in CSV-Datei konvertieren",
"type": "n8n-nodes-base.convertToFile",
"position": [
2576,
544
],
"parameters": {
"options": {
"fileName": "=sales_report_{{ $('Schedule Trigger').item.json.timestamp }}.csv"
},
"binaryPropertyName": "sales_report"
},
"typeVersion": 1.1
},
{
"id": "ec55edfd-8193-4adf-b92e-5b5f1a2400f7",
"name": "Kurznotiz6",
"type": "n8n-nodes-base.stickyNote",
"position": [
2784,
352
],
"parameters": {
"color": 5,
"height": 420,
"content": "## Send the Report to the Finance Team / Manager"
},
"typeVersion": 1
},
{
"id": "2e1fc5ae-165b-405d-af6c-57d6da942a65",
"name": "Daten der letzten Woche abrufen",
"type": "n8n-nodes-base.code",
"position": [
1040,
544
],
"parameters": {
"jsCode": "const inputDate = new Date($input.first().json.timestamp); // Input date\nconst daysBefore = 7;\nconst output = [];\n\nfor (let i = daysBefore; i > 0; i--) {\n const d = new Date(inputDate);\n d.setDate(inputDate.getDate() - i);\n\n const formatted = d.toISOString().split('T')[0]; // \"YYYY-MM-DD\"\n\n output.push({ json: { date: formatted } });\n}\n\nreturn output;\n"
},
"typeVersion": 2
},
{
"id": "348308dd-debf-48a3-be8d-83c1a1125637",
"name": "Kurznotiz7",
"type": "n8n-nodes-base.stickyNote",
"position": [
-64,
-32
],
"parameters": {
"width": 736,
"height": 1440,
"content": "## Automatically Send Weekly Sales Reports from Square via Outlook\n\n## What It Does \nThis workflow automatically connects to the Square API and generates a **weekly** sales summary report for all your Square locations. The report matches the figures displayed in **Square Dashboard > Reports > Sales Summary**.\n\nIt's designed to run weekly and pull the **previous week’s** sales into a CSV file, which is then sent to a manager/finance team for analysis.\n\nThis workflow builds on my previous template, which allows users to automatically pull data from the Square API into n8n for processing. (See here: https://n8n.io/workflows/6358)\n\n## Prerequisites \nTo use this workflow, you'll need:\n- A Square API credential (configured as a Header Auth credential)\n- A Microsoft Outlook credential\n\n## How to Set Up Square Credentials: \n- Go to **Credentials > Create New** \n- Choose **Header Auth** \n- Set the **Name** to `Authorization` \n- Set the **Value** to your Square Access Token (e.g., `Bearer <your-api-key>`)\n\n## How It Works \n1. **Trigger:** The workflow runs every **Monday at 4:00 AM** \n2. **Fetch Locations:** An HTTP request retrieves all Square locations linked to your account \n3. **Fetch Orders:** For each location, an HTTP request pulls completed orders for the **previous week (e.g., Monday to Sunday)** \n4. **Filter Empty Locations:** Locations with no sales are ignored \n5. **Aggregate Sales Data:** A Code node processes the order data and produces a summary identical to Square’s built-in Sales Summary report \n6. **Create CSV File:** A CSV file is created containing the relevant data \n7. **Send Email:** An email is sent via Microsoft Outlook to the chosen third party \n\n## Example Use Cases \n- Automatically send weekly Square sales data to management to improve the quality of planning and scheduling decisions \n- Automatically send data to an external third party, such as a landlord or agent, who is paid via commission \n- Automatically send data to a bookkeeper for entry into QuickBooks \n\n## How to Use \n- Configure both HTTP Request nodes to use your Square API credential \n- Set the workflow to **Active** so it runs automatically \n- Enter the email address of the person you want to send the report to and update the message body \n- If you want to remove the n8n attribution, you can do so in the last node \n\n## Customization Options \n- Add pagination to handle locations with more than 1,000 orders per week\n\n## Why It's Useful \nThis workflow saves time, reduces manual report pulling from Square, and enables smarter automation around sales data — whether for operations, finance, or performance monitoring.\n"
},
"typeVersion": 1
},
{
"id": "8c8bc0e2-01dc-4b21-80e2-07054aaaae9e",
"name": "Bericht senden",
"type": "n8n-nodes-base.microsoftOutlook",
"position": [
2848,
544
],
"webhookId": "58ccb3c3-a315-4070-aa9f-b2c012a2bb33",
"parameters": {
"subject": "=Your Square Sales Report for {{ $('Schedule Trigger').item.json['Readable date'].split(',')[0] }}",
"bodyContent": "<p>Hello User,</p><p>Please see the attached report containing last week's sales!</p><p>Best,<br> An Efficient Person</p>",
"toRecipients": "user@example.com",
"additionalFields": {
"attachments": {
"attachments": [
{
"binaryPropertyName": "sales_report"
}
]
},
"bodyContentType": "html"
}
},
"typeVersion": 2
}
],
"pinData": {},
"connections": {
"8c8bc0e2-01dc-4b21-80e2-07054aaaae9e": {
"main": [
[]
]
},
"48a5e23b-dff0-42d2-bc5d-6f41d03c8f73": {
"main": [
[
{
"node": "2e1fc5ae-165b-405d-af6c-57d6da942a65",
"type": "main",
"index": 0
}
]
]
},
"8e75b42e-ddb0-44f0-a8b8-1d2466ae42bc": {
"main": [
[
{
"node": "cd048483-5b68-409f-9b84-466286328914",
"type": "main",
"index": 0
}
]
]
},
"9e2de8fb-60ea-4cea-9b5c-7c033b92b395": {
"main": [
[
{
"node": "4cf05def-64fe-4b74-9be0-d30726c43e09",
"type": "main",
"index": 0
}
]
]
},
"5b5b2ddc-b193-481a-992d-aae65beda387": {
"main": [
[
{
"node": "9af52034-58d4-42f8-9114-cde595cfa295",
"type": "main",
"index": 0
}
]
]
},
"2e1fc5ae-165b-405d-af6c-57d6da942a65": {
"main": [
[
{
"node": "8e75b42e-ddb0-44f0-a8b8-1d2466ae42bc",
"type": "main",
"index": 0
}
]
]
},
"cd048483-5b68-409f-9b84-466286328914": {
"main": [
[
{
"node": "5b5b2ddc-b193-481a-992d-aae65beda387",
"type": "main",
"index": 0
}
]
]
},
"9af52034-58d4-42f8-9114-cde595cfa295": {
"main": [
[
{
"node": "9e2de8fb-60ea-4cea-9b5c-7c033b92b395",
"type": "main",
"index": 0
}
]
]
},
"4cf05def-64fe-4b74-9be0-d30726c43e09": {
"main": [
[
{
"node": "8c8bc0e2-01dc-4b21-80e2-07054aaaae9e",
"type": "main",
"index": 0
}
]
]
}
}
}Häufig gestellte Fragen
Wie verwende ich diesen Workflow?
Kopieren Sie den obigen JSON-Code, erstellen Sie einen neuen Workflow in Ihrer n8n-Instanz und wählen Sie "Aus JSON importieren". Fügen Sie die Konfiguration ein und passen Sie die Anmeldedaten nach Bedarf an.
Für welche Szenarien ist dieser Workflow geeignet?
Experte - Kundenbeziehungsmanagement
Ist es kostenpflichtig?
Dieser Workflow ist völlig kostenlos. Beachten Sie jedoch, dass Drittanbieterdienste (wie OpenAI API), die im Workflow verwendet werden, möglicherweise kostenpflichtig sind.
Verwandte Workflows
Automatisches Senden des täglichen Square-Verkaufs-Zusammenfassungsberichts per Microsoft Outlook
Automatisches Senden des täglichen Square-Verkaufs-Zusammenfassungsberichts per Microsoft Outlook
If
Code
Split Out
+
If
Code
Split Out
15 NodesRosh Ragel
Kundenbeziehungsmanagement
Automatisches Senden des täglichen Square-Verkaufsberichts per Gmail
Automatisches Senden des täglichen Square-Verkaufsberichts per Gmail
If
Code
Gmail
+
If
Code
Gmail
15 NodesRosh Ragel
Kundenbeziehungsmanagement
Automatisches Senden des wöchentlichen Square-Verkaufsberichts per Gmail
Automatisches Senden des wöchentlichen Square-Verkaufsberichts per Gmail
If
Code
Gmail
+
If
Code
Gmail
16 NodesRosh Ragel
Kundenbeziehungsmanagement
Automatisches Senden des monatlichen Square-Verkaufsberichts per Outlook
Automatisches Senden des monatlichen Square-Verkaufsberichts per Outlook
If
Code
Split Out
+
If
Code
Split Out
16 NodesRosh Ragel
Dokumentenextraktion
Automatischer Import von Square-Verkaufs-Zusammenfassungsberichten in Google Tabellen
Automatischer Import von Square-Verkaufs-Zusammenfassungsberichten in Google Tabellen
If
Code
Split Out
+
If
Code
Split Out
14 NodesRosh Ragel
Kundenbeziehungsmanagement
Automatisches Senden des monatlichen Square-Verkaufsberichts per Gmail
Automatisches Senden des monatlichen Square-Verkaufsberichts per Gmail
If
Code
Gmail
+
If
Code
Gmail
16 NodesRosh Ragel
Content-Erstellung
Workflow-Informationen
Schwierigkeitsgrad
Experte
Anzahl der Nodes16
Kategorie1
Node-Typen8
Autor
Rosh Ragel
@roshragelExterne Links
Auf n8n.io ansehen →
Diesen Workflow teilen