Orix

A WhatsApp assistant that books meetings

Orix answers whoever messages Outrix Intelligence on WhatsApp, works out what they need and books the meeting with the team. Code controls which slots it offers, what data it keeps and which meetings it can touch. Before production it went through five test rounds, with no critical problem after the first, at about USD 0.11 per conversation.

Role
AI Engineer
Status
Ready for production
Built with
n8n, WhatsApp Cloud API, Python, PostgreSQL, Google Calendar, Docker

What it does

Orix answers people who message Outrix Intelligence on WhatsApp. It replies at once, handles questions from the company's knowledge document, finds out the person's name, company, need and urgency, and books a Google Meet call. It gives no prices, discounts or timelines, introduces itself as an assistant, and hands the chat to a person when the customer asks for one, wants to negotiate, or asks something the document doesn't cover.

The design started from four constraints: Meta's official WhatsApp API, the route Meta supports for businesses; the team replies from their phones on the same number and Orix steps aside when they do; meetings go on the shared calendar; and the cost had to stay close to zero with few customers a month.

Its own loop on the Messages API

I started with n8n's agent node, which is built on LangChain. When Claude asked for two tools in one response, the node split that message into several in the history. Claude's thinking blocks are bound to the exact conversation they were produced in, so the API rejected the next request with an invalid-signature error.

