{
  "id": "template-sales-pdf-bot-template",
  "name": "Sales PDF bot",
  "tags": [],
  "nodes": [
    {
      "id": "a28e7d40-9a79-4c7a-8d11-bd4ade696719",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1744,
        -304
      ],
      "parameters": {
        "width": 480,
        "height": 896,
        "content": "## Sales PDF bot\n\n### How it works\n\nThis workflow manages sales conversations across WhatsApp and Telegram, records client/payment details in Google Sheets, and sends payment links. When Stripe confirms a valid payment, it looks up the buyer, detects the original channel, and sends the PDF link back through WhatsApp or Telegram. It also includes a WhatsApp-side pending-payment reminder path and a small webhook acknowledgement path for reminder-trigger events.\n\n### Setup steps\n\n- Configure webhook URLs for WhatsApp, Telegram, and Stripe so each external service points to the corresponding n8n webhook trigger.\n- Add credentials for Google Sheets, Telegram Bot API, Stripe webhook verification/event parsing, and the WhatsApp Cloud API HTTP requests.\n- Update the WhatsApp Graph API URLs, phone number ID, access token, Telegram chat/message parameters, Stripe event parsing fields, and Google Sheets document/table mappings.\n- Populate the Google Sheet with the expected columns for phone, channel, chat_id, timestamp, payment status, and client identifiers used by the Stripe lookup.\n- Set the payment link and final PDF link values in the message-building or request nodes before activating the workflow.\n\n### Customization\n\nAdjust the reminder text, payment-link message, PDF delivery message, fallback handling, and the Google Sheets columns to match the sales process and data model."
      },
      "typeVersion": 1
    },
    {
      "id": "5cce0047-1a37-451a-b9a4-ba59bf9eed2d",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1184,
        -304
      ],
      "parameters": {
        "color": 7,
        "width": 400,
        "height": 336,
        "content": "## Reminder webhook acknowledgement\n\nA compact top-left cluster that receives the reminder-trigger webhook and immediately returns a webhook response, acting as a simple acknowledgement endpoint."
      },
      "typeVersion": 1
    },
    {
      "id": "37c62bd4-cc26-4732-a2bb-09f56ff59e07",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1184,
        64
      ],
      "parameters": {
        "color": 7,
        "width": 592,
        "height": 320,
        "content": "## WhatsApp message intake\n\nReceives incoming WhatsApp webhook events, parses the message payload, and checks whether it is a valid WhatsApp sales message before continuing."
      },
      "typeVersion": 1
    },
    {
      "id": "a0146815-57f8-4484-8772-b679576daee0",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -528,
        -256
      ],
      "parameters": {
        "color": 7,
        "width": 672,
        "height": 496,
        "content": "## Check pending WhatsApp payment\n\nLooks up unpaid clients in Google Sheets, decides whether payment is still pending, then either sends a WhatsApp reminder or prepares normalized client fields for the payment-link path."
      },
      "typeVersion": 1
    },
    {
      "id": "2afa465c-b830-41ad-9812-485e5a713efe",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        176,
        -256
      ],
      "parameters": {
        "color": 7,
        "width": 592,
        "height": 320,
        "content": "## Send WhatsApp payment link\n\nStores the WhatsApp client details in Google Sheets, sends the payment link through the WhatsApp Cloud API, and responds to the original webhook request."
      },
      "typeVersion": 1
    },
    {
      "id": "cd603d38-ed80-47ea-a8b1-966c2f0729fc",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1184,
        416
      ],
      "parameters": {
        "color": 7,
        "width": 592,
        "height": 304,
        "content": "## Telegram message intake\n\nReceives Telegram webhook events, parses the incoming message, and validates whether it should enter the Telegram sales flow."
      },
      "typeVersion": 1
    },
    {
      "id": "ffb08247-06c8-4a9e-83e8-99b681d7e94e",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -528,
        272
      ],
      "parameters": {
        "color": 7,
        "width": 672,
        "height": 304,
        "content": "## Send Telegram payment link\n\nSaves the Telegram client record to Google Sheets, sends the payment link through the Telegram bot, and returns a webhook response."
      },
      "typeVersion": 1
    },
    {
      "id": "b9c73bd5-11fc-4d18-945c-9d5d4059c66b",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1184,
        752
      ],
      "parameters": {
        "color": 7,
        "width": 592,
        "height": 320,
        "content": "## Stripe payment intake\n\nReceives Stripe payment webhook events, parses the Stripe payload, and validates whether the event represents a successful payment to process."
      },
      "typeVersion": 1
    },
    {
      "id": "4da5f0b1-3c5a-4a99-8ddb-6067b3f21f9d",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -528,
        608
      ],
      "parameters": {
        "color": 7,
        "width": 400,
        "height": 320,
        "content": "## Find buyer channel\n\nLooks up the paid client in Google Sheets and branches based on whether the buyer originally came from Telegram or WhatsApp."
      },
      "typeVersion": 1
    },
    {
      "id": "38a6396e-6c2e-4d4b-9444-1fe5156fb206",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        176,
        288
      ],
      "parameters": {
        "color": 7,
        "width": 496,
        "height": 496,
        "content": "## Deliver PDF link\n\nSends the purchased PDF link through the detected channel, using Telegram for Telegram buyers or the WhatsApp Cloud API for WhatsApp buyers, then acknowledges Stripe."
      },
      "typeVersion": 1
    },
    {
      "id": "574fd629-ed46-464f-a549-4f1352999f69",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -96,
        608
      ],
      "parameters": {
        "color": 7,
        "width": 240,
        "height": 448,
        "content": "## Invalid payment fallback\n\nHandles the fallback branch for invalid or unmatched Stripe payment events by sending a configured WhatsApp HTTP request before the Stripe response node completes the webhook flow."
      },
      "typeVersion": 1
    },
    {
      "id": "718f9c1a-9f4f-4b04-b966-fa89b41999d4",
      "name": "When WhatsApp Message Received",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -1136,
        224
      ],
      "parameters": {
        "path": "whatsapp-verify",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "typeVersion": 1
    },
    {
      "id": "cdf67b64-9916-4641-b99b-74d5c30ddc9e",
      "name": "Extract WhatsApp Message",
      "type": "n8n-nodes-base.code",
      "position": [
        -928,
        224
      ],
      "parameters": {
        "jsCode": "const body = $input.first().json.body;\nlet phone = '';\nlet message = '';\n\ntry {\n  const entry = body.entry?.[0];\n  const changes = entry?.changes?.[0];\n  const value = changes?.value;\n  const msg = value?.messages?.[0];\n  \n  phone = msg?.from?.trim() || '';\n  message = msg?.text?.body?.toLowerCase().trim() || '';\n} catch(e) {\n  phone = '';\n  message = '';\n}\n\nreturn [{ json: { phone, message, channel: 'whatsapp', chat_id: phone } }];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "dd7370fb-a299-4e3d-b4fe-c83c24a97d12",
      "name": "When Telegram Message Received",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -1136,
        544
      ],
      "parameters": {
        "path": "telegram-incoming",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "typeVersion": 1
    },
    {
      "id": "23d6593e-daa1-440f-a013-f9151a0c0348",
      "name": "Extract Telegram Message",
      "type": "n8n-nodes-base.code",
      "position": [
        -928,
        544
      ],
      "parameters": {
        "jsCode": "const body = $input.first().json.body;\nlet chat_id = '';\nlet message = '';\nlet first_name = 'friend';\ntry {\n  const msg = body.message;\n  chat_id = String(msg?.chat?.id || '');\n  message = msg?.text?.toLowerCase().trim() || '';\n  first_name = msg?.chat?.first_name || 'friend';\n} catch(e) {\n  chat_id = '';\n  message = '';\n}\nreturn [{ json: { phone: '', message, channel: 'telegram', chat_id, first_name } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "3b8ec21e-a4ed-4a34-bc07-4a35bc406e25",
      "name": "Check WhatsApp Message Validity",
      "type": "n8n-nodes-base.if",
      "position": [
        -736,
        224
      ],
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $json.phone }}",
              "operation": "isNotEmpty"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "404af241-da1a-4965-a68b-2586c24f5188",
      "name": "Check Telegram Message Validity",
      "type": "n8n-nodes-base.if",
      "position": [
        -736,
        544
      ],
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $json.chat_id }}",
              "operation": "isNotEmpty"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "8e8e806c-c0f0-4eb6-8677-c07c0613c2bc",
      "name": "Add WhatsApp Client to Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        224,
        -96
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [
            {
              "id": "phone",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "phone",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "channel",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "channel",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "chat_id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "chat_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "timestamp",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "timestamp",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "message",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "message",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "first_name",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "first_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "autoMapInputData",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "YOUR_GOOGLE_SHEET_ID"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4
    },
    {
      "id": "37e89b35-51db-4557-931e-0596f63a7a3b",
      "name": "Add Telegram Client to Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -480,
        400
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [
            {
              "id": "phone",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "phone",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "channel",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "channel",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "chat_id",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "chat_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "timestamp",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "timestamp",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "message",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "message",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "first_name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "first_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "autoMapInputData",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "YOUR_GOOGLE_SHEET_ID"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4
    },
    {
      "id": "25532142-2d9a-497d-a762-7201b34b8790",
      "name": "Send WhatsApp Payment Link",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        432,
        -96
      ],
      "parameters": {
        "url": "https://graph.facebook.com/v19.0/YOUR_WHATSAPP_PHONE_NUMBER_ID/messages",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"messaging_product\": \"whatsapp\",\n  \"to\": \"{{ $('Extract WhatsApp Message').item.json.phone }}\",\n  \"type\": \"text\",\n  \"text\": {\n    \"body\": \"Hi! \ud83d\udc4b\\n\\nThanks for your interest in our product!\\n\\n\ud83d\udcd6 *YOUR PRODUCT NAME*\\n\\n\ud83d\udcb0 Price: *YOUR PRICE*\\n\\n\ud83d\udc46 Pay here:\\nhttps://buy.stripe.com/YOUR_PAYMENT_LINK\\n\\nYour file will arrive here automatically after payment! \ud83d\ude80\"\n  }\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4
    },
    {
      "id": "133fc78d-5dac-43de-bfa8-41a69b7c15c9",
      "name": "Send Telegram Payment Link",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -272,
        400
      ],
      "parameters": {
        "text": "=\ud83d\udc4b Hi, {{ $json.first_name }}! *YOUR PRODUCT NAME*. Price: YOUR PRICE. Pay via the link below \u2014 your file will arrive here automatically: https://buy.stripe.com/YOUR_PAYMENT_LINK Please enter your phone number at checkout. \ud83d\ude80",
        "chatId": "={{ $json.chat_id }}",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "1db9856f-41d5-4c3a-8163-2457fbc46549",
      "name": "Acknowledge WhatsApp Message",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        624,
        -96
      ],
      "parameters": {
        "options": {},
        "respondWith": "text",
        "responseBody": "OK"
      },
      "typeVersion": 1
    },
    {
      "id": "9d74e631-d504-4d8d-9eca-72e7ede5c9df",
      "name": "Acknowledge Telegram Message",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        0,
        400
      ],
      "parameters": {
        "options": {},
        "respondWith": "text",
        "responseBody": "OK"
      },
      "typeVersion": 1
    },
    {
      "id": "c02992d6-5229-4ed0-a212-b83c4f312ef5",
      "name": "When Stripe Payment Posted",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -1136,
        912
      ],
      "parameters": {
        "path": "stripe-payment",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "lastNode"
      },
      "typeVersion": 1
    },
    {
      "id": "5e2583ba-6863-4491-b068-63d73eff516c",
      "name": "Extract Stripe Payment Details",
      "type": "n8n-nodes-base.code",
      "position": [
        -928,
        912
      ],
      "parameters": {
        "jsCode": "const body = $input.first().json.body;\nconst event = body;\nif (event.type !== 'checkout.session.completed') {\n  return [{ json: { skip: true } }];\n}\nconst session = event.data?.object;\nconst phone = session?.customer_details?.phone || '';\nconst customerName = session?.customer_details?.name || 'customer';\nconst amountPaid = (session?.amount_total || 0) / 100;\nconst currency = session?.currency?.toUpperCase() || 'EUR';\nreturn [{ json: { phone, customerName, amountPaid, currency, skip: !phone } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "3c155284-258f-4e7c-97f3-2c4d0ec469d5",
      "name": "Check Payment Validity",
      "type": "n8n-nodes-base.if",
      "position": [
        -736,
        912
      ],
      "parameters": {
        "conditions": {
          "boolean": [
            {
              "value1": "={{ $json.skip }}"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "ed9f4888-e46b-41b5-9a86-93dcfea318ed",
      "name": "Retrieve Client From Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -480,
        768
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "=={{ $json.phone }}",
              "lookupColumn": "phone"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "value": "YOUR_GOOGLE_SHEET_ID",
          "__mode": "id"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4
    },
    {
      "id": "dfa7b377-c3d3-45d6-af64-440218cc1492",
      "name": "Determine Communication Channel",
      "type": "n8n-nodes-base.if",
      "position": [
        -272,
        768
      ],
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $json.channel }}",
              "value2": "telegram",
              "operation": "equals"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "3153c273-c14b-4780-8431-2399fc573483",
      "name": "Deliver PDF via Telegram",
      "type": "n8n-nodes-base.telegram",
      "position": [
        224,
        464
      ],
      "parameters": {
        "text": "\ud83c\udf89 *Payment successful!*\n\nThanks for your purchase, {{ $json.customerName }}!\n\n\ud83d\udce5 *Here's your download link:*\n\nhttps://drive.google.com/uc?export=download&id=YOUR_PDF_FILE_ID\n\n\u26a0\ufe0f This link is personal \u2014 please don't share it.\n\nQuestions? Just message me! \ud83d\ude0a",
        "chatId": "={{ $json.chat_id }}",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "94f7917f-d2cf-4f80-b806-0ccfb97c2d59",
      "name": "Deliver PDF via WhatsApp",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        224,
        624
      ],
      "parameters": {
        "url": "https://graph.facebook.com/v19.0/YOUR_WHATSAPP_PHONE_NUMBER_ID/messages",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"messaging_product\": \"whatsapp\",\n  \"to\": \"{{ $json.phone }}\",\n  \"type\": \"text\",\n  \"text\": {\n    \"body\": \"\ud83c\udf89 *Payment successful!*\\n\\nThanks for your purchase!\\n\\n\ud83d\udce5 *Here's your download link:*\\n\\nhttps://drive.google.com/uc?export=download&id=YOUR_PDF_FILE_ID\\n\\nQuestions? Message us! \ud83d\ude0a\"\n  }\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4
    },
    {
      "id": "162ab818-b648-46c1-9c8f-45fc45da28ad",
      "name": "Send Fallback Notification",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -48,
        896
      ],
      "parameters": {
        "url": "https://graph.facebook.com/v19.0/YOUR_WHATSAPP_PHONE_NUMBER_ID/messages",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"messaging_product\": \"whatsapp\",\n  \"to\": \"{{ $json.phone }}\",\n  \"type\": \"text\",\n  \"text\": {\n    \"body\": \"\u2705 Payment received!\\n\\nWe couldn't automatically match your WhatsApp number. Please message us at YOUR@EMAIL.COM and we'll send your file manually within minutes! \ud83d\ude4f\"\n  }\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4
    },
    {
      "id": "df94b2ce-516c-4647-8cc3-af7eadab91c0",
      "name": "Acknowledge Stripe Payment",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        528,
        528
      ],
      "parameters": {
        "options": {},
        "respondWith": "text",
        "responseBody": "OK"
      },
      "typeVersion": 1
    },
    {
      "id": "3f4e2fbd-4c16-46b6-96d4-5f5dd511f917",
      "name": "When Payment Reminder Triggered",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -1136,
        -128
      ],
      "parameters": {
        "path": "whatsapp-verify",
        "options": {},
        "responseMode": "responseNode"
      },
      "typeVersion": 2.1
    },
    {
      "id": "7ade4678-e1e7-410a-8ac7-62164175ceca",
      "name": "Acknowledge Reminder Trigger",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        -928,
        -128
      ],
      "parameters": {
        "options": {},
        "respondWith": "text",
        "responseBody": "={{ $json.query['hub.challenge'] }}"
      },
      "typeVersion": 1.5
    },
    {
      "id": "e9b5b5c4-bfcb-47af-804e-620e23e3cc02",
      "name": "Retrieve Unpaid Clients",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -480,
        64
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "={{ $json.phone }}",
              "lookupColumn": "phone"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "YOUR_GOOGLE_SHEET_ID"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7,
      "alwaysOutputData": true
    },
    {
      "id": "abb03aa6-cef7-4d3e-a566-45aeea87be79",
      "name": "Check Payment Status Pending",
      "type": "n8n-nodes-base.if",
      "position": [
        -272,
        64
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "13390e2c-f938-467f-9d0b-79c96e4a44b5",
              "operator": {
                "type": "string",
                "operation": "empty",
                "singleValue": true
              },
              "leftValue": "={{ $json.status }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "c11aaba2-c3e3-4fbe-89b0-59dba85b7702",
      "name": "Post WhatsApp Payment Reminder",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        0,
        80
      ],
      "parameters": {
        "url": "https://graph.facebook.com/v19.0/YOUR_WHATSAPP_PHONE_NUMBER_ID/messages",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"messaging_product\": \"whatsapp\",\n  \"to\": \"{{ $('Extract WhatsApp Message').item.json.phone }}\",\n  \"type\": \"text\",\n  \"text\": {\n    \"body\": \"\ud83d\udc4b You showed interest in our product earlier!\\n\\n\ud83d\udcd6 *YOUR PRODUCT NAME* \u2014 YOUR PRICE\\n\\nThe payment link is still active:\\nhttps://buy.stripe.com/YOUR_PAYMENT_LINK\\n\\nQuestions? Just ask! \ud83d\ude0a\"\n  }\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4
    },
    {
      "id": "1a264af1-62a4-4534-a010-bfabdb781622",
      "name": "Build Payment Reminder Message",
      "type": "n8n-nodes-base.set",
      "position": [
        0,
        -96
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "d26fc1be-9c89-40d0-ac60-37a037c946f9",
              "name": "phone",
              "type": "string",
              "value": "={{ $('Extract WhatsApp Message').item.json.phone.trim() }}\n"
            },
            {
              "id": "7b25b184-0179-4fa8-b5fd-09e3239661cf",
              "name": "channel",
              "type": "string",
              "value": "=whatsapp"
            },
            {
              "id": "1ff0d42c-0baf-4fd1-be23-7cb041b7c56b",
              "name": "chat_id",
              "type": "string",
              "value": "={{ $('Extract WhatsApp Message').item.json.chat_id.trim() }}\n"
            },
            {
              "id": "c6e3a014-a47a-488a-8c9f-0cc42d02d38c",
              "name": "timestamp",
              "type": "string",
              "value": "={{ new Date().toISOString() }}"
            },
            {
              "id": "f5f821a9-4e0f-4cc1-a7fd-fe344bf07405",
              "name": "status",
              "type": "string",
              "value": "=sent_link"
            }
          ]
        }
      },
      "typeVersion": 3.4
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "executionOrder": "v1"
  },
  "nodeGroups": [],
  "connections": {
    "Check Payment Validity": {
      "main": [
        [
          {
            "node": "Retrieve Client From Sheets",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Fallback Notification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Retrieve Unpaid Clients": {
      "main": [
        [
          {
            "node": "Check Payment Status Pending",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Deliver PDF via Telegram": {
      "main": [
        [
          {
            "node": "Acknowledge Stripe Payment",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Deliver PDF via WhatsApp": {
      "main": [
        [
          {
            "node": "Acknowledge Stripe Payment",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Telegram Message": {
      "main": [
        [
          {
            "node": "Check Telegram Message Validity",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract WhatsApp Message": {
      "main": [
        [
          {
            "node": "Check WhatsApp Message Validity",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Fallback Notification": {
      "main": [
        [
          {
            "node": "Acknowledge Stripe Payment",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Telegram Payment Link": {
      "main": [
        [
          {
            "node": "Acknowledge Telegram Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send WhatsApp Payment Link": {
      "main": [
        [
          {
            "node": "Acknowledge WhatsApp Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When Stripe Payment Posted": {
      "main": [
        [
          {
            "node": "Extract Stripe Payment Details",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Retrieve Client From Sheets": {
      "main": [
        [
          {
            "node": "Determine Communication Channel",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Payment Status Pending": {
      "main": [
        [
          {
            "node": "Build Payment Reminder Message",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Post WhatsApp Payment Reminder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add Telegram Client to Sheets": {
      "main": [
        [
          {
            "node": "Send Telegram Payment Link",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add WhatsApp Client to Sheets": {
      "main": [
        [
          {
            "node": "Send WhatsApp Payment Link",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Payment Reminder Message": {
      "main": [
        [
          {
            "node": "Add WhatsApp Client to Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Stripe Payment Details": {
      "main": [
        [
          {
            "node": "Check Payment Validity",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When Telegram Message Received": {
      "main": [
        [
          {
            "node": "Extract Telegram Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When WhatsApp Message Received": {
      "main": [
        [
          {
            "node": "Extract WhatsApp Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Telegram Message Validity": {
      "main": [
        [
          {
            "node": "Add Telegram Client to Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check WhatsApp Message Validity": {
      "main": [
        [
          {
            "node": "Retrieve Unpaid Clients",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Determine Communication Channel": {
      "main": [
        [
          {
            "node": "Deliver PDF via Telegram",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Deliver PDF via WhatsApp",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When Payment Reminder Triggered": {
      "main": [
        [
          {
            "node": "Acknowledge Reminder Trigger",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}