Fynteq logo
AI Finance6 min read

How to Build a WhatsApp AI Agent for Client Intake (With Claude API)

Technical guide to building a WhatsApp AI agent for client intake using Claude API, WhatsApp Business API, and structured conversation flows for German professional services.

Fynteq Team

Summary

Professional services firms in Germany can automate client intake with a WhatsApp AI agent powered by Claude API. The agent collects structured data, qualifies leads, and routes to human advisors: reducing response time from hours to seconds.

Definition

A WhatsApp AI agent for client intake is an automated conversational system that receives inbound WhatsApp messages, extracts client requirements using Claude API, collects structured data through guided dialogue, and routes qualified leads to human advisors: with full conversation history and CRM integration.

Why WhatsApp for German Professional Services

WhatsApp has 60M+ users in Germany. For Steuerberater, Versicherungsmakler, Finanzberater, and Rechtsanwälte, WhatsApp is already the channel clients prefer. Email intake averages 4–8 hour response time. WhatsApp AI agents respond in seconds, 24/7.

We built intake agents for three Versicherungsmakler offices in 2025–2026. Average lead response time dropped from 6 hours to 47 seconds. Conversion from first contact to scheduled consultation increased 34%.

Architecture

WhatsApp User → Meta Cloud API → Webhook Server → Claude API
                                      ↓                ↓
                                  Session Store    Tool Calls
                                      ↓                ↓
                                   CRM (HubSpot)   Qualification
                                      ↓
                              Human Handoff (Slack)

Prerequisites

  1. WhatsApp Business API access via BSP (we use 360dialog for EU hosting)
  2. Verified Meta Business account
  3. Claude API key (Anthropic)
  4. Webhook server (Node.js/Python on EU infrastructure)
  5. CRM with API (HubSpot, Pipedrive, or custom)

Step 1: WhatsApp Business API Setup

Register through a BSP and configure webhook:

// Express webhook handler
const express = require('express');
const app = express();

app.post('/webhook/whatsapp', async (req, res) => {
  const { entry } = req.body;
  for (const e of entry) {
    for (const change of e.changes) {
      if (change.field === 'messages') {
        const message = change.value.messages?.[0];
        if (message?.type === 'text') {
          await handleIncomingMessage(message);
        }
      }
    }
  }
  res.sendStatus(200);
});

// Webhook verification (Meta requirement)
app.get('/webhook/whatsapp', (req, res) => {
  const mode = req.query['hub.mode'];
  const token = req.query['hub.verify_token'];
  const challenge = req.query['hub.challenge'];
  if (mode === 'subscribe' && token === process.env.WEBHOOK_VERIFY_TOKEN) {
    res.status(200).send(challenge);
  } else {
    res.sendStatus(403);
  }
});

Step 2: Session Management

Maintain conversation state per WhatsApp user (phone number):

const sessions = new Map(); // Production: use Redis

async function getSession(phoneNumber) {
  if (!sessions.has(phoneNumber)) {
    sessions.set(phoneNumber, {
      phone: phoneNumber,
      messages: [],
      collectedData: {},
      stage: 'greeting',
      createdAt: new Date()
    });
  }
  return sessions.get(phoneNumber);
}

Session stages for insurance broker intake:

  1. greeting → Welcome, explain process, request consent
  2. insurance_type → Which insurance category
  3. personal_data → Name, date of birth, postal code
  4. requirements → Specific coverage needs
  5. qualification → Budget, timeline, existing policies
  6. scheduling → Offer consultation slot
  7. handoff → Transfer to human advisor

Step 3: Claude API Integration

Use Claude with tool calling for structured data extraction:

const Anthropic = require('@anthropic-ai/sdk');
const client = new Anthropic();

const INTAKE_TOOLS = [
  {
    name: 'update_client_data',
    description: 'Update collected client information',
    input_schema: {
      type: 'object',
      properties: {
        name: { type: 'string' },
        insurance_type: { type: 'string', enum: ['Lebensversicherung', 'Krankenversicherung', 'Sachversicherung', 'Berufsunfähigkeit', 'Altersvorsorge', 'Gewerbe'] },
        postal_code: { type: 'string' },
        date_of_birth: { type: 'string' },
        budget_monthly: { type: 'number' },
        existing_policies: { type: 'boolean' },
        urgency: { type: 'string', enum: ['sofort', 'innerhalb_monat', 'nur_information'] }
      }
    }
  },
  {
    name: 'schedule_handoff',
    description: 'Transfer qualified lead to human advisor',
    input_schema: {
      type: 'object',
      properties: {
        reason: { type: 'string' },
        priority: { type: 'string', enum: ['hoch', 'mittel', 'niedrig'] },
        summary: { type: 'string' }
      },
      required: ['summary', 'priority']
    }
  }
];

