October 19, 2026

There is no Enter on WhatsApp

How to build turn-based conversations on WhatsApp

Everyone thinks talking to an AI is a conversation. It isn't. It's a sequence of turns.

In a chat app, the turn comes for free. You type, hit Enter, and the turn is over. The interface decides for you.

On WhatsApp, nobody hits Enter to say they're done. People write in pieces, the way they think.

"hi"
"so"
"wanted to know the price"

Three messages, one question. If you answer the first one, you answered the wrong question.

The challenge is building personal agents for WhatsApp. No chat screen. No send button that means "I'm done." The model turned out to be the easy part. What really took our time was figuring out when the person had finished talking.

I call this the open turn. The rest of the system exists to protect it.

The open turn

The model has no memory and no clock. Text goes in, text comes out. Something else has to know that the customer is still typing.

That something can't be the intake layer. Intake is dumb on purpose. It accepts the message, stores it and passes it on in order, one at a time per conversation. It decides nothing.

Dumb doesn't mean careless. Messaging providers can deliver the same event twice, and out of order. So intake drops what it has already seen, writes before processing and keeps order within each conversation. Different conversations run in parallel.

For the queue, use whatever you already run well. Human conversation is low volume.

The turn needs an owner. One component. Each new message opens a turn or extends the open one, and each extension bumps the conversation version.

Waiting is part of the product

The turn closes after a short silence. Sounds simple. The hard part is knowing how much silence.

Short, complete answers like "yes", "ok" or "3" can close quickly. A message that ends in "and", in "for" or in a comma deserves more patience. Everything else gets a default pause. On top of all that sits a ceiling, so nobody waits forever.

Our first version didn't wait at all. Every message got its own reply. The "hi" got one answer, the "so" got another, and by the time the real question arrived the agent had already said two useless things. Then came the API bill. We were paying for a model call on every fragment, three calls to answer one question. Honestly, that invoice taught us more about turn-taking than any benchmark. People take seconds between one fragment and the next, sometimes many, and a short pause lets the "hi" close the turn on its own.

While WhatsApp shows the person is typing, keep waiting, up to the ceiling. We're still tuning ours.

Every reply has an expiration date

Waiting isn't enough. However well you tune the pause, someone will send a message while the model is still generating.

So every reply carries the conversation version it was written for. Before sending, the turn owner compares that version with the current one. If the conversation moved on, the reply is stale. It gets discarded, and the new turn writes a new one.

One integer comparison kills three bugs at once: duplicate replies, replies to old questions and the agent talking over the customer.

One last detail. Sending a message can't be undone. If the process dies between sending and recording the send, you don't know whether the customer got it. So before sending, record the intent: "I'm going to send this." If something breaks, you're left with an honest state of unknown delivery, which you can reconcile. Better than a silent duplicate.

One reply, several messages

Notice how you reply on WhatsApp. Nobody sends a paragraph. You send a sentence, then another, then a question.

An agent that replies in a single block looks like an email pasted into the chat. You can read it. It just doesn't feel like there's someone on the other side.

The fix is in the shape of the reply. Instead of asking the model for free text, ask for structured output: a list of short messages. Picture a personal assistant that handles the household bills.

{
  "messages": [
    {
      "text": "Found the internet bill. It's due Friday."
    },
    {
      "text": "R$ 129.90, same as last month."
    },
    {
      "text": "Want me to get the payment ready for you to approve?"
    }
  ]
}

Three messages, one thought. The same pattern from the beginning, now on the agent's side.

Cap the list in the schema. One to three messages is more than enough. More than that becomes a flood. Each message also respects the channel's length limit. If the model still returns a long block, a deterministic split in code takes care of it, without breaking words or links.

Sending is the system's job. It marks the customer's message as read, shows "typing" while the model works and sends the parts in order, with a short pause between them.

This is where expiration matters again. The version check runs before each part. If the customer wrote something in the middle of the sequence, the reply is stale. The remaining parts never go out, and the new turn writes a new reply.

Each part also records its intent before going out. A reply in three messages is three irreversible sends. Each one needs its own trail.

If you're going to build this

Start with intake. Treat duplicate events as normal and drop them by the ID the provider gives each message. Write before processing. Guarantee order within a conversation and parallelism across conversations. The queue you already know will take you far.

Keep intake dumb. Every conversation rule you put there, you'll have to take out later. The intake layer shouldn't know what a turn is.

Give the turn a single owner. One component decides when it opens, when it extends and when it closes. Use a pause with a ceiling and start more patient than seems reasonable. We started impatient and paid for it.

Version the conversation. A counter that goes up with every customer message, stored with every reply and checked before every send. Without it, every race between the customer and the model ends up as a wrong reply on someone's screen.

Ask the model for a short list of messages and send them one at a time, checking the version before each send. If the customer wrote in the middle, the rest stays unsent.

Record the intent before each send. There will be failures. The question is whether they leave a trail you can reconcile, or a confused customer looking at the same message twice.

Listening is knowing when to stop listening

We spent months choosing models, comparing benchmarks, tweaking prompts, as if an agent's quality were in what it says. I thought so too. Most of it is in when it says it.

A human agent doesn't answer "hi" with a paragraph. They wait. They notice more is coming. They reply when the person is done.

No model does this on its own. This is queue and clock engineering.

Get the timing right and the model starts to look smart.

A good agent waits for you to finish.

Source: https://santosant.substack.com/p/there-is-no-enter-on-whatsapp