自动将 Shopify 订单存储到 Google Sheets 并发送 Telegram 通知
中级
这是一个Sales, Marketing领域的自动化工作流,包含 9 个节点。主要使用 If, Set, Webhook, Function, Telegram 等节点。 自动将 Shopify 订单存储到 Google Sheets 并发送 Telegram 通知
前置要求
- •HTTP Webhook 端点(n8n 会自动生成)
- •Telegram Bot Token
- •Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "VcGLTfb4lc3iScZ0",
"meta": {
"instanceId": "1037e065dca107c3c15857d49fe150792779e136a3c579aed02192a2b3d2a396"
},
"name": "自动将 Shopify 订单存储到 Google Sheets 并发送 Telegram 通知",
"tags": [],
"nodes": [
{
"id": "d0e405d1-9ad9-4983-bb59-fc50e62f3866",
"name": "工作流概览",
"type": "n8n-nodes-base.stickyNote",
"position": [
-140,
420
],
"parameters": {
"color": "rgba(155, 89, 182, 1)",
"width": 500,
"height": 480,
"content": "## Shopify 到 Google Sheets 订单跟踪与 Telegram 通知"
},
"typeVersion": 1
},
{
"id": "ff4bd186-2677-44db-abfe-a0c5356f170a",
"name": "接收新的 Shopify 订单",
"type": "n8n-nodes-base.webhook",
"position": [
460,
760
],
"webhookId": "shopify-order-webhook",
"parameters": {
"path": "shopify-webhook",
"options": {},
"httpMethod": "POST"
},
"typeVersion": 2
},
{
"id": "aee86e48-3921-46b8-85cf-fb34b4de693b",
"name": "将订单数据转换为标准格式",
"type": "n8n-nodes-base.function",
"position": [
780,
560
],
"parameters": {
"functionCode": "// Extract and standardize Shopify order data\nconst eventData = $input.item.json;\nconst orderData = eventData.body; // This is the actual Shopify order object\n\n// Extract customer info while preserving format\nlet customerName = '';\nif (orderData.shipping_address && orderData.shipping_address.name) {\n customerName = orderData.shipping_address.name;\n} else if (orderData.billing_address && orderData.billing_address.name) {\n customerName = orderData.billing_address.name;\n} else if (orderData.customer) {\n // Concatenate first and last name, handling cases where one might be missing\n const firstName = orderData.customer.first_name || '';\n const lastName = orderData.customer.last_name || '';\n customerName = `${firstName} ${lastName}`.trim();\n}\n\n// Ensure line_items exists and is an array\nconst rawLineItems = Array.isArray(orderData.line_items) ? orderData.line_items : [];\n\n// Transform to standardized format\nconst standardizedOrder = {\n orderId: orderData.id || '',\n orderNumber: orderData.order_number || '',\n created_at: orderData.created_at || new Date().toISOString(),\n processed: false, // Defaulting as per your desired structure\n processed_at: '',\n customer: {\n name: customerName,\n email: orderData.email || '',\n phone: (orderData.shipping_address && orderData.shipping_address.phone) ||\n (orderData.billing_address && orderData.billing_address.phone) || \n (orderData.customer && orderData.customer.phone) || \n ''\n },\n shippingAddress: {\n name: (orderData.shipping_address && orderData.shipping_address.name) || customerName,\n address1: (orderData.shipping_address && orderData.shipping_address.address1) || '',\n address2: (orderData.shipping_address && orderData.shipping_address.address2) || '',\n city: (orderData.shipping_address && orderData.shipping_address.city) || '',\n province: (orderData.shipping_address && orderData.shipping_address.province) || '',\n zip: (orderData.shipping_address && orderData.shipping_address.zip) || '',\n country: (orderData.shipping_address && orderData.shipping_address.country_code) || ''\n },\n lineItems: rawLineItems.map(item => ({\n id: item.id || '',\n productId: item.product_id || '',\n variantId: item.variant_id || '',\n sku: item.sku || '', \n name: item.name || item.title || '',\n quantity: item.quantity || 1,\n price: item.price || '0.00',\n supplier: null,\n fulfillment_status: item.fulfillment_status || 'unfulfilled',\n tracking_number: null\n })),\n totalPrice: orderData.total_price || '0.00',\n currency: orderData.currency || 'USD',\n json: JSON.stringify(orderData) // Store the full original order for reference\n};\n\n// Convert objects to strings for Google Sheets\nstandardizedOrder.customer = JSON.stringify(standardizedOrder.customer);\nstandardizedOrder.shippingAddress = JSON.stringify(standardizedOrder.shippingAddress);\nstandardizedOrder.lineItems = JSON.stringify(standardizedOrder.lineItems);\n\nreturn {json: standardizedOrder};"
},
"typeVersion": 1
},
{
"id": "f505d25f-dbd0-4d03-b2c8-9d62891decf8",
"name": "将订单保存到 Google Sheets",
"type": "n8n-nodes-base.googleSheets",
"position": [
1060,
520
],
"parameters": {
"columns": {
"value": {},
"schema": [],
"mappingMode": "autoMapInputData",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": 1985380983,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/16hLaVyq09dvPpIKC4OmcRnzxa6-rR5h7eOBeDk28hnc/edit#gid=1985380983",
"cachedResultName": "Order"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "16hLaVyq09dvPpIKC4OmcRnzxa6-rR5h7eOBeDk28hnc",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/16hLaVyq09dvPpIKC4OmcRnzxa6-rR5h7eOBeDk28hnc/edit?usp=drivesdk",
"cachedResultName": "Daily Orders Sheet"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "ubQXdpluCtk0bGFi",
"name": "Google Sheets account"
}
},
"typeVersion": 4.2
},
{
"id": "ad495370-6fde-469b-802e-df03e44d1a36",
"name": "成功?",
"type": "n8n-nodes-base.if",
"position": [
1260,
520
],
"parameters": {
"conditions": {
"boolean": [
{
"value1": true,
"value2": true
}
]
}
},
"typeVersion": 1
},
{
"id": "be410e7d-ab51-4a74-889d-10100f90cb30",
"name": "发送错误通知",
"type": "n8n-nodes-base.telegram",
"position": [
1640,
840
],
"parameters": {
"text": "❌ *ERROR: Shopify Order Processing Failed*\n\n```\n{{ $json.error }}\n```\n\n*Error occurred at:* {{ $now }}",
"chatId": "={{$node[\"Variables\"].json.telegramChatId}}",
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "Your Telegram Id",
"name": "Telegram account"
}
},
"typeVersion": 1
},
{
"id": "e880a4ef-cc42-4de3-83c9-62275aabfaf2",
"name": "错误处理说明",
"type": "n8n-nodes-base.stickyNote",
"position": [
1160,
220
],
"parameters": {
"color": "rgba(255, 153, 0, 1)",
"content": "## 错误处理"
},
"typeVersion": 1
},
{
"id": "99cae8a6-38e2-481c-8f36-3b434c8a8117",
"name": "发送成功通知1",
"type": "n8n-nodes-base.telegram",
"position": [
1680,
320
],
"parameters": {
"text": "=🛍️ New Order Successfully Recorded\n\nOrder #: {{ $node[\"Transform Order Data to Standard Format\"].json.orderNumber }}\nCustomer: {{ JSON.parse($node[\"Transform Order Data to Standard Format\"].json.customer).name }}\nTotal: {{ $node[\"Transform Order Data to Standard Format\"].json.currency }} {{ $node[\"Transform Order Data to Standard Format\"].json.totalPrice }}\nDate: {{ $node[\"Transform Order Data to Standard Format\"].json.created_at }}\n\nOrder has been added to your Order Tracking Sheet.",
"chatId": "=Your Telegram Chat Id",
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "RIK7bBarkKBJAV5R",
"name": "Telegram account"
}
},
"typeVersion": 1
},
{
"id": "a8b5532a-44c8-4f2a-a54a-a9e03d321141",
"name": "变量",
"type": "n8n-nodes-base.set",
"position": [
480,
500
],
"parameters": {
"values": {
"string": [
{
"name": "spreadsheetId",
"value": "Your Google Sheet Id"
},
{
"name": "sheetName",
"value": "orders"
},
{
"name": "telegramChatId",
"value": "Your Telegram Chat Id"
}
]
},
"options": {}
},
"typeVersion": 2
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "e94d8900-ca57-4128-bbfa-879bb9b378ab",
"connections": {
"Success?": {
"main": [
[
{
"node": "Send Success Notification1",
"type": "main",
"index": 0
}
],
[
{
"node": "Send Error Notification",
"type": "main",
"index": 0
}
]
]
},
"Variables": {
"main": [
[]
]
},
"Receive New Shopify Order": {
"main": [
[
{
"node": "Transform Order Data to Standard Format",
"type": "main",
"index": 0
}
]
]
},
"Save Order to Google Sheets": {
"main": [
[
{
"node": "Success?",
"type": "main",
"index": 0
}
]
]
},
"Transform Order Data to Standard Format": {
"main": [
[
{
"node": "Save Order to Google Sheets",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
中级 - 销售, 营销
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
使用GPT-4o、WordPress和LinkedIn发布自动化RSS内容到博客文章
使用GPT-4o、WordPress和LinkedIn发布自动化RSS内容到博客文章
If
Set
Code
+21
40 节点Immanuel
人工智能
太阳能潜在客户资质审核
使用Google Sheets和Gmail自动化太阳能潜在客户资质审核与跟进
If
Code
Gmail
+6
17 节点David Olusola
销售
潜在客户生成系统的唯一QR码优惠券分配和验证
基于SuiteCRM的潜在客户生成系统唯一QR码优惠券分配和验证
If
Set
Webhook
+6
29 节点Davide
销售
[模板] AI宠物店 v8
🐶 AI宠物店助手 - 集成GPT-4o、Google日历和WhatsApp/Instagram/Facebook
If
N8n
Set
+38
244 节点Amanda Benks
销售
AI房地产经纪人:端到端运营自动化(网络、数据、语音)
AI房地产经纪人:端到端运营自动化(网络、数据、语音)
If
Set
Code
+16
45 节点Sam Yassine
销售
ELEVEN LABS 多智能体系统
基于ElevenLabs、OpenAI和内容生成的语音驱动营销助手
If
Set
Webhook
+16
56 节点David Olusola
人工智能
工作流信息
难度等级
中级
节点数量9
分类2
节点类型7
作者
RedOne
@redoneAutomation expert helping businesses optimize workflows with n8n. Specialized in integrating open-source tools to streamline operations and boost productivity. Book a session to discover how I can help automate your processes.
外部链接
在 n8n.io 查看 →
分享此工作流