Hi everyone,
I'm looking for an experienced n8n freelancer to build a workflow for automating order processing between Telegram and WhatsApp. Below is the detailed task description.
### Overview
The goal is to automate order processing:
- Orders come as messages in a Telegram chat (via a bot).
- Extract data (name, phone, order ID), validate the phone, and start a conversation in WhatsApp.
- Based on the WhatsApp reply, either notify a manager (via Telegram) or update the order status in Google Sheets.
- Include error logging and notifications.
### Example Telegram Message
Here’s the message format from Telegram:
```Имя: Артем
Телефон: +7 (939) 883-98-71
Информация о выбранном товаре
———
ID: 1458
Наименование: Fedrs Double Mint Hard 9
Артикул: 633148790
Цена: 450 ₽
Атрибуты:
Количество: 1
Итого: 450 ₽
Категории: Снюс (жевательный табак), Fedrs, Fedrs Ice Cool
Expected Result
- WhatsApp Message:
- User receives:
Приветствую. Вы оставили заказ на сайте, номер заказа 1458. Вас зовут Артем.
- User receives:
- User Replies in WhatsApp:
- If reply contains “оператор”, “менеджер”, “человек”, “поддержка”, “помощь”:
- Manager receives Telegram notification:
Запрос оператора. Заказ: 1458. Имя: Артем. Номер: +79398839871. Сообщение: подключи оператора.
- Manager receives Telegram notification:
- Otherwise (e.g., “все ок”):
- Google Sheets (“Orders” table) updates with:
Phone: +79398839871, Name: Артем, OrderID: 1458, Status: в сборку, Timestamp: <date>, Message: все ок
- Google Sheets (“Orders” table) updates with:
- If reply contains “оператор”, “менеджер”, “человек”, “поддержка”, “помощь”:
Workflow Steps
The workflow should include the following nodes:
- Telegram Trigger: Receive messages via Webhook.
- Use the bot token (provided).
- Function (Parsing): Extract
name
,phone
, andorderId
.- Code:
const text = $input.first().json.message.text; const nameMatch = text.match(/Имя: (.+)/); const phoneMatch = text.match(/Телефон: ([\+\d\s\(\)-]+)/); const idMatch = text.match(/ID: (\d+)/); return [{ json: { name: nameMatch ? nameMatch[1].trim() : null, phone: phoneMatch ? phoneMatch[1].replace(/[\s\(\)-]/g, '') : null, orderId: idMatch ? idMatch[1] : null } }];
- Code:
- IF (Phone Validation): Validate phone (format:
+79260000000
).- Condition:
{{ $json.phone !== null && $json.phone.match(/^\+\d{11}$/) }}
.
- Condition:
- Google Sheets (Log Error): If validation fails, log error.
- Table: “Logs” (columns: Timestamp, Step, Error/Message).
- Twilio (Send WhatsApp Message): Send initial message.
- Template:
Приветствую. Вы оставили заказ на сайте, номер заказа {{ $json.orderId }}. Вас зовут {{ $json.name }}.
- To:
whatsapp:{{ $json.phone }}
. - From: Provided Twilio WhatsApp number.
- Template:
- Webhook (WhatsApp Replies): Receive replies from WhatsApp.
- Set up Webhook in Twilio to receive
Body
(reply text).
- Set up Webhook in Twilio to receive
- Function (Check Keywords): Check for keywords (“оператор”, “менеджер”, “человек”, “поддержка”, “помощь”).
- Code:
const response = $input.first().json.Body.toLowerCase(); const needsOperator = /оператор|менеджер|человек|поддержка|помощь/.test(response); return [{ json: { needsOperator, Body: response } }];
- Code:
- IF (Condition): Check if
needsOperator
is true.- True: Notify manager.
- False: Update status.
- Telegram (Notify Manager): Send notification to manager chat.
- Message:
Запрос оператора. Заказ: {{ $json.orderId }}. Имя: {{ $json.name }}. Номер: {{ $json.phone }}. Сообщение: {{ $json.Body }}.
- Chat ID: Will be provided.
- Message:
- Google Sheets (Update Status): Set status to “в сборку”.
- Table: “Orders” (columns: Phone, Name, OrderID, Status, Timestamp, Message).
- Telegram (Error Notifications): Notify admin of errors.
- Chat ID: Will be provided.
Requirements
- Tools Already Set Up:
- n8n: Active account.
- Telegram: Bot created, token available.
- Twilio: WhatsApp number active, credentials available.
- Google Sheets: Two tables (“Orders”, “Logs”) created, Google Cloud access configured.
- Access: I will provide access to:
- n8n account.
- Telegram bot token.
- Twilio credentials.
- Google Sheets (via sharing).
- Chat IDs for manager and admin notifications.
- Skills Needed:
- Experience with n8n workflows.
- Familiarity with Telegram Bot API, Twilio (WhatsApp), Google Sheets API.
- JavaScript for Function nodes.
Expectations
- Deliverable: Fully working workflow in n8n, tested with sample messages.
- Testing:
- Send a test message in Telegram (as per example).
- Confirm WhatsApp message is sent.
- Reply with “подключи оператора” → manager notification.
- Reply with “все ок” → status “в сборку” in Google Sheets.
- Timeline & Budget: Please propose your timeline and rate.
- Communication: Prefer Telegram or email (I’ll share details with the selected freelancer).
Looking forward to your proposals!