AutomationFlowsData & Sheets › Mercanta — Order Ready Notifier

Mercanta — Order Ready Notifier

Mercanta — Order Ready Notifier. Uses postgres, httpRequest. Scheduled trigger; 6 nodes.

Cron / scheduled trigger★★★★☆ complexity6 nodesPostgresHTTP Request
Data & Sheets Trigger: Cron / scheduled Nodes: 6 Complexity: ★★★★☆ Added:

This workflow follows the HTTP Request → Postgres recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "Mercanta \u2014 Order Ready Notifier",
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "nodes": [
    {
      "id": "d0000003-0000-0000-0000-000000000001",
      "name": "Every 10 Seconds",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1,
      "position": [
        240,
        400
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "seconds",
              "secondsInterval": 10
            }
          ]
        }
      }
    },
    {
      "id": "d0000003-0000-0000-0000-000000000002",
      "name": "Fetch Ready Tokens",
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 2,
      "position": [
        480,
        400
      ],
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      },
      "parameters": {
        "operation": "executeQuery",
        "query": "SELECT ot.id, ot.token_number, COALESCE(NULLIF(c.phone, 'null'), NULLIF(s.customer_phone, 'null'), NULLIF(s.payment_details->>'sender', 'null')) AS customer_phone, STRING_AGG(si.item_name || ' x' || si.quantity, ', ') AS items FROM order_tokens ot JOIN sales s ON s.id = ot.sale_id LEFT JOIN customers c ON c.id = s.customer_id JOIN sale_items si ON si.sale_id = s.id WHERE ot.status = 'ready' AND ot.wa_notified_at IS NULL AND s.customer_name = 'WhatsApp Customer' AND COALESCE(NULLIF(c.phone, 'null'), NULLIF(s.customer_phone, 'null'), NULLIF(s.payment_details->>'sender', 'null')) IS NOT NULL GROUP BY ot.id, ot.token_number, COALESCE(NULLIF(c.phone, 'null'), NULLIF(s.customer_phone, 'null'), NULLIF(s.payment_details->>'sender', 'null')) ORDER BY ot.ready_at ASC;",
        "options": {}
      }
    },
    {
      "id": "d0000003-0000-0000-0000-000000000005",
      "name": "Any Results?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        720,
        400
      ],
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $json.id }}",
              "operation": "isNotEmpty"
            }
          ]
        }
      }
    },
    {
      "id": "d0000003-0000-0000-0000-000000000003",
      "name": "Format Ready Message",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        960,
        300
      ],
      "parameters": {
        "jsCode": "const t = $input.item.json;\nconst reply = `\ud83d\udd14 *Your order is ready!*\\n\\n\ud83c\udfab Token *#${t.token_number}*\\n\ud83d\udce6 ${t.items}\\n\\nPlease collect at the counter. Thank you!`;\nreturn [{ json: { reply, sender: t.customer_phone, token_id: t.id } }];"
      }
    },
    {
      "id": "d0000003-0000-0000-0000-000000000004",
      "name": "Send WA: Ready",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 3,
      "position": [
        1200,
        300
      ],
      "parameters": {
        "method": "POST",
        "url": "http://evolution-api:8080/message/sendText/musaib_bot",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "apikey",
              "value": "Musaib_2026_Secure"
            }
          ]
        },
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "number",
              "value": "={{ $json.sender }}"
            },
            {
              "name": "text",
              "value": "={{ $json.reply }}"
            }
          ]
        },
        "options": {}
      }
    },
    {
      "id": "d0000003-0000-0000-0000-000000000006",
      "name": "Mark Notified",
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 2,
      "position": [
        1440,
        300
      ],
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      },
      "parameters": {
        "operation": "executeQuery",
        "query": "UPDATE order_tokens SET wa_notified_at = NOW() WHERE id = '{{ $('Format Ready Message').item.json.token_id }}';",
        "options": {}
      }
    }
  ],
  "connections": {
    "Every 10 Seconds": {
      "main": [
        [
          {
            "node": "Fetch Ready Tokens",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Ready Tokens": {
      "main": [
        [
          {
            "node": "Any Results?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Any Results?": {
      "main": [
        [
          {
            "node": "Format Ready Message",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Format Ready Message": {
      "main": [
        [
          {
            "node": "Send WA: Ready",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send WA: Ready": {
      "main": [
        [
          {
            "node": "Mark Notified",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Mercanta — Order Ready Notifier. Uses postgres, httpRequest. Scheduled trigger; 6 nodes.

Source: https://github.com/MusaibBashir/Mercanta/blob/3b87bdb0b121f1e40559b04799d1c71c05e9cd59/n8n/order_ready.json — original creator credit. Request a take-down →

More Data & Sheets workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Data & Sheets

Disparador 1.8. Uses itemLists, postgres, emailSend, httpRequest. Scheduled trigger; 85 nodes.

Item Lists, Postgres, Email Send +1
Data & Sheets

공유회_알림톡_크론. Uses postgres, httpRequest, n8n-nodes-solapi. Scheduled trigger; 39 nodes.

Postgres, HTTP Request, N8N Nodes Solapi
Data & Sheets

QuepasaAutomatic. Uses postgres, postgresTrigger, httpRequest. Scheduled trigger; 39 nodes.

Postgres, Postgres Trigger, HTTP Request
Data & Sheets

QuepasaAutomatic. Uses postgres, postgresTrigger, httpRequest. Scheduled trigger; 39 nodes.

Postgres, Postgres Trigger, HTTP Request
Data & Sheets

QuepasaAutomatic. Uses postgres, postgresTrigger, httpRequest. Scheduled trigger; 39 nodes.

Postgres, Postgres Trigger, HTTP Request