
WhatsApp 24 Hour Customer Service Window: How an AI Agent Should Act
How the WhatsApp 24 hour customer service window works, what an AI agent can send inside and outside it, and when to use an approved template.
Want to apply this in your company?
Book a call with Juan →WhatsApp 24 Hour Customer Service Window: How an AI Agent Should Act
The WhatsApp 24 hour customer service window is the period in which a business can reply to a customer with free-form messages, counted from the last message the customer sent. When it closes, the business can only start contact with an approved template, and the window reopens when the customer writes again. For an AI agent, this changes behavior: before every reply it needs to know whether the window is open and which type of message is allowed at that moment.
Key takeaways
- The window opens when the customer sends a message and is renewed with each new customer message. Messages from the business do not renew it.
- With the window open, the agent can send free-form messages. With it closed, only templates approved by Meta.
- Window control belongs in the system as a deterministic rule, not in the model prompt.
- A template is not a shortcut around the window: it has a category, needs approval and, in many cases, requires the customer's prior permission.
- Outside the window, the best decision is often to log the case, hand it to a person and wait for the customer to return.
How does the customer service window work according to the documentation?
Meta's Cloud API documentation describes the model like this: when a customer sends a message to the business number, a customer service window opens. Inside it, the business can send any supported message type, such as text, image, document or interactive message, without a template. The window lasts 24 hours, counted from the last message received from the customer.
Two details matter for anyone building the agent. First, the clock depends on the customer's message, not yours. If the business replies many times, the window still expires at the same moment. Second, when the customer writes again, the window is renewed in full.
Outside the window, the business can only start a conversation with a template message, which must have been created and approved beforehand. If the system tries to send free text while the window is closed, the API refuses the send and returns an error. That error is not a technical failure to be retried. It is a channel rule being enforced.
One caveat. There are specific rules for conversations that start from ads leading to WhatsApp, and template categories and billing models change over time. Treat this text as an explanation of the mechanism and check the details in Meta's official Cloud API documentation on sending messages before configuring your operation. Also remember that this window applies to the platform API, not to manual use of the app on a phone.
What can the agent do while the window is open?
With the window open, the agent has freedom of format, but not freedom of scope. The conversation stays limited by what was defined for the flow: which questions it answers, which data it queries, which actions it runs and when it hands off to a person.
Inside the window, the expected behavior is this:
- Answer questions within scope, based on sources the company controls.
- Ask for missing information one question at a time, instead of dumping a form.
- Send interactive messages, such as reply buttons, when that reduces misreading.
- Run permitted actions, such as checking order status or proposing time slots, with a record of each step.
- Hand off to a person when the topic leaves the scope, when there is a serious complaint or when the customer asks.
One point that is often overlooked: the team member who takes over the conversation is subject to the same window. A handoff to a human does not grant extra time. If the agent on the team is slow to pick up the case and the window expires, that person is also limited to templates. So at handoff the agent should record the time the window closes, so the team can prioritize cases close to expiring.
If you are designing the flow end to end, the guide to an n8n WhatsApp Cloud API workflow shows how to organize receiving, deciding and sending as separate steps.
What changes when the window closes?
When the window closes, the agent loses the ability to write freely. What it can still do is limited, and it helps to decide it in advance:
- Send nothing and log the pending topic.
- Send an approved template, if a suitable one exists and the company has permission to contact that customer.
- Route the case to a person, who decides whether a new contact by template or through another channel is worthwhile.
The most common design mistake is letting the language model try to solve this on its own. It cannot know from the conversation text alone whether the deadline has passed. And if it discovers the block through the API error, it may rephrase the message and try again, which creates noise, useless logs and, at volume, risk to the number's reputation. The article on a banned WhatsApp number covers that risk in more detail.
The other concern is about the product. Many people expect the AI to pick up yesterday's conversation as if nothing happened. With the window closed, the customer may have left WhatsApp, changed their mind or settled the matter by phone. Reopening with a template should be a decision with a clear reason, not an automatic reflex. To think through what to answer right away and what to defer, see after-hours customer service with AI.
When should you use a template, and who should write the text?
A template is a message whose text, category and variables are defined in advance and submitted to Meta for approval. Meta's template documentation explains how each component is built and sent. In practice, the agent does not write the template: it picks one of the approved ones and fills in the variables.
This has a useful consequence for control. The text that goes out when the window is closed is reviewed by a person at the company before approval, and the model only chooses among closed options and supplies values such as a name, a ticket number or a date. A simple list helps decide:
- The customer wrote recently and the window is open: use a free-form message, not a template.
- The window closed and the topic directly continues a request from the customer, such as a status update or confirmation: consider a utility template.
- The window closed and the goal is an offer, campaign or reactivation: this is a marketing message, requires specific permission and goes through human review.
- The window closed and there is no suitable template: do not improvise. Log it and hand it off.
- The customer asked not to be contacted again: no template, of any category.
The template category affects approval and usage rules, and Meta may reclassify what the company declared. So avoid describing a promotion as a utility message. Reading templates, opt-in and best practices for outbound messages together helps you design this part without relying on interpretation.
On privacy law (LGPD), remember that the phone number and the conversation history are personal data. Outbound contact by template needs a clear legal basis and purpose, and the customer must be able to refuse. The ANPD, Brazil's data protection authority, is the official reference for guidance. If you are unsure about the legal basis for a specific flow, the decision is a legal one, not for the technology team.
How should the system control the window, rather than the prompt?
Window control should live in code, in a step that runs before any send. The principle is the same as for well-built agents in general, as Anthropic discusses in its Building effective agents guide: put predictable rules in a deterministic flow and reserve the model for what needs judgment.
A simple design is usually enough:
- When each customer message arrives through the webhook, store the receipt time reported by the platform, in a standard format.
- Calculate the end of the window by adding the 24 hour period to the time of the last message received from the customer.
- Before sending, compare the current time with the end of the window and choose among three paths: free-form message, template or handoff.
- Give that decision to the agent as part of its context, for example with a field showing the window as open or closed, so it does not attempt something impossible.
- Block any free-text send in code when the window is closed, even if the model asks for it.
- Log each decision, with time, chosen path and reason, for audit and improvement.
There is also the case of long conversations, where the agent's reply is delayed by an external lookup or a queue. If the window is close to expiring, the system can prioritize a short closing message or a question that invites the customer to answer, which renews the window. This should be an explicit rule, not model improvisation.
Finally, handle server time carefully. Time zone differences and queue delays cause small errors that turn into failures in edge cases. A safety margin before the theoretical end of the window avoids sends that fail by seconds.
Illustrative scenario: a question about delivery time
This is an illustrative scenario, not a real customer. An online store uses an agent on WhatsApp. Late in the afternoon, a customer asks when their order will arrive. The agent checks the order system and sees that the carrier has not yet updated tracking. It replies with what it knows and says the team will confirm the delivery date.
The case is handed to logistics, with the window end time recorded alongside. The next morning, logistics has the information, but the window has already closed because the customer did not write again.
The system offers the person two options: send a utility template for an order update, with the order number and new delivery date as variables, or wait for the customer to come back. Because the customer had asked the question and the topic directly continues it, the team approves sending the template. The agent does not write the text: it fills in the variables and the system records the send.
If the customer replies, the window opens again and the agent resumes the conversation, with the earlier history at hand. If not, the case is resolved with the information delivered, without chasing.
How do you apply this in a real operation?
In our method, the work follows four moves: map, limit, pilot and hand over. Applied to the customer service window, it looks like this.
Map: find out how many conversations end with a pending item after first contact, which topics require a later follow-up and who at the company is responsible for each. Without that picture, you cannot tell which templates you need.
Limit: define a short set of approved templates, each with a purpose, category and condition of use. Also limit what the agent can do outside the window, which in most cases is to log and hand off.
Pilot: run a real flow with logs of every window decision and a success criterion agreed beforehand, for example the share of pending items resolved without rework. Test the edge cases in a simulated environment, as the article on mock tools and sandbox testing for agents shows, before exposing customers.
Hand over: give the team the documented window rule, the templates and a dashboard of cases close to expiring, and decide from the records whether the pilot expands, is adjusted or stops.
The parts of the design that deserve periodic review are the same ones: templates nobody uses, cases where the window expired before the handoff was picked up, and outbound messages with no clear reason.
Frequently asked questions
Is the 24 hour window renewed when the business replies? No. The window depends on the last message sent by the customer. Replies from the business, including those from the AI agent, do not extend the deadline. Only a new customer message restarts the count.
Can the AI agent send free text after the window closes? Not through the official API. With the window closed, the platform only accepts approved template messages, and a free-text send returns an error. The safest approach is to block it in code and not rely on the model recognizing the situation.
Can any template be sent to any customer? No. Each template has a category and its own rules, and marketing messages require specific permission from the customer. The contact also needs a clear legal basis and purpose under LGPD. See how to collect permission in WhatsApp opt-in for outbound messages.
Does handing off to a human agent give more time? No. The window is a channel rule and applies to whoever is replying, whether an AI agent or a person. That is why the handoff should carry the expiry time, so the team can prioritize cases close to closing and choose a template when needed.