Stocker automatiquement les commandes Shopify dans Google Sheets et envoyer des notifications Telegram

Intermédiaire

Ceci est unSales, Marketingworkflow d'automatisation du domainecontenant 9 nœuds.Utilise principalement des nœuds comme If, Set, Webhook, Function, Telegram. Stocker automatiquement les commandes Shopify dans Google Sheets et envoyer des notifications Telegram

Prérequis
  • Point de terminaison HTTP Webhook (généré automatiquement par n8n)
  • Token Bot Telegram
  • Informations d'identification Google Sheets API

Catégorie

Aperçu du workflow
Visualisation des connexions entre les nœuds, avec support du zoom et du déplacement
Exporter le workflow
Copiez la configuration JSON suivante dans n8n pour importer et utiliser ce workflow
{
  "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": "Vue d'ensemble du Workflow",
      "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": "Réception d'une nouvelle commande 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": "Transformation des données de commande au format standard",
      "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": "Sauvegarde de la commande dans 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": "Succès ?",
      "type": "n8n-nodes-base.if",
      "position": [
        1260,
        520
      ],
      "parameters": {
        "conditions": {
          "boolean": [
            {
              "value1": true,
              "value2": true
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "be410e7d-ab51-4a74-889d-10100f90cb30",
      "name": "Envoi de notification d'erreur",
      "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": "Note sur la gestion des erreurs",
      "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": "Envoi de notification de succès",
      "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": "Variables",
      "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
          }
        ]
      ]
    }
  }
}
Foire aux questions

Comment utiliser ce workflow ?

Copiez le code de configuration JSON ci-dessus, créez un nouveau workflow dans votre instance n8n et sélectionnez "Importer depuis le JSON", collez la configuration et modifiez les paramètres d'authentification selon vos besoins.

Dans quelles scénarios ce workflow est-il adapté ?

Intermédiaire - Ventes, Marketing

Est-ce payant ?

Ce workflow est entièrement gratuit et peut être utilisé directement. Veuillez noter que les services tiers utilisés dans le workflow (comme l'API OpenAI) peuvent nécessiter un paiement de votre part.

Informations sur le workflow
Niveau de difficulté
Intermédiaire
Nombre de nœuds9
Catégorie2
Types de nœuds7
Description de la difficulté

Adapté aux utilisateurs expérimentés, avec des workflows de complexité moyenne contenant 6-15 nœuds

Auteur
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.

Liens externes
Voir sur n8n.io

Partager ce workflow

Catégories

Catégories: 34