Follow-Up Processor

Service that processes automated follow-up messages for conversations

Service

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.

View the changelog

Want to know the history of this service? View the change logs

Contact the team

Any questions? Feel free to contact the owners

Receives 1 messages

This service receives messages from other services

Architecture diagram

Business Rules

Follow-up messages are only sent when all of the following conditions are met:

  1. Conversation Status: Conversation must be open (not closed)
  2. Tenant Module: Tenant must have APPOINTMENTS module enabled
  3. Follow-up Enabled: Tenant must have follow-up feature enabled in appointment configuration
  4. No Existing Appointments: Customer must not have any existing appointments
  5. Channel Active: Channel must be active, or sender must be in test senders list
  6. WhatsApp Configured: Channel must have WhatsApp phone number configured

Processing Flow

How Follow-Up Processor Works

  1. Receive Request

    Follow-up request is received from the Follow-Up Queue (contains conversation ID)

  2. Load Conversation

    Service loads conversation from repository

  3. Validate Rules

    Service validates all business rules (conversation status, tenant config, appointments, etc.)

  4. Load Context

    Service loads customer data, conversation history, and tenant configuration

  5. Generate Follow-up

    AI chatbot service generates contextual follow-up message using conversation history

  6. 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
Event-driven architecture documentation: Impulsell