Updated on November 4, 2026
To run an A/B test on WhatsApp, you get two templates approved that differ in exactly one thing, split your list at random into two equal groups, send both versions at the same time and compare a metric you chose before sending. Meta does not offer an “A/B test” button that splits the audience for you: the split happens in your own system. What Meta does offer is measurement: template analytics (sent, delivered, read, clicks and cost) and a comparison API that shows which of two templates was blocked more often.
Below is the full method, with sample size math, code to split your list and the precautions that keep the losing version from dragging down your number’s quality.
What Meta offers (and what it doesn’t)
The official WhatsApp API documentation includes three features that help with testing, but none of them splits the audience:
| Feature | What it measures | Documented limits |
|---|---|---|
Template analytics (/template_analytics) | Sent, delivered, read, URL and quick-reply button clicks, amount spent, cost per delivered and per click | Daily granularity only; lookback of up to 90 days; reads and clicks counted only up to 7 days after sending; up to 10 templates per query |
Template comparison (/{template_id}/compare) | Sends, templates ordered by block rate (blocks ÷ sends; the API does not return the percentage) and top block reason | Two templates at a time, same account, at least 1,000 sends each in the period; 7, 30, 60 or 90-day windows |
| Marketing Messages API | Performance benchmarks against similar businesses and automatic optimizations (some still in testing) | Features vary by country; not a replacement for your own controlled test |
Template analytics must be enabled on the account (is_enabled_for_insights=true) and, according to the analytics documentation, cannot be disabled afterwards. Enabling it also turns on link click tracking.
The comparison API is the most useful guardrail metric: it tells you which version caused more blocks and why (reasons such as SPAM, NO_SIGN_UP, OFFENSIVE_MESSAGES, OTHER and UNKNOWN_BLOCK_REASON).
Step 1: one hypothesis, one variable
An A/B test only teaches you something if the two versions differ in one element. If you change the copy, the image and the button at once, you won’t know what caused the difference.
Good variables to test in marketing templates:
- Opening line. Customer’s name first vs. benefit first.
- Length. Short copy vs. copy with more context.
- Header. Image vs. video vs. text only.
- Button. “See offer” vs. “Get my discount”; URL button vs. quick-reply button.
- Offer. Free shipping vs. a fixed-value coupon (a commercial difference, not a copy one).
Write the hypothesis down first: “Opening with the benefit increases button click rate compared with opening with the name.” For structure and CTA ideas, see how to write WhatsApp marketing messages.
Want to try it while you read? Create a Vectalk account and send your first message through the official API. Create free account →
Step 2: two approved templates in the same category
Each version is a separate template with its own name (offer_nov_a and offer_nov_b), same language and same category. Submit both for approval at the same time and only start when both are APPROVED.
Watch out for:
- Same category. If Meta classifies one version as marketing and the other as utility, cost and delivery rules change and the test is meaningless. Learn how Meta categorizes templates.
- New templates are paced. New templates, unpaused templates and templates without a
GREENrating may have part of their sends held (held_for_quality_assessment) until Meta evaluates feedback, according to the template pacing documentation. Since both versions are new, the same rule applies to both; just don’t read a delivery delay as a result. - Same parameters. Variables, media and destination link should be equivalent, except for the variable under test.
Step 3: calculate the sample size
With a small sample, the difference between A and B may be pure chance. To compare two rates (clicks ÷ delivered, for example), a common approximation for 95% confidence and 80% statistical power is:
n per group ≈ 7.84 × [p1(1 − p1) + p2(1 − p2)] ÷ (p2 − p1)²
Hypothetical example: if your click rate is usually 10% and you want to detect an improvement to 13%, the math gives about 1,770 delivered messages per group. To detect a move from 10% to 11%, it goes past 14,000 per group. Rule of thumb: the smaller the difference you want to see, the bigger the sample.
Two external limits also apply:
- Portfolio messaging limit. The whole test (A + B) must fit within your limit of unique recipients per 24 hours. See WhatsApp API messaging limits.
- Comparison API. It only returns data when each template has at least 1,000 sends in the period.
Step 4: split the list at random
The split must be random and stable: the same contact always lands in the same group, and no segment (city, recency, order value) is concentrated on one side. Hashing the wa_id with the test name does the job:
import crypto from 'node:crypto';
// Returns 'A' or 'B', stable for each contact and test
export function group(waId, test) {
const h = crypto.createHash('sha256').update(`${test}:${waId}`).digest();
return h[0] % 2 === 0 ? 'A' : 'B';
}
const TEMPLATES = { A: 'offer_nov_a', B: 'offer_nov_b' };
export function buildSend(contact, test) {
const g = group(contact.wa_id, test);
return {
group: g,
payload: {
messaging_product: 'whatsapp',
to: contact.wa_id,
type: 'template',
template: {
name: TEMPLATES[g],
language: { code: 'en_US' },
components: [
{ type: 'body', parameters: [{ type: 'text', text: contact.name }] },
],
},
},
};
}
Store the group and the wamid of every send. That is what lets you join webhook statuses and conversions in your system with the version each person received.
If you also want to measure the effect of the campaign itself, set aside a control group that receives nothing (say, 10% of the list). It shows how much people bought without a message.
Step 5: send at the same time
Interleave A and B in the same time slot. Sending A at 10 a.m. and B at 6 p.m. mixes the effect of the copy with the effect of send time. The rate-controlled sending example in the bulk messaging guide works here: just build the queue already shuffled.
Step 6: decision metric and guardrail metrics
Decide before sending which metric picks the winner. Choosing afterwards, based on what favors your preferred version, invalidates the test.
| Type | Metric | Source |
|---|---|---|
| Decision | Click rate (clicks ÷ delivered) or conversion in your system | Template analytics or a UTM per version |
| Guardrail | Block rate and reason | Template comparison API |
| Guardrail | Contacts who stopped receiving marketing (user_preferences webhook and 131050 errors) | Webhooks |
| Guardrail | Template quality (GREEN, YELLOW, RED) | WhatsApp Manager and template webhooks |
| Context | 131049 failures (per-user limit) | Status webhook |
To measure sales and not just clicks, use a different UTM parameter in each version (utm_content=a and utm_content=b), as shown in the article on UTM tracking in template buttons. Remember that template analytics only counts reads and clicks up to 7 days after sending: decide within that window or save the numbers first.
To check whether the difference is real, a two-proportion z-test is enough:
from math import sqrt
from statistics import NormalDist
def z_test(clicks_a, delivered_a, clicks_b, delivered_b):
pa, pb = clicks_a / delivered_a, clicks_b / delivered_b
p = (clicks_a + clicks_b) / (delivered_a + delivered_b)
se = sqrt(p * (1 - p) * (1 / delivered_a + 1 / delivered_b))
z = (pb - pa) / se
p_value = 2 * (1 - NormalDist().cdf(abs(z)))
return pa, pb, p_value
print(z_test(180, 1800, 232, 1790)) # p_value < 0.05: unlikely to be chance
How to test without hurting quality
Template quality is based on negative feedback and read rate. A template that reaches the lowest rating is paused for 3 hours the first time, 6 hours the second time and disabled the third time (template pausing). A poorly designed test can burn version B and hurt your portfolio’s reputation. To avoid that:
- Test only with contacts who gave marketing opt-in and were active recently.
- Start small. Send an initial batch and check quality and blocks before releasing the rest.
- Stop the version that gets worse. If B turns
YELLOWorRED, stop B and continue only with A. Don’t wait for the end of the test. - Don’t resend to contacts who failed with
131049. The per-user marketing limit requires at least 24 hours before trying again. - Respect frequency. The test counts as a campaign for the contact; don’t stack it on another send the same day.
How to do it with Vectalk
Vectalk gives you access to Meta’s Cloud API with the same template payload, so the code above works by sending to POST https://apis.vectalk.com.br/api/messages with the instance token. Both templates can be created in the dashboard or through the API (/api/templates), and status webhooks arrive in Meta’s format so you can record deliveries, reads and failures per group. Vectalk also has endpoints to enable insights and sync Meta analytics per instance, described in the documentation.
Vectalk has no campaign or A/B testing tool in its dashboard: list splitting, scheduling and analysis live in your system or in the automation tool connected to the API. To get started, create your account.
Frequently asked questions
Does WhatsApp have native A/B testing?
Meta’s documentation has no feature that splits an audience between two templates. It has measurement: template analytics, the template comparison API (block rate) and, in the Marketing Messages API, performance benchmarks. You handle the split.
Can I test by editing the same template?
Not recommended. Editing keeps the same template ID, so the numbers from both versions get mixed together in the metrics. Use two templates with different names. See how to create and edit templates via the API.
How many contacts do I need for an A/B test?
It depends on your current rate and the difference you want to detect. To go from 10% to 13% click rate, the formula gives about 1,770 delivered messages per group. Smaller differences require much larger lists.
How long should the test run?
Template analytics counts reads and clicks for up to 7 days after sending. Set the analysis window beforehand and use the same one for both versions.
Does testing cost more?
No: each marketing template delivered to Brazil costs BRL 0.3217 (Brazilian reais), whether it is A or B. You pay for the total send. Estimate it with the pricing calculator and see also template analytics.
Official sources checked on November 4, 2026: Template analytics, Template comparison, Template pacing, Template pausing, Template quality, Per-user marketing limits, Marketing Messages API, Pricing, Vectalk: Template, Vectalk: Analytics.
Put your business on the official WhatsApp
Create your account, connect your number to the official API (you can keep the app with coexistence) and start serving customers and sending messages.
