Lead and Customer Management
Build intelligent workflows to manage leads and customers using RFM (Recency, Frequency, Monetary) analysis and personalized SMS notifications. Automate lead scoring, customer segmentation, and targeted messaging to boost conversions and retention.

Target Audiences
Prerequisites
Step 1: Create a New Project
Step 2: Add Content Input Nodes
Input data comes from two sources: Google Sheets (customer data) and Google Docs (RFM scoring guidelines). Configure each node as follows.
2.1. Google Sheets Node
Uploads customer data for RFM analysis and messaging.
Suggested Content:
2.2. Google Docs Node
Uploads RFM scoring guidelines for lead/customer analysis.
Suggested Content:
Step 3: Connect Data to Vector Store Node
To unify customer data and RFM guidelines:
Step 4: Add the AI Assistant Node (RFM Analysis)
This node analyzes customers using the RFM model and generates a report.
RFM Analysis Instruction Template
You are an AI assistant for lead and customer management. Your goal is to analyze customer data using the RFM (Recency, Frequency, Monetary) model and classify leads for prioritization. 1. Retrieve data: - Customer data from Google Sheet (…Google Sheet ID…): Name, Email, Phone Number, City, Last Purchase Date, Purchase Count, Total Spend, Average Spend, Interest Category. - RFM scoring guidelines from Google Doc (…Google Doc ID…) in the Vector Store. 2. Implement RFM model per the guidelines: - Recency: Score 1–5 based on Last Purchase Date. - Frequency: Score 1–5 based on Purchase Count. - Monetary: Score 1–5 based on Total Spend. - Calculate RFM Score (sum of R, F, M) and assign categories (e.g., VIP: RFM ≥ 12, Potential: 6–9, Needs Attention: <6, Loyal: high Frequency). 3. For all customers, call the updateCustomerRFM function with this structure: updateCustomerRFM( "sheet_id": "…google sheet ID…", "data": [ { "customer": "Name", "email": "Email", "rfm_score": "RFM Score", "category": "Category", "phone": "Phone Number" } ] ) 4. Important: - Provide no descriptions or analysis, only call updateCustomerRFM. - Announce the result of the function call (e.g., “Report written successfully”).
Step 5: Add Google Sheets and Function Call Nodes (RFM Report)
To store the RFM report and execute the write function:5.1. Google Sheets Node (RFM Report)
5.2. Function Call Node (Write RFM Report)
Step 6: Add the First Telegram Node (RFM Summary)
This step enables delivering AI Assistant responses via an interactive chat frame on your website or app, with testing capabilities:
1. Create a Telegram Bot:
2. Configure Telegram Node:
Connect Nodes:
4. Test the Bot:
5. Save Changes:
Step 7: Add the Trigger Node
Step 8: Add the Second AI Assistant Node (SMS Generation)
SMS Generation Instruction Template
You are an AI assistant for generating personalized SMS messages. Your goal is to create marketing SMS messages based on RFM customer data for goals like retention, repeat purchase, or new product promotion. 1. Retrieve customer data by calling the …read function’s name… function to extract columns: customer, email, rfm_score, category, phone from Google Sheet. 2. For each customer, generate an SMS based on their category: - VIP: Encourage repeat purchase (e.g., «علی عزیز، با خرید دوباره ۱۰٪ تخفیف بگیرید! 😊»). - Potential: Promote first purchase (e.g., «سارا جان، محصول جدید ما رو امتحان کن! 🎉»). - Needs Attention: Re-engage (e.g., «محمد عزیز، دلمون براتون تنگ شده! با کد XYZ ۲۰٪ تخفیف بگیرید.»). - Loyal: Reward loyalty (e.g., «مهران عزیز، ممنون که همراهمون هستی! 😊»). 3. Ensure messages are: - In Persian, friendly tone, under 160 characters, with up to 2 emojis. - Tailored to the customer’s category. 4. Generate a JSON output for each customer: { "receptor": "Phone Number", "message": "message" } 5. Combine all outputs into a JSON list: [ { "receptor": "09197208607", "message": "علی عزیز، با خرید دوباره ۱۰٪ تخفیف بگیرید! 😊" }, { "receptor": "09123456789", "message": "سارا جان، محصول جدید ما رو امتحان کن! 🎉" } ] 6. Send the JSON list to the SMS Node for delivery. 7. Send a summary to the Telegram Node (e.g., “20 SMS messages sent to VIP customers”). Important: - Output must be JSON only, with no descriptions or analysis. - Messages must be in Persian, under 160 characters. - Send the summary to Telegram in Persian.
Step 9: Add Function Call Node (Read RFM Report)
To read the RFM report from Google Sheets:
1. Add Node:
2. Configure Node:
Step 10: Add the SMS Node
- Choose Templated Message.
- Enter template title in English (e.g., “CustomerFollowUp”).
- Specify tokens: Token 1 (Customer), Token 2 (Offer or Status).
- Select message type: SMS.
- For testing: Enter a test number (e.g., +989123456789) and test message (e.g., «سلام! این پیام آزمایشی است.»).
- Click Send Test SMS to verify delivery.
For high-volume SMS campaigns, monitor KavehNegar’s dashboard or submit a ticket for assistance.
Step 11: Add the Second Telegram Node (SMS Summary)
- From the right-hand menu, click Telegram Node.
- Enter a title, e.g., «خلاصه پیامک» (SMS Summary).
- Enter the bot token and click Test Connection.
- Configure Advanced Settings:
- Welcome Message: «سلام! آماده دریافت خلاصه پیامکهای ارسالی هستید؟ 😊»
- Group Access: Enable if needed.
- Access Restriction: Select All.
- Message Limit: Set to 10 messages per minute.
- Click Register and Continue.
Step 12: Add the Trigger Node
To automate the initiation of your workflow with precise timing:
Add Node:
2. Configure Node:
Connect Nodes:
Test the Trigger
Save Changes:
Why It’s Needed
Key Tips for Success
Final Output
Ready to Transform Your Lead and Customer Management?
Start building your Lead and Customer Management workflow today. Automate RFM analysis, prioritize leads, and engage customers with personalized SMS messages to drive conversions and retention with AI-powered precision.