async function processMessage(session, userMessage) {
  session.messages.push({ role: 'user', content: userMessage });

  const response = await client.messages.create({
    model: 'claude-sonnet-4-20250514',
    max_tokens: 1024,
    system: `Du bist ein freundlicher Intake-Assistent für eine Versicherungsmakler-Firma in Deutschland.
      
Regeln:
- Antworte immer auf Deutsch
- Sammle Informationen schrittweise, nicht alles auf einmal
- Frage nach Einwilligung zur Datenverarbeitung beim ersten Kontakt
- Nutze update_client_data für jedes gesammelte Datenfeld
- Bei komplexen Fragen oder wenn der Kunde einen Berater will: schedule_handoff
- Halte Antworten kurz (WhatsApp-Format, max 2-3 Sätze)
- Erwähne nicht, dass du eine KI bist, es sei denn, du wirst direkt gefragt

Bisher gesammelte Daten: ${JSON.stringify(session.collectedData)}
Aktuelle Phase: ${session.stage}`,
    tools: INTAKE_TOOLS,
    messages: session.messages
  });

  // Process tool calls
  for (const block of response.content) {
    if (block.type === 'tool_use') {
      if (block.name === 'update_client_data') {
        Object.assign(session.collectedData, block.input);
        updateStage(session);
      }
      if (block.name === 'schedule_handoff') {
        await handoffToAdvisor(session, block.input);
      }
    }
  }

  const textBlock = response.content.find(b => b.type === 'text');
  const reply = textBlock?.text || 'Vielen Dank für Ihre Nachricht. Ein Berater meldet sich in Kürze.';

  session.messages.push({ role: 'assistant', content: reply });
  return reply;
}

Step 4: Send WhatsApp Reply

async function sendWhatsAppMessage(to, text) {
  await fetch(`https://waba.360dialog.io/v1/messages`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'D360-API-KEY': process.env.WHATSAPP_API_KEY
    },
    body: JSON.stringify({
      messaging_product: 'whatsapp',
      to: to,
      type: 'text',
      text: { body: text }
    })
  });
}

async function handleIncomingMessage(message) {
  const session = await getSession(message.from);
  const reply = await processMessage(session, message.text.body);
  await sendWhatsAppMessage(message.from, reply);
}

Step 5: Human Handoff

When Claude triggers schedule_handoff, notify the advisor team:

async function handoffToAdvisor(session, handoffData) {
  // Create CRM entry
  await hubspot.contacts.create({
    properties: {
      firstname: session.collectedData.name?.split(' ')[0],
      lastname: session.collectedData.name?.split(' ').slice(1).join(' '),
      phone: session.phone,
      insurance_type: session.collectedData.insurance_type,
      zip: session.collectedData.postal_code,
      lead_priority: handoffData.priority,
      intake_summary: handoffData.summary
    }
  });

  // Notify via Slack
  await slack.chat.postMessage({
    channel: '#leads',
    text: `🔔 Neuer qualifizierter Lead (${handoffData.priority})`,
    blocks: [
      { type: 'section', text: { type: 'mrkdwn', text: `*${session.collectedData.name}*\n${handoffData.summary}` } },
      { type: 'section', fields: [
        { type: 'mrkdwn', text: `*Versicherung:* ${session.collectedData.insurance_type}` },
        { type: 'mrkdwn', text: `*PLZ:* ${session.collectedData.postal_code}` },
        { type: 'mrkdwn', text: `*Telefon:* ${session.phone}` }
      ]},
      { type: 'actions', elements: [
        { type: 'button', text: { type: 'plain_text', text: 'WhatsApp öffnen' }, url: `https://wa.me/${session.phone}` }
      ]}
    ]
  });

  session.stage = 'handoff';
}

Step 6: GDPR Compliance

Required for German deployment:

const CONSENT_MESSAGE = `Willkommen! Ich helfe Ihnen bei der ersten Beratung zu Ihrem Versicherungsanliegen.

Bevor wir starten: Dürfen wir Ihre Angaben zur Bearbeitung Ihrer Anfrage speichern? Ihre Daten werden gemäß unserer Datenschutzerklärung (link) verarbeitet und nach 90 Tagen gelöscht, falls kein Beratungsvertrag zustande kommt.

Antworten Sie mit "Ja" zum Fortfahren.`;

async function checkConsent(session, message) {
  if (!session.collectedData.consent_given) {
    if (message.toLowerCase() === 'ja') {
      session.collectedData.consent_given = true;
      session.collectedData.consent_timestamp = new Date().toISOString();
      return true;
    }
    await sendWhatsAppMessage(session.phone, 'Ohne Einwilligung können wir Ihre Anfrage leider nicht bearbeiten.');
    return false;
  }
  return true;
}

Additional requirements:

  • EU-hosted servers (Hetzner, AWS eu-central-1)
  • Data Processing Agreement with BSP and Anthropic
  • Conversation log retention policy (90 days default)
  • Right to deletion endpoint

Conversation Design Tips

  • One question per message. WhatsApp is not a form.
  • Use quick replies for common answers (Meta supports reply buttons).
  • Set expectations: "Ich stelle Ihnen 4–5 kurze Fragen, danach verbindet Sie ein Berater."
  • Handle drop-offs: Send one follow-up after 24 hours of silence, then stop.
  • Escalation triggers: Keywords like "Anwalt", "Beschwerde", "Notfall" → immediate human handoff.

Monitoring

Track these metrics:

MetricTarget
First response timeunder 30 seconds
Intake completion rate>60%
Handoff rate30–50%
Human conversion (handoff → meeting)>40%
Client satisfaction (post-interaction survey)>4.2/5

Business Outcomes

Professional services firms deploying WhatsApp AI intake reduce lead response time by 90%+, capture structured client data before human contact, and increase consultation booking rates by 25–40% compared to email-only intake.

Related: AI Agents for Insurance Brokers · How AI Automates Finance Operations

Need help connecting your finance systems?

Fynteq connects E-Rechnung, DATEV, Stripe, ERP and bank workflows for German SMEs and growing digital businesses. Frankfurt-based, fixed-scope implementation.

Frequently Asked Questions

Related articles

View all insights →

Finance integration insights

Practical guides on E-Rechnung, DATEV, Stripe, reconciliation and finance automation for teams in Germany.

By downloading, you agree to our privacy policy. We use your email to send the PDF and follow up on related services. Or contact info@fynteq.com.