Latency and message bursts in WhatsApp agents

How to handle model delay and customers who send several messages in a row: typing indicator, merging bursts and a latency budget.

An AI agent answers in seconds, not milliseconds, and WhatsApp customers are used to talking to people. Two experience problems appear early: the silence while the model works, and the customer who writes a sentence in three messages and gets three mismatched replies. Both have a known fix.

Where is an agent’s response time spent?

In four places: receiving and queueing, preparing context, the model call and sending. The model call usually dominates, and grows with input size and the number of tool turns. The rest is small and predictable.

  • Input: a smaller history and prompt cut time and cost. Prompt caching also helps, as described in the cost article in this series.
  • Tools: each tool turn is another model call. A lookup that could be done beforehand and delivered in context saves a turn.
  • Output: short replies finish sooner. Cap with max_tokens and ask for lean text.
  • Model: a smaller model answers faster, and the swap should go through your evaluation set.
  • Audio transcription: adds speech recognition time to the reply time.

I do not give average times here because they depend on the model, region and provider load. Measure in your environment, logging the time of each stage, and set a budget: for example, how long between the customer’s message and the sent reply you consider acceptable. The architecture article in this series shows where these measurements fit.

How do you show the customer the agent is working?

With Meta’s typing indicator, which marks the message as read and shows that the business is typing. According to the documentation, it is dismissed when you respond or after 25 seconds, whichever comes first, and should only be used when you will actually respond.

// Typing indicator (Meta API): marks as read and shows "typing…" POST https://graph.facebook.com/<VERSION>/<PHONE_NUMBER_ID>/messages Authorization: Bearer <TOKEN> { "messaging_product": "whatsapp", "status": "read", "message_id": "<wamid of the incoming message>", "typing_indicator": { "type": "text" } }

The request uses the incoming message id, the same the webhook delivers, and setting status to read does both things in one request. The documentation recommends using it when you received a message and will take a few seconds to respond, and warns against showing it with no intention of replying, to avoid a poor experience.

CRPRO Hub has no route to send the typing indicator: sending accepts only the documented message types. If your integration sends directly through Meta’s API, the format is the one above.

Without the indicator, the alternative is a short acknowledgment message, such as checking now, for replies that will clearly take more than a few seconds. Use it sparingly: every message sent counts against the allowance and the per-contact limit.

What do you do when the customer sends several messages in a row?

Wait a short interval to merge the messages and reply once, instead of replying to each. People typing on a phone often break a thought into two or three messages, and an agent that answers each produces partial, repeated or contradictory replies.

// In the webhook (fast): records the message and schedules ONE reply job per conversation async function aoReceber(evento) { const chave = evento.channel_id + ':' + evento.data.from await pendentes.adicionar(chave, { id: evento.data.message_id, texto: evento.data.text }) // Delayed job: if another message arrives first, the delay restarts await fila.agendar('responder', { chave }, { emMs: 4000, substituirPorChave: chave }) } // In the worker: runs only once the customer stopped writing async function responder({ chave }) { const lote = await pendentes.retirar(chave) // all unanswered messages if (lote.length === 0) return const entrada = lote.map((m) => m.texto).join('\n') const texto = await agente.gerar(chave, entrada) // The idempotency key uses the LAST message of the batch await enviar(chave, texto, 'ia-' + lote[lote.length - 1].id) }

The design has three points. The webhook only records the message and schedules, staying inside the 10-second deadline. The scheduled job replaces the previous one for the same conversation, so the delay restarts with each new message. And the worker takes the whole batch of unanswered messages and generates a single reply, with the idempotency key derived from the batch’s last message.

The delay value is a balance: too short, and the agent replies before the customer finishes; too long, and it adds to the latency of every reply. Four seconds is an example starting point, not a validated value. Tune it by looking at real conversations.

  • Durable state: store pending messages in a database, not in memory, so they survive a restart.
  • Order: merge messages in arrival order, and mind order by event timestamp.
  • Media in the batch: if one message is audio, transcribe before merging.
  • New message during generation: if something arrives while the model works, decide whether to discard the reply in progress and redo it with the full batch, or send it and handle the new message afterwards.

How do you measure end-to-end latency?

By recording a timestamp at each stage and computing the differences, per reply. Only per-stage measurement shows whether the bottleneck is the queue, the model or the send, and whether a change really helped.

// Timestamps per stage, per reply const t = { recebido: Date.now() } // in the webhook // ... after building the context: t.contexto = Date.now() // ... after the model replies: t.modelo = Date.now() // ... after the send API accepts (202): t.enviado = Date.now() metricas.gravar({ queue: t.contexto - t.recebido, model: t.modelo - t.contexto, send: t.enviado - t.modelo, total: t.enviado - t.recebido, })
  • Look at percentiles, not just the average: the customer who waits 40 seconds matters more than the average suggests.
  • Separate conversations with tools from those without, because behavior differs.
  • Compare before and after each change, with the same evaluation set, so you do not confuse provider load with improvement.
  • Alert when time exceeds the budget, so you know before the customer does.

The event’s occurred_at field marks when the message happened, and the send time is your timestamp in the worker; the difference between the two is what the customer perceives, plus WhatsApp delivery time, which you do not control.

Which platform limits matter for reply cadence?

The main one is the per-pair limit: according to the error reference used in Hub, about one message every 6 seconds to the same contact, with a short burst of up to 45. Going over it returns error 131056. An agent that answers in several short messages in a row is close to hitting it.

LimitValueEffect on the agent
Webhook deadline in Hub10 secondsModel outside the webhook
Typing indicatorUp to 25 secondsDoes not cover long replies; use only if you will reply
Messages to the same contactAbout 1 every 6 s (131056)Prefer one complete reply to several short ones
Sends per channel in Hub60 per minutePeaks of simultaneous conversations need a queue

The practical rule: one well-written reply in one message is better for the experience, for the limit and for the service message allowance. See also the webhooks reference and the quickstart.

Frequently asked questions

Does the typing indicator disappear on its own?

Yes. According to Meta’s documentation, it is dismissed when you respond or after 25 seconds, whichever comes first.

How long should I wait to merge messages?

There is no universal value. Start with a few seconds, measure on real conversations and adjust: too short cuts the customer off, too long adds latency.

Can I send a notice that I am checking?

You can, but every message counts against the allowance and the per-contact limit. Use it only when the reply will really take a while.

How do I reduce model time?

With smaller input, caching of the fixed prefix, fewer tool turns, short output and, if evaluation confirms it, a smaller model.

Fontes

Documentação oficial da Meta, conferida em 31 de outubro de 2026.