AI Inactive Customer Reactivation System

We design and deploy artificial intelligence systems: from prototype to production-ready solutions. Our team combines expertise in machine learning, data engineering and MLOps to make AI work not in the lab, but in real business.
Showing 1 of 1 servicesAll 1566 services
AI Inactive Customer Reactivation System
Medium
~1-2 weeks
FAQ
AI Development Areas
AI Solution Development Stages
Latest works
  • image_website-b2b-advance_0.png
    B2B ADVANCE company website development
    1212
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1161
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    852
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1041
  • image_logo-advance_0.png
    B2B Advance company logo design
    561
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    822

Implementation of AI System for Inactive Customer Reactivation

Reactivating "dormant" customers is 5-7 times cheaper than acquiring new ones. An AI system determines the optimal reactivation timing, segments inactive customers by churn reason, and formulates a personalized offer for each segment.

Model for Segmenting Inactive Customers

import pandas as pd
import numpy as np
from sklearn.cluster import KMeans
from sklearn.preprocessing import StandardScaler
from anthropic import Anthropic

class InactiveCustomerAnalyzer:
    def __init__(self, inactivity_threshold_days: int = 90):
        self.threshold = inactivity_threshold_days
        self.llm = Anthropic()
        self.scaler = StandardScaler()

    def identify_inactive(self, customers_df: pd.DataFrame,
                           last_activity_col: str = 'last_purchase_date') -> pd.DataFrame:
        """Identifying inactive customers"""
        customers_df['days_inactive'] = (
            pd.Timestamp.now() -
            pd.to_datetime(customers_df[last_activity_col])
        ).dt.days

        inactive = customers_df[
            customers_df['days_inactive'] >= self.threshold
        ].copy()

        return inactive

    def segment_inactive(self, inactive_df: pd.DataFrame) -> pd.DataFrame:
        """Clustering inactive customers by behavioral pattern"""
        features = pd.DataFrame()

        features['days_inactive'] = inactive_df['days_inactive']
        features['total_orders'] = inactive_df.get('total_orders', 1)
        features['avg_order_value'] = inactive_df.get('avg_order_value', 0)
        features['order_frequency'] = inactive_df.get('order_frequency', 0)
        features['last_order_value'] = inactive_df.get('last_order_value', 0)
        features['support_issues'] = inactive_df.get('support_tickets_total', 0)

        X = self.scaler.fit_transform(features.fillna(0))

        km = KMeans(n_clusters=5, random_state=42, n_init=10)
        inactive_df['segment'] = km.fit_predict(X)

        # Segment descriptions
        segment_profiles = features.copy()
        segment_profiles['segment'] = inactive_df['segment']
        segment_stats = segment_profiles.groupby('segment').mean()

        # LLM names each segment
        for seg_id in range(5):
            if seg_id not in segment_stats.index:
                continue
            stats = segment_stats.loc[seg_id].to_dict()
            stats_str = ", ".join([f"{k}: {v:.1f}" for k, v in stats.items()])

            response = self.llm.messages.create(
                model="claude-3-5-sonnet-20241022",
                max_tokens=100,
                messages=[{
                    "role": "user",
                    "content": f"""Name this inactive customer segment (3-5 words) and suggest reactivation approach.

Stats: {stats_str}

Return: "Segment Name | 1-sentence strategy" """
                }]
            )
            print(f"Segment {seg_id}: {response.content[0].text}")

        return inactive_df


class ReactivationCampaign:
    """Reactivation campaign with personalization"""

    def __init__(self):
        self.llm = Anthropic()
        self.reactivation_offers = {
            0: {'discount': 20, 'message_theme': 'we_miss_you'},
            1: {'discount': 15, 'message_theme': 'best_of_what_they_liked'},
            2: {'discount': 10, 'free_shipping': True, 'message_theme': 'new_arrivals'},
            3: {'special_access': True, 'message_theme': 'exclusive_comeback'},
            4: {'survey': True, 'small_incentive': True, 'message_theme': 'help_us_improve'},
        }

    def create_reactivation_email(self, user: dict, segment: int) -> dict:
        """Personalized reactivation email"""
        offer = self.reactivation_offers.get(segment, {'discount': 10})
        days_inactive = user.get('days_inactive', 90)
        past_categories = user.get('top_categories', ['products'])

        response = self.llm.messages.create(
            model="claude-3-5-sonnet-20241022",
            max_tokens=300,
            messages=[{
                "role": "user",
                "content": f"""Write a reactivation email for an inactive customer.

Customer: {user.get('first_name', 'Customer')}
Inactive for: {days_inactive} days
Past purchases: {', '.join(past_categories[:3])}
Offer: {offer}

Requirements:
- Subject line (engaging, personal, 50 chars max)
- Body (150 words max, warm tone, mention specific past interest)
- Clear CTA

Return JSON: {{"subject": "...", "body": "...", "cta": "..."}}"""
            }]
        )

        try:
            import json
            return json.loads(response.content[0].text)
        except Exception:
            return {'subject': f"We miss you, {user.get('first_name', '')}!",
                    'body': response.content[0].text[:400], 'cta': 'Come Back'}

    def predict_reactivation_probability(self, user: dict,
                                          offer: dict) -> float:
        """Probability of reactivation with given offer"""
        # Simplified heuristic (in reality — trained model)
        base_prob = 0.05  # Base probability

        # Factors increasing probability
        if user.get('total_orders', 0) > 5:
            base_prob += 0.05  # Loyal customer
        if user.get('days_inactive', 999) < 180:
            base_prob += 0.08  # Recently left
        if offer.get('discount', 0) >= 20:
            base_prob += 0.06  # Good discount
        if user.get('email_open_rate', 0) > 0.3:
            base_prob += 0.04  # Opens emails

        return min(base_prob, 0.4)

Typical reactivation campaign conversion: 5-15% depending on inactivity duration and personalization quality. Optimal time windows: 90-180 days inactive (best response rate), 180-365 days (needs stronger motivation), > 365 days (usually cheaper to consider churned). Recommend 1-2 emails with 7-14 day interval, then stop.