AI Automation · Workflows · Agents

Rafiki — automations that read, decide and act.

An AI-powered automation engine that takes messy inbound work — WhatsApp messages, emails, form submissions, support tickets — classifies what it is, calls the tools it needs, and routes the outcome to the right place. Humans approve the edge cases, not the routine.

74%Inbound handled without a human
~40hManual triage removed per month
<6sMessage to action, end to end
rafiki — workflow: inbound-triage RUNNING
Trigger
New WhatsApp message
event
AI · classify
Intent + urgency extraction
llm
Route
Confidence ≥ 0.85 ?
branch
Action
Create ticket · reply · log
tools
last run completed · 5.2s · 3 tool calls · 1 approval queued
The problem

Inbound work arrived faster than anyone could triage it.

Orders, support questions, delivery issues and partner enquiries all landed in the same WhatsApp inbox and shared email. Someone had to read every message, work out what it was, and copy the details into the right system — several hundred times a week.

Before

  • Staff reading and re-reading every inbound message
  • Urgent issues buried under routine questions
  • Details re-typed into three systems, with errors

After

  • Every message classified and routed in seconds
  • Urgent items escalated, routine handled silently
  • Data written to the right system once, cleanly
Automations shipped

Workflows that run without being asked.

Each recipe is a versioned workflow in Rafiki — a trigger, some AI reasoning, optional branching, and one or more tool calls. They can be edited without redeploying the app.

Inbound message triage

Support

Reads WhatsApp and email, classifies intent and urgency, answers common questions from a knowledge base, and escalates the rest with full context.

WhatsApp→ Classify→ KB answer→ Escalate

Order confirmation & follow-up

Ops

When an order is paid, sends a confirmation, books delivery, creates the ops task, and follows up automatically if the order stalls.

M-Pesa paid→ Notify→ Book→ Follow up

Invoice & receipt extraction

Finance

Reads supplier invoices from email attachments, extracts line items and totals, validates against the PO, and posts to the accounting system.

Email→ Extract→ Match PO→ Post

Lead qualification

Sales

Scores inbound leads against fit criteria, writes the summary to the CRM, and books a call for the ones worth a human's time.

Form→ Score→ CRM→ Book

Daily ops digest

Reporting

Every morning at 07:00, pulls yesterday's numbers, writes a plain-language summary, and posts it to the team channel.

Cron→ Query→ Summarise→ Slack

Document Q&A handoff

AI

When someone asks a policy or contract question, retrieves the answer with citations — and hands off to a human if confidence is low.

Message→ RAG→ Cite→ Handoff
The engine

Every run is visible, replayable, and auditable.

No black boxes. Each step in a workflow logs its input, its output and its decision, so when something behaves unexpectedly you can see exactly why — and replay it after a fix.

Workflow run · inbound-triage · #48213

Live
14:22:07INPUTWhatsApp from +2547•••412 · "my order hasn't arrived and it's been 4 days"
14:22:08CLASSIFYintent=delivery_delay · urgency=high · confidence=0.94 · order_ref=PF-04812
14:22:09TOOLlookup_order(PF-04812) → status=in_transit · dispatched=2d ago
14:22:10BRANCHconfidence 0.94 ≥ 0.85 → auto_route = true
14:22:11TOOLreply_whatsapp(+2547•••412, template=delay_update, eta=tomorrow)
14:22:11TOOLcreate_task(board=ops, assignee=logistics, priority=high)
14:22:12DONErun completed in 5.2s · 3 tool calls · 0 escalations · logged
workflows/inbound_triage.ts
// A workflow is declarative — triggers, steps, guards, tools. export const inboundTriage = defineWorkflow({ id: 'inbound-triage', trigger: { type: 'webhook', source: 'whatsapp' }, steps: [ { id: 'classify', use: 'ai.classify', with: { schema: { intent: 'enum', urgency: 'enum', order_ref: 'string?' }, }}, { id: 'context', use: 'tools.lookup_order', when: s => !!s.classify.order_ref }, { id: 'route', use: 'branch', with: { auto: s => s.classify.confidence >= 0.85, human: 'approval_queue', // low-confidence goes to a person }}, { id: 'respond', use: 'tools.reply_whatsapp', when: s => s.route.auto === true }, ], // Every step's input/output is persisted for replay + audit. onRun: 'log.full_trace', });
What it gives you

Automation you can actually operate.

Multi-channel triggers

WhatsApp, email, webhooks, forms, cron schedules and database events all start the same kind of workflow.

Structured AI steps

Classification, extraction and summarisation return typed, validated JSON — not free text you have to parse later.

Confidence-based routing

High-confidence runs proceed automatically. Anything uncertain goes to a human queue with the reasoning attached.

Tool integrations

Built-in connectors for M-Pesa, WhatsApp, Slack, email, CRMs, Sheets and your own internal APIs via a typed tool registry.

Approval gates

High-stakes actions — refunds, large orders, outbound comms — can require a named human to approve before executing.

Replay & audit

Every run is stored with its full trace. Fix a workflow, replay the failed runs, and confirm the change did what you expected.

Results

Fewer hands on the routine, more on the important.

74%Inbound messages resolved without human handling
~40hManual triage time removed every month
5.2sMedian time from message to action
0Untracked requests — every one logged

“It doesn't replace the team — it just stops them doing the same three things four hundred times a week.”

— Operations lead, services deployment
Stack

Built with.

TypeScript Node.js Python OpenAI API LangChain PostgreSQL Redis BullMQ WhatsApp Business API M-Pesa Daraja Docker AWS

Got a process that eats hours every week?

I build AI automations that handle the routine, escalate the edge cases, and log everything — so your team stops being a message queue.