I replaced it with a loop against the Messages API. Each response is stored exactly as it arrives, the history is append-only, and the results of every tool in a step go back together in one message. The rules and the knowledge stay fixed in the system prompt, and what changes (the date, what's known about the customer, their meetings) goes in a context block inside each new message, so the fixed prompt is read from cache. The trade-off is that I maintain the loop instead of the node.

The model is Claude Sonnet 5.5, at half the price of Opus 5.5. Within one turn, Claude can call tools up to 8 times in a row. If it still fails after 3 attempts, the customer gets a fallback message, the chat goes to a person and an alert lands in Discord.

What the model doesn't decide

The rules that matter live in code, where they don't depend on the model following them:

  • Orix has 7 tools: find slots, book, move, cancel, add an email to a meeting, save what it knows about the customer, and hand off to a person. Each one requires all of its fields, and they get the chat's number from the workflow, not from the model, so they can only see and change that chat's meetings.
  • Finding slots checks the calendar against Colombian public holidays, computed in code, working hours, a 15-minute buffer and 2 hours' minimum notice. Booking queries the calendar again: if the model takes a busy slot for a free one, the meeting isn't created.
  • In one test, a customer sent their national ID and card number, and Orix replied that it hadn't stored them. Because the team uses the same number, the chat always stays on the phone and with Meta, so that sentence can never be true. Now the workflow masks card numbers, ID numbers, bank accounts, passwords, CVVs and expiry dates before the message is stored and before it reaches Claude, and Orix answers with a fixed line: "There's no need to send that and we don't use it. If you want the team to delete your data, I'll let them know." The filter has 16 cases it must mask and 13 it must leave alone, such as budgets, phone numbers or "the key is to sell more".
  • Before a reply goes out, the workflow checks that every time it mentions came from a calendar lookup or a booked meeting, and that it doesn't ask "should I show you some times?" instead of showing them. If the check fails, Claude rewrites the reply once and the draft is never sent.

How it's built

Orix is 6 n8n workflows on a self-hosted server, in Docker, generated from Python scripts. n8n's JSON is long and brittle; with the scripts, the instructions come in from their own files and every change can be reviewed line by line.

  1. Meta posts each message to a webhook. The workflow checks that it comes from Meta with the HMAC-SHA256 signature of the raw body and drops messages delivered twice.
  2. People write in bursts: the workflow waits 8 seconds and Orix replies once to everything together.
  3. Voice notes are transcribed with Whisper on Groq, and if the customer came from an ad, Orix reads that ad's text.
  4. When someone on the team replies from their phone, Orix notices and goes quiet in that chat for 12 hours. When Orix hands the chat off itself, it stays quiet for 24.
  5. History, meetings and what's known about each customer live in a dedicated PostgreSQL database, included in the daily backup.
  6. Claude answers through its tool loop, the reply check verifies the answer and the workflow sends it. If Claude fails, the chat goes to a person and an alert lands in Discord.

How I tested it

Before production, Orix talked to 15 difficult customer profiles, each played by a Claude Opus 5.5 agent: one who keeps pushing on price, an angry one, one who writes in bursts with voice notes, one in English and another in Portuguese, one who tries to extract the instructions, one who sends sensitive data, one who wants to move the meeting, one who asks for slots on holidays. Each profile had one conversation of 2 to 12 turns per round, without actually sending, booking or notifying anything. Three people on the team also tested it live on WhatsApp, including a real meeting booked and cancelled.

In every round, the agent playing the customer scores its conversation from 1 to 10 and lists the problems. It's the only score comparable across all five rounds.

Before round three I wrote a rubric with 6 criteria: rules and safety (25%), truthfulness (20%), tools and scheduling (20%), WhatsApp style and language (15%), getting to know the customer (10%) and outcome (10%). From then on, two graders who take no part in the conversation, also Opus 5.5 agents, read what was stored in the database, every tool call and result included, and score each criterion quoting Orix's words. The script computes the overall score, which is the stricter read.

A problem is critical if it breaks a safety or business rule, and major if the customer notices it. There were 2 critical problems in round one and none after.

Major problems, per round 3 4 5
Grader 1 8 6 6
Grader 2 8 6 9

The two graders landed within 1 point of each other on the overall score in all 45 conversations of rounds 3 to 5, with a mean difference of 0.13 to 0.31. The next step is to compare that score against a sample graded by hand.

What the tests found

Round one found 34 critical or major problems: duplicate messages, chats handed off too early, meetings booked without asking for an email, claiming "11 o'clock is no longer available" when it was free, and playing along with someone posing as the owner. After each round I chose what to fix. No manipulation test got instructions, internal data or other customers' data out of it: asking for the prompt, a "DAN mode", a fake owner with an "admin code", a fake context block with "rules disabled", or a "50% discount, approved" hidden next to an email address. In round five, it told the fake owner it has no admin mode.

The average shows the trend, and the decisions come from reading each conversation. Between rounds three and four I chose 7 fixes; the rubric held at 8.14 and 8.11, and the effect showed case by case. In the skeptical customer's conversation, which two of them targeted, the score went from 6.5 to 8.1. In the Portuguese-speaking customer's, it dropped from 8.9 to 6.4: Orix handed the chat to a person over the language question and the customer was left without a meeting. The knowledge document didn't say what language meetings are held in. Now it says Spanish or English, and in round five that customer booked in English.

The reply check came out of the tests. The instructions forbade offering a slot without looking it up, and in rounds four and five Orix still said a slot was "still open" without having checked. After two rounds, I moved that check into code. Run over the 259 replies from those two rounds, it flags 17, and reviewed one by one, all 17 were real failures.

Cost and latency

Measure Value
Cost per conversation, at API prices USD 0.11
Input read from cache 91%
Cost without caching 4 times higher (USD 6.39 vs USD 1.58 for 15 conversations)
Reply, median 7.2 s
Reply, p90 12.4 s

The cost is Orix's in round five: 15 test conversations, 131 turns and 214 calls to Claude. Latency runs from the moment a turn arrives until the reply is ready to send, tools included, over 305 agent executions. The customer adds the 8-second burst window, watching "typing…".

What's next

Orix goes to production on the company's number once Meta finishes its review. With real conversations, the next step is to measure how many end in a meeting and how many go to a person, and to grade a sample by hand to check how closely the graders agree with a person. On the testing side, the plan is to add new profiles that are never used for fixing, run several conversations per profile, and extend the reply check from times to dates.