Skip to content

AI agent on WhatsApp Business: what you pay for, what is free and what changes between the official and an unofficial API

Pedro Cunha
Pedro Cunha
CTO at Epicora

Published on
updated on · 18 min read

Epicora office: a team member smiles looking to the side, leaning on the desk, while a colleague works on a laptop beside her.
In short

Choosing between the official WhatsApp API and an unofficial library such as Baileys is not only about price: on the official API, Meta's rules shape the service, with a 24-hour window, approved message templates, one integration per number and per-message billing; on an unofficial one those rules disappear and what remains is the risk of the number being banned, because the use breaks WhatsApp's terms. The official API is not just the expensive option, since every number gets 1,000 free replies a month, and the unofficial one is not free. On the WhatsApp customer service platform we run, we operate both and choose client by client.

What changes between the official WhatsApp API and an unofficial one#

The official API is the WhatsApp Business Platform, which Meta offers to companies: the number is registered with Meta, messages reach the system through a webhook, and every send follows the rules and prices Meta publishes. An unofficial API is a library that imitates WhatsApp Web and joins the number as a linked device, with no contract with Meta.

One of the best known is Baileys, which is open source. The project itself states in its README that it is not affiliated with or authorized by WhatsApp, and it discourages bulk or automated messaging. Pairing is done with a QR code, as in WhatsApp Web, and the company's team keeps using the app on their phones.

For anyone putting AI into customer service, the difference is neither purely technical nor purely about price. On the official API, Meta's rules decide what the service can do: when the company can write, with what text, from which number and with which media. On an unofficial one those rules disappear, and in their place is the risk of the number being blocked. On the WhatsApp customer service platform we run for clients in Brazil, where WhatsApp is the default channel for a business, we operate both paths and pick one for each client.

Which Meta rules shape customer service on the official API#

Three Meta rules change how an AI customer service flow is designed on the official API: a number lives in one integration at a time, webhooks are subscribed per account and not per number, and outside the 24-hour window only an approved message template goes out. A fourth one is about format: a voice note only exists as OGG with Opus. Each of them became a design decision on the platform we run.

Timeline of the customer service window on the official WhatsApp API: a message from the person opens 24 hours in which the company replies with free-form text, such as the AI reply to the lead; outside the window, follow-ups and salesperson alerts only go out as approved message templates.
The person opens the 24-hour window, not the company
  1. One number, one integration. To use a number that already has WhatsApp on the API, Meta requires deleting the app account or onboarding through a partner that supports coexistence with the WhatsApp Business app. If the number is already on the official API with another vendor, the switch depends on where it is registered: when the WhatsApp account and the number sit in the company's own Meta Business portfolio, swapping the integration is enough; when they sit in the vendor's account, the usual way out is a new number.
  2. The webhook belongs to the account, not the number. The app subscribes to the webhooks of a WhatsApp Business account, and Meta delivers the messages of every number in it to every subscribed app. Had the number joined the account the previous vendor used, their system would have received our conversations and could have replied on top of them. The planned fix was a separate account, with only our app subscribed, at the cost of approving the templates again.
  3. Outside the window, templates only. The customer service window opens for 24 hours with each message from the person. The AI's reply to the lead happens inside it. What the rule hits is what the company starts: the follow-up to someone who stopped replying, and the alert telling a salesperson that a lead arrived, because that is the service number writing to the salesperson's number, and nobody opened that window. Both moved to approved templates, and the inbox swaps the text field for a template picker when the window closes. How this rule fits into planning any system's alerts is covered in the notifications map.
  4. Voice in OGG with Opus. Meta only treats an OGG file with the Opus codec, flagged as voice, as a voice note. Browsers record in another format, so the system converts audio recorded in the panel before sending it. Before that conversion, audio sent from the panel did not play on iPhones.

Why an approved message template can still be blocked#

Because approval says the text may be used, not that the message will be delivered. Meta assigns each template a category and limits how many marketing templates a person receives, from all businesses, over a period. When a message hits that limit, it comes back with error 131049, which Meta describes as a message not delivered to maintain healthy ecosystem engagement.

That is what happened to the new-lead alert on one of the numbers we run on the official API. On a single day in October 2026, Meta blocked the alert twice to both numbers of the client's team, with the template already approved. Hours earlier, while the template was still under review, the error was a different one, 131047, for a message outside the window. The alert was being billed as marketing, at about R$ 0.34 each (roughly US$ 0.06), and fell under the marketing limit.

The fix was not rewriting the template but using the 24-hour window. Each team member sends a "hi" to the service number, which opens their window, and replies to the alerts they get, which keeps it open. While it is open, the alert goes out as plain text. The agent recognizes the team's numbers and does not treat them as leads, and the team screen shows, person by person, whether alerts are arriving.

According to Meta's documentation, marketing messages sent while the window is open do not count toward the limit, and anyone who gets 131049 should wait at least 24 hours before resending.

Is the official API just the more expensive option?#

