Follow-Up Processor
Service that processes automated follow-up messages for conversations
Overview
The Follow-Up Processor service handles automated follow-up messages for conversations. It processes follow-up requests, validates business rules, and generates AI-powered follow-up messages to engage customers who haven’t made appointments yet.
Architecture diagram
Business Rules
Follow-up messages are only sent when all of the following conditions are met:
- Conversation Status: Conversation must be open (not closed)
- Tenant Module: Tenant must have APPOINTMENTS module enabled
- Follow-up Enabled: Tenant must have follow-up feature enabled in appointment configuration
- No Existing Appointments: Customer must not have any existing appointments
- Channel Active: Channel must be active, or sender must be in test senders list
- WhatsApp Configured: Channel must have WhatsApp phone number configured
Processing Flow
How Follow-Up Processor Works
-
Receive Request
Follow-up request is received from the Follow-Up Queue (contains conversation ID)
-
Load Conversation
Service loads conversation from repository
-
Validate Rules
Service validates all business rules (conversation status, tenant config, appointments, etc.)
-
Load Context
Service loads customer data, conversation history, and tenant configuration
-
Generate Follow-up
AI chatbot service generates contextual follow-up message using conversation history
-
Send Message
Follow-up message is sent via WhatsApp API
Error Handling
The processor implements smart error handling with two types of errors:
Retryable Errors
- Conversation not found
- Tenant not found
- Channel not found
- WhatsApp phone number not configured
Non-Retryable Errors (Skipped)
- Conversation is closed
- Tenant doesn’t have APPOINTMENTS module
- Follow-up disabled for tenant
- Customer already has appointments
- Channel is inactive (and sender not in test list)
Integration
The Follow-Up Processor integrates with:
- Chatbot Service: For generating AI-powered follow-up messages
- Conversation Repository: For accessing conversation data
- Customer Repository: For customer information
- Appointment Repository: For checking existing appointments
- Tenant Repository: For tenant configuration
- Channel Repository: For channel settings
- WhatsApp Client: For sending messages