🤝 Query and monitor Shopify orders via Telegram bot commands

2,098 views · 🤝 CRM & Sales Operations

Description

This n8n workflow integrates Shopify order management with Telegram, allowing you to query open orders and order details directly through Telegram chat commands. It provides an interactive way to monitor your Shopify store orders using Telegram as an interface.

Key Features

  1. Telegram Trigger: Listens for messages and callback queries from your Telegram bot.
  2. Switch Node: Routes incoming Telegram messages to different flows based on message content:
    • /orders command to fetch all open orders
    • Callback queries starting with /order_ to fetch details of a specific order
  3. Shopify Get Orders: Retrieves all open orders from your Shopify store using your Shopify API credentials.
  4. Conditional Check (If Node): Determines if there are any open orders; branches accordingly:
    • If orders exist, prepare an interactive Telegram message with a list of orders.1
    • If no orders exist, send a “No Order” message.
  5. Orders Code Node: Formats the list of open orders into a Telegram message with inline buttons. Each button corresponds to an order and sends a callback data containing the order ID.
  6. Get Order Details: When a user selects an order button, the workflow extracts the order ID from the callback data, fetches detailed order information from Shopify, and formats the order items into a readable message.
  7. Send Messages to Telegram: Sends formatted messages back to Telegram:
    • The list of open orders with clickable buttons.
    • Detailed information about a selected order.
    • “No Order” notification if there are no open orders.

How It Works

Setup Instructions

  1. Create a Telegram Bot:

    • Use @BotFather on Telegram to create a bot and get the bot token.
  2. Obtain Shopify API Credentials:

    • Create a private app in your Shopify admin dashboard with permission to read orders.
    • Obtain the API key and access token.
  3. Configure n8n Credentials:

    • Add your Telegram bot token as Telegram API credentials in n8n.
    • Add your Shopify API credentials in n8n Shopify credentials.
  4. Import the Workflow:

    • Import this workflow into your n8n instance.
    • Update the Telegram and Shopify credential nodes to use your credentials.
  5. Set Webhook URLs:

    • Ensure your Telegram bot webhook is set correctly to receive messages.
    • n8n webhook URLs should be publicly accessible.
  6. Test the Workflow:

    • Send /orders to your Telegram bot to verify it retrieves and lists open orders.

Customization Guidance

Security and Implementation Notes

Benefits

🔗 Nodes Used

HTTP Request, Telegram, Telegram Trigger, Shopify

📥 Import

Download workflow.json and import into n8n: Workflow menu → Import from File

📖 Importing guide · 🔑 Credential setup