No. Since July 2025, Meta charges per delivered message, priced by category and by the recipient's country, and part of what an AI customer service flow sends costs nothing: each number gets 1,000 free customer service replies a month, and people who arrive from a Click to WhatsApp ad open a window of up to 7 days without charges. What weighs on the bill is the message the company starts.

Scaled bars showing what Meta charged per message on an official API number in October 2026: about R$ 0.34 for a template billed as marketing, about R$ 0.04 for an AI reply after the month's 1,000 free ones, and nothing for the first 1,000 replies or for a conversation from a Click to WhatsApp ad, for up to 7 days.
On the official API, what costs is the message the company starts

Pricing changed again on October 1, 2026. Free-form replies inside the window, which Meta calls service messages and which include those written by third-party AI, are charged again from the 1,001st of the month on each number. Utility templates sent inside the window are now charged as well. For Brazil, Meta uses 0.68 US cents per utility and authentication message as its reference.

On one of the numbers we run on the official API, the 1,000 free replies of October were used up by the 22nd, and each AI reply then cost about R$ 0.04 in Meta fees, under one US cent. A template billed as marketing cost about R$ 0.34. The Meta bill belongs to the client, paid with the card on the client's own account, and it is separate from the AI cost, which is per token and is covered in how much it costs to put AI to work inside a company system. Since July 2026, Meta also sells its own AI agent on WhatsApp, billed per token, which by Meta's own math comes to 4 or 5 US cents per message.

What the official API charges beyond money is design. Follow-up becomes a paid template, the team alert needs an open window, and every conversation the company starts requires the person to have opted in to receive messages, as WhatsApp's policy states.

Is an unofficial WhatsApp API free?#

It does not pay Meta, but it is not free. An unofficial API uses WhatsApp in a way its terms of service forbid: access through unauthorized automated means and automated or bulk messaging. The cost shows up when the number is blocked, and someone already using the service outside its terms has no ground to appeal on the basis of legitimate use.

WhatsApp's terms forbid bulk messaging, auto-messaging and auto-dialing, and they allow WhatsApp to disable or suspend the account. On the official API, Meta documents a gradual path: a warning, messaging restrictions of increasing length, an account lock and, in the end, being disabled, with an appeal that is usually answered in 24 to 48 hours. In our platform's scope, a ban on the unofficial path is treated as permanent and without appeal.

That is why clients who stay on the unofficial path get safeguards that exist only to protect the number:

  • a number dedicated to customer service, not the company's main line, with the new SIM card warmed up with real conversation before it gets traffic, and never a VoIP number;
  • replying only to people who wrote first, with no blasts, campaigns or broadcast lists;
  • one container per client, so that one number being blocked does not take down the others;
  • stopping when WhatsApp rejects the session, alerting the on-call person instead of trying to reconnect;
  • a risk acknowledgment, signed by the client before activation.

The stop safeguard came out of a rehearsal. With a dead session, the agent reloaded the same credential and hit WhatsApp every 5 seconds, endlessly, a behavior that leads to a ban and that no alert showed. Today it stops and reports. Sessions also drop on their own: on one of the numbers on the unofficial path, there were four drops on a single day in September.

Official or unofficial: the comparison, criterion by criterion#

The table compares the two paths on what changes for an AI customer service flow: the number, when the company can write, cost, risk and what arrives with each conversation. It combines Meta's documentation, WhatsApp's terms and what we see on the customer service platform we run on both transports.

CriterionOfficial API (WhatsApp Business Platform)Unofficial (Baileys and similar)
Numberregistered with Meta, in one integration at a time; a number that already has WhatsApp requires deleting the app account or onboarding through coexistencea SIM card with WhatsApp, paired by QR; we use a dedicated number, never VoIP, and warm up new SIM cards
When the company can writefree-form text only inside the 24-hour window the person opened; outside it, templates onlyanytime, technically; automated or bulk messaging is exactly what the terms forbid
Message templateapproved and categorized by Meta (marketing, utility, authentication); can be blocked with 131049does not exist
Costper delivered message: 1,000 free replies a month per number; we measured R$ 0.04 per reply after that and R$ 0.34 per marketing templateno Meta fee; cost of the SIM card, the phone and the session
Ban riskwarning, gradual restrictions and appealaccount disabled for breaking the terms, with no appeal
Media and voicevoice notes only in OGG with Opus; no view-once photoswhatever the library imitates from WhatsApp Web, undocumented and liable to change
Click to WhatsApp adsthe message carries the source ad (the referral) and opens up to 7 days without chargesthe ad source data does not come through a documented path
Several people answeringa panel with one login per agent; with coexistence, the WhatsApp Business app stays alongsidethe team stays on the phone app, and the AI joins as a linked device

Read row by row, the table shows a trade: the official API puts rules and prices where the unofficial one puts risk. When we reviewed our platform's scope, the contact's source field had no data behind it on the unofficial numbers, because the ad referral is a feature of the official API.

Does Meta's rule against AI chatbots affect a company's customer service?#

In the usual case, no. Since January 15, 2026, the platform terms prohibit AI Providers, such as companies offering a general-purpose assistant, when AI is the primary functionality being offered, "rather than incidental or ancillary". An agent that answers on behalf of a company about its own business is ancillary use. Under the terms, Meta decides how a case is classified.

Brazil has an exception for AI Providers themselves: Meta says it is legally required to let them use the platform there, and since March 11, 2026 it charges them for each service message delivered to Brazilian users. That charge is specific to those providers and does not change prices for other businesses.

For a company's customer service agent, the rule that matters is WhatsApp's messaging policy: with automation, the company must offer a prompt, clear path to reach a person. In the agents we run, asking for a person hands the conversation to the team. And in a personal finance assistant on WhatsApp that we are scoping, the scope says the assistant only talks about the family's finances and politely declines other topics, so it does not become a general-purpose assistant.

How we choose the transport for each client#

We choose based on what the service needs to do. If the company will start conversations, with follow-ups, alerts or reactivation, wants to know which ad brought each lead, or already has the number on an official integration, it goes on the official API. If the service only replies to people who write in and the team wants to stay on the phone app, the unofficial path fits, with a dedicated number and the risk signed off.

Decision flow: if the service needs to start conversations, know which ad brought the lead, or the number is already on an official integration, it goes on the official API; if it only replies to people who write in and the team stays on the phone app, the unofficial path can fit, with a dedicated number and the risk signed off by the client.
The transport follows from what the service needs to do

For the choice to be made per client, the transport became a swappable part of the system: the same agent, the same inbox and the same pipeline work on both paths, and only the layer that talks to WhatsApp changes. The official side was validated before any Meta account existed, with 270 agent tests running against a fake Meta API, covering inbound messages, sending, converted audio, templates and the team alert with a fallback. It is the same logic as any integration with a third-party system: the limits of whoever is on the other side become the limits of your product, as with the ERP that decides part of your system.

The accounts stay in the client's name: the Meta Business portfolio, the WhatsApp account, the number, the templates and the card that pays Meta. That is what let one client switch vendors without switching numbers.

Not every company needs a direct integration with Meta. At Helpe, a Brazilian marketplace for local services, the WhatsApp verification code we are adding goes out through an official Meta partner, billed per message, with automatic SMS if WhatsApp fails. And a project that needs to start conversations from day one is born on the official API, like the finance assistant we are scoping, which sends due-date reminders outside the window.

Frequently asked questions#

Is an unofficial WhatsApp API allowed?#

Not under WhatsApp's terms. They forbid accessing the service through unauthorized automated means and sending automated or bulk messages, and they allow WhatsApp to suspend or disable the account. Baileys, one of the best-known libraries, states that it is not affiliated with or authorized by WhatsApp. Whoever uses it takes the risk of losing the number.

Can I use the number I already have on the WhatsApp app with the official API?#

Yes, in two ways. The first is to delete the app account and register the number on the API, losing the phone's chat history. The second is to onboard through a Meta partner that supports coexistence, where the number stays on the WhatsApp Business app and on the API at the same time, with limits: groups are not synced, broadcast lists and view once are turned off, and throughput is fixed at 20 messages per second.

How much does the official WhatsApp API cost per message?#

Since July 2025, Meta charges per delivered message, priced by category and by the recipient's country. Every number gets 1,000 free customer service replies a month, and people who arrive from a Click to WhatsApp ad open up to 7 days without charges. On a Brazilian number we run, in October 2026, a reply after the free 1,000 cost about R$ 0.04 and a template billed as marketing about R$ 0.34.

Did Meta ban AI chatbots on WhatsApp?#

It banned AI Providers whose main product is the assistant itself, such as a general-purpose chatbot, from January 15, 2026. The rule applies when AI is the primary functionality, rather than incidental or ancillary. An agent that answers on behalf of a company about its own business is ancillary use. The messaging policy requires, when there is automation, a clear path to reach a person.

Why did WhatsApp block my already approved message template?#

Because approval clears the text, it does not guarantee delivery. Error 131049 appears when Meta holds a message back so the person is not overwhelmed, mainly through the limit on marketing templates each user receives from all businesses. Meta recommends waiting 24 hours before resending. For internal alerts, our fix is having each team member open the 24-hour window by sending a message.

Sources#

Next step#

If you are putting an AI agent on WhatsApp and need to settle the path before choosing a vendor, that is the work we do in AI and automation: the transport chosen by what the service needs to do, the accounts in your company's name, and Meta's rules built into the design from the start.

Next step

Want to look at this in your case?

Tell us in a few lines what you have today. We reply with the path that makes sense, even when the answer is not to build anything.

Share
Pedro Cunha
Who writes here
Pedro Cunha
CTO at Epicora

Pedro Cunha leads engineering at Epicora, in Chapecó, Brazil. He writes about the technical decisions behind the systems the team puts into production — architecture, scope, estimation and applied AI.

Articles by Pedro Cunha

Contact

Let's talk about your project

Tell us what you need to solve. We reply fast, with people who understand both technology and business.

Prefer to talk directly?

Pick the channel you prefer. We reply fast, during business hours.

From the first conversation to go-live: efficiency, security and innovation.