Martijn Hoogeveen
01 Software · SW-01

AI Customer Support Agent

A support agent wired into email, Instagram, WhatsApp and the store. It answers customers itself, and twice a day pushes a digest to my phone where I approve or correct its work.

Ticket
SW-01
Type
Feature · AI agent
Status
Live
Owner
Martijn Hoogeveen
Started
Nov 2026

01Problem statement

Customer messages arrive by email, Instagram DM and WhatsApp, in several languages and at all hours. A one-person company answered them by hand, often hours late, and most questions repeat: order status, fitment, finish, delivery time. Each answer needs the live order, the product data and the conversation history open side by side.

02Goals

In scope

  • One conversation store across all three channels
  • Replies grounded in live order, tracking and product data
  • First reply within the hour, every day
  • Human review that takes minutes, from a phone
  • The owner stays in control of anything risky

Out of scope

  • Automating refunds, damage claims or disputes
  • Guessing fitment when the data isn't explicit
  • Another inbox app to log into

03Acceptance criteria

  • Inbound from email, Instagram and WhatsApp lands in one thread per customer
  • Replies go out on the same channel and thread
  • Only allow-listed intents auto-send; everything else is drafted
  • Refunds, damage and payment questions escalate to the owner
  • The owner's own replies (Sent folder, WhatsApp app) are recorded, so nothing is answered twice
  • Never claims to be human when sincerely asked

04Design

  • A Cloudflare Worker ingests every channel: IMAP over TCP sockets for email (Inbox and Sent), signed Meta webhooks for Instagram, a signed BSP webhook for WhatsApp including the owner's app echoes
  • Messages are normalised into one KV conversation per customer, with list metadata for fast scans
  • Scheduled Claude runs read open threads, the live Shopify order and product, and a playbook of rules stored in KV
  • Replies are sent per channel; the owner's real email signature is appended server-side
  • At 11:00 and 17:00 the agent pushes a digest to my phone: what it sent, what it drafted, what needs me. I approve or correct each item, and corrections become new playbook rules
  • A silent hourly pass in between answers only what it's certain of and never messages me
  • Warm leads get follow-ups on a fixed cadence: after 2 quiet days, then every 4, at most 3
CHANNELSCLOUDFLARE WORKERstorereadcontextallow-listeddigestapproveEmailIMAP / SMTPInstagramGraph webhooksWhatsAppCloud APIIngestverify · normaliseKV storethreads · playbookSendper-channel APIAgentClaude · scheduledShopifyorders · tracking · productsMe, on my phonedigest 11:00 · 17:00corrections become playbook rules · HMAC-signed webhooks · IMAP lock + backoff
Fig. 1 · System architecture
Channels
Email · Instagram DM · WhatsApp, one thread per customer
Context
Live orders, tracking, products, finishes and prices from Shopify
Runtime
Edge, serverless (Cloudflare Workers)
Ingest
IMAP over TCP sockets, signed Meta and WhatsApp webhooks
State
KV: conversations, learned playbook, weekly stats
Human review
Push digest at 11:00 and 17:00: approve or correct in one tap
Between reviews
Silent hourly pass sends only replies it's certain of
Auto-send
Allow-listed intents only; everything else is drafted
Escalate
Refunds, damage, payments → owner
Security
HMAC verification, 10-min replay window

05Key decisions

DecisionAlternative consideredWhy
Scheduled passes (hourly + two full runs a day)An LLM call per inbound messageBatching gives cross-thread context and a review summary per run; within the hour is fast enough for e-commerce
Playbook rules in KVRules hard-coded in the promptRules change without a redeploy and learned rules persist between runs
WhatsApp coexistence via a BSPA separate WhatsApp numberThe business keeps its existing number and the owner can still reply from the phone app
Page-based Instagram messaging with a system-user tokenInstagram Login APINewer Meta apps don't offer Instagram Login; a system-user token doesn't expire

06Failure modes

RiskMitigation
Gmail refuses: too many simultaneous connectionsKV lock so only one sync runs, 25 s read timeout, 15-min backoff, last error on the health endpoint
Spoofed or replayed webhooksHMAC signature check and a 10-minute replay window
Marketing mail flooding the queueBulk mail (List-Unsubscribe / Precedence) auto-filtered, except allow-listed senders such as payments and couriers
The agent isn't sureIt drafts instead of sending, and the draft appears in the owner's run summary

07Testing & rollout

Testing

  • Self-sent email to verify threading and signature
  • Instagram DM tested in and out
  • Webhook signatures verified against real payloads

Rollout

  • Went live with zero auto-send categories
  • Widened one intent at a time: order status and tracking, delivery time, product, finish and price, explicit fitment, out-of-range, lead follow-ups

08Outcome

  • Live on email, Instagram and WhatsApp since November 2026
  • Six intent categories auto-send; the rest are drafted for review
  • Daily support work reduced to two short approval sessions on a phone

09Follow-ups

  • Retire the older support-hub app
  • Score the agent against the owner's edits to its drafts

Labels

  • Cloudflare Workers
  • Workers KV
  • Claude
  • IMAP / SMTP
  • Meta Graph API
  • WhatsApp Cloud API
  • Shopify Admin API
  • Agentic workflows
  • LLM orchestration
  • Tool use
  • Human-in-the-loop
  • Guardrails
  • Event-driven
  • Webhooks
  • Observability