Shopify 注文を Google Sheets に保存して Telegram 通知を送信する

中級

これはSales, Marketing分野の自動化ワークフローで、9個のノードを含みます。主にIf, Set, Webhook, Function, Telegramなどのノードを使用。 Shopify 注文を自動のに Google スプレッドシートに保存し、Telegram 通知を送信する

前提条件
  • HTTP Webhookエンドポイント(n8nが自動生成)
  • Telegram Bot Token
  • Google Sheets API認証情報
ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
  "id": "VcGLTfb4lc3iScZ0",
  "meta": {
    "instanceId": "1037e065dca107c3c15857d49fe150792779e136a3c579aed02192a2b3d2a396"
  },
  "name": "Automatically Store Shopify Orders in Google Sheets with Telegram Notifications",
  "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 to Google Sheets Order Tracking with Telegram Notifications\n\nThis workflow captures incoming Shopify orders via webhook, automatically stores them in a Google Sheet for tracking and analysis, and sends instant notifications to Telegram.\n\n### Setup Required:\n- Shopify store with webhook configured to this n8n webhook URL\n- Google Sheets account with a prepared order tracking spreadsheet\n- Telegram bot and chat ID for notifications\n- Configure the Edit Variables node with your specific settings\n\n### How it works:\n1. Webhook receives order data from Shopify\n2. Data is transformed into a consistent format\n3. Processed orders are saved to your Google Sheet\n4. Notifications are sent to your Telegram chat"
      },
      "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": "## Error Handling\n\nThis section checks if the Google Sheets operation was successful and sends appropriate notifications via Telegram.\n\nMake sure to configure a Telegram bot and set your chat ID in the Edit Variables node."
      },
      "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": {
    "ad495370-6fde-469b-802e-df03e44d1a36": {
      "main": [
        [
          {
            "node": "99cae8a6-38e2-481c-8f36-3b434c8a8117",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "be410e7d-ab51-4a74-889d-10100f90cb30",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "a8b5532a-44c8-4f2a-a54a-a9e03d321141": {
      "main": [
        []
      ]
    },
    "ff4bd186-2677-44db-abfe-a0c5356f170a": {
      "main": [
        [
          {
            "node": "aee86e48-3921-46b8-85cf-fb34b4de693b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "f505d25f-dbd0-4d03-b2c8-9d62891decf8": {
      "main": [
        [
          {
            "node": "ad495370-6fde-469b-802e-df03e44d1a36",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "aee86e48-3921-46b8-85cf-fb34b4de693b": {
      "main": [
        [
          {
            "node": "f505d25f-dbd0-4d03-b2c8-9d62891decf8",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
よくある質問

このワークフローの使い方は?

上記のJSON設定コードをコピーし、n8nインスタンスで新しいワークフローを作成して「JSONからインポート」を選択、設定を貼り付けて認証情報を必要に応じて変更してください。

このワークフローはどんな場面に適していますか?

中級 - 営業, マーケティング

有料ですか?

このワークフローは完全無料です。ただし、ワークフローで使用するサードパーティサービス(OpenAI APIなど)は別途料金が発生する場合があります。

ワークフロー情報
難易度
中級
ノード数9
カテゴリー2
ノードタイプ7
難易度説明

経験者向け、6-15ノードの中程度の複雑さのワークフロー

作成者
RedOne

RedOne

@redone

Automation 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で表示

このワークフローを共有

カテゴリー

カテゴリー: 34