Meta is ending marketing templates on the Cloud API in two steps. Messaging accounts created on or after April 13, 2027 can’t send marketing through /messages, and from October 13, 2027 no account can. Your code has to send each template to the endpoint that matches its latest category: MARKETING to /marketing_messages, everything else to /messages.
Meta’s overview states the end date directly. “Cloud API will stop supporting marketing messages on October 13, 2027,” and “After this date, sending marketing messages on Cloud API will produce an error” (Meta MM API overview, accessed 2026-11-24). The rest of your traffic stays where it is: “Service, authentication, and utility messages will continue to be supported on the Cloud API.”
What the Marketing Messages API adds, who can onboard and the basic endpoint switch are in the Marketing Messages API for WhatsApp. This page covers the routing code, the category changes that break it, and the questions Meta hasn’t answered yet.
The dates on the way to the sunset
| Date | Event | Source |
|---|---|---|
| November 19, 2025 | Marketing Messages API reaches general availability | MM API overview |
| April 6, 2026 | Businesses can disable marketing on Cloud API themselves (error 131063) | MM API changelog |
| September 24, 2026 | Routing guidance published | MM API changelog |
| October 13, 2026 | Global announcement of the sunset | MM API overview |
| April 13, 2027 | Messaging accounts created on or after this date can’t send marketing via Cloud API | MM API overview |
| October 13, 2027 | Cloud API stops supporting marketing messages | MM API overview |
Sources: Meta MM API overview and Meta MM API changelog, both accessed 2026-11-24.
The April date follows the account’s creation date, not the send date. Meta’s sentence reads: “Any new Messaging account created on or after this date will not be able to send marketing messages via Cloud API.” Accounts created before April 13, 2027 keep Cloud API marketing until October 13, 2027.
If you onboard clients, every WABA you create for a client from April 13 needs the new endpoint for its first marketing send. Older clients on the same codebase can still work the old way for six more months, so your router has to handle both at once.
What stays on the Cloud API
Only marketing templates move. Utility templates, authentication templates and service messages inside the customer service window keep going to POST /<PHONE_NUMBER_ID>/messages. Template management stays on the WABA, through /<WABA_ID>/message_templates.
The Marketing Messages API is send-only, and the number must already be registered on Cloud API. Incoming messages and status webhooks keep arriving through your existing Cloud API webhook subscription. Keep the Cloud API integration, add a second send path next to it, and decide per template which one to call.
The request body doesn’t change either. Meta’s send page shows the same template payload on POST /<PHONE_NUMBER_ID>/marketing_messages, with two optional extra fields, product_policy and message_activity_sharing (Meta send marketing messages, accessed 2026-11-24). The response has the same shape, with the message ID in messages[0].id.
Route each send by the template’s latest category
Meta’s routing page gives the rule: “Use the latest category to select the send endpoint” (Meta route template messages, accessed 2026-11-24). A template approved as utility can become marketing after approval, and the status stays APPROVED, so nothing in the send call tells you it moved.
The page describes a mapping you keep yourself:
- Store the Messaging account ID, template ID, template name, language and latest category.
- Add each new template once its category is known.
- Subscribe to
template_category_updateand update the mapping only on the completed notification, usingnew_category. - Look up by Messaging account ID, template name and language before each send. With no entry, fetch the category first.
- Handle changes that land while a send is in flight, using the error codes below.
The page says to retry only after a confirmed failure and to make retries idempotent. It has no code samples.
Read the two category notifications correctly
template_category_update fires twice for a change Meta announces in advance (template_category_update reference, accessed 2026-11-24). The first is a notice. It carries correct_category, the category the template will move to, and category_update_timestamp. In that notice, new_category still holds the current category, which trips up handlers that read it as the new value.
The routing page is explicit: “Treat an impending notification as monitoring information; do not route on correct_category.” The second notification carries previous_category and new_category, and it’s the one you route on. This is Meta’s completed sample:
{
"entry": [
{
"id": "102290129340398",
"time": 1746169200,
"changes": [
{
"field": "template_category_update",
"value": {
"message_template_id": 278077987957091,
"message_template_name": "welcome_template",
"message_template_language": "en-US",
"previous_category": "UTILITY",
"new_category": "MARKETING"
}
}
]
}
],
"object": "whatsapp_business_account"
}
Meta’s pages disagree on timing. The webhook reference puts the change 24 hours after the notice. The categorization page covers a GET where category and correct_category differ. There, the category “will be updated on the first day of the next month” (Meta template categorization, accessed 2026-11-24). Don’t schedule a routing change from either. Wait for the completed notification.
One restriction can flip every utility template at once
Normal recategorization moves one template with a day’s notice. After a misuse warning, Meta’s categorization page says “The category will be updated with no advance notice”. Under a utility restriction, “All approved utility templates on the Messaging account are recategorized to MARKETING,” for “7 days (30 days for repeat violations).”
A router with a stale cache then sends a whole catalog of marketing templates to /messages. Before the sunset, those sends either go out as Cloud API marketing or fail with 131063 if you turned Cloud API marketing off. After October 13, 2027, they fail. When the restriction ends, refresh the mapping from the API rather than assuming the templates are utility again. The misuse ladder itself is in template categories.
A router that survives a category change
The script below keeps the mapping in SQLite and updates it from completed notifications. Each send goes to the endpoint the template’s category points at. When Meta confirms the endpoint was wrong for the category, it refreshes the mapping and retries once on the other endpoint.
# mm_router.py. Python 3.9+, standard library only. State is kept in templates.db.
# Env: ACCESS_TOKEN, WABA_ID, PHONE_NUMBER_ID
# python3 mm_router.py refresh
# python3 mm_router.py webhook payload.json
# python3 mm_router.py send RECIPIENT_PHONE TEMPLATE_NAME LANGUAGE_CODE
import json
import os
import sqlite3
import sys
import urllib.error
import urllib.parse
import urllib.request
GRAPH = "https://graph.facebook.com/v26.0"
# Codes that confirm the endpoint rejected the template's category (Meta error codes page).
WRONG_ENDPOINT = {
"/messages": {131063}, # marketing template while Cloud API marketing is off
"/marketing_messages": {131055, 134100}, # this endpoint takes marketing templates only
}
db = sqlite3.connect("templates.db")
db.execute("""CREATE TABLE IF NOT EXISTS template_category (
waba_id TEXT NOT NULL, name TEXT NOT NULL, language TEXT NOT NULL,
template_id TEXT, category TEXT NOT NULL,
PRIMARY KEY (waba_id, name, language))""")
def norm(language):
# Meta's webhook sample writes en-US. Normalize so en-US and en_US match.
return language.replace("-", "_").lower()
def graph(method, url, body=None):
if not url.startswith("https://"):
url = GRAPH + url
data = json.dumps(body).encode() if body is not None else None
req = urllib.request.Request(url, data=data, method=method, headers={
"Authorization": "Bearer " + os.environ["ACCESS_TOKEN"],
"Content-Type": "application/json",
})
try:
with urllib.request.urlopen(req, timeout=30) as resp:
return resp.status, json.load(resp)
except urllib.error.HTTPError as err:
return err.code, json.load(err)
def save(waba_id, name, language, template_id, category):
db.execute("""INSERT INTO template_category VALUES (?, ?, ?, ?, ?)
ON CONFLICT(waba_id, name, language) DO UPDATE SET
template_id = excluded.template_id, category = excluded.category""",
(waba_id, name, norm(language), str(template_id), category.upper()))
db.commit()
def refresh(waba_id):
url = f"/{waba_id}/message_templates?" + urllib.parse.urlencode(
{"fields": "id,name,language,category", "limit": 100})
while url:
status, page = graph("GET", url)
if status != 200:
raise RuntimeError(json.dumps(page))
for t in page.get("data", []):
save(waba_id, t["name"], t["language"], t["id"], t["category"])
url = page.get("paging", {}).get("next")
def lookup(waba_id, name, language):
row = db.execute("SELECT category FROM template_category "
"WHERE waba_id = ? AND name = ? AND language = ?",
(waba_id, name, norm(language))).fetchone()
return row[0] if row else None
def handle_webhook(payload):
for entry in payload.get("entry", []):
waba_id = entry.get("id")
for change in entry.get("changes", []):
value = change.get("value", {})
if change.get("field") == "template_category_update":
key = f"{value.get('message_template_name')}/{value.get('message_template_language')}"
if "correct_category" in value:
print(f"notice only: {key} {value['new_category']} -> {value['correct_category']}")
elif "previous_category" in value:
save(waba_id, value["message_template_name"], value["message_template_language"],
value["message_template_id"], value["new_category"])
print(f"routing updated: {key} is now {value['new_category']}")
for s in value.get("statuses", []):
if (s.get("pricing") or {}).get("category") == "marketing":
print(f"marketing billed on Cloud API: {s.get('id')} ({s.get('status')})")
def send(waba_id, phone_number_id, to, name, language):
category = lookup(waba_id, name, language)
if category is None:
refresh(waba_id)
category = lookup(waba_id, name, language)
if category is None:
raise LookupError(f"template {name}/{language} not found on {waba_id}")
body = {"messaging_product": "whatsapp", "recipient_type": "individual", "to": to,
"type": "template", "template": {"name": name, "language": {"code": language}}}
path = "/marketing_messages" if category == "MARKETING" else "/messages"
status, resp = graph("POST", f"/{phone_number_id}{path}", body)
code = (resp.get("error") or {}).get("code")
if code in WRONG_ENDPOINT[path]:
# Meta rejected the request, so nothing was sent. One retry cannot duplicate it.
refresh(waba_id)
other = "/messages" if path == "/marketing_messages" else "/marketing_messages"
print(f"{code} on {path}: retrying once on {other}")
status, resp = graph("POST", f"/{phone_number_id}{other}", body)
return status, resp
if __name__ == "__main__":
waba = os.environ.get("WABA_ID")
command = sys.argv[1]
if command == "refresh":
refresh(waba)
for row in db.execute("SELECT name, language, category FROM template_category ORDER BY name"):
print(*row)
elif command == "webhook":
with open(sys.argv[2]) as f:
handle_webhook(json.load(f))
elif command == "send":
status, resp = send(waba, os.environ["PHONE_NUMBER_ID"], sys.argv[2], sys.argv[3], sys.argv[4])
print(status, json.dumps(resp))
Save Meta’s completed sample above as payload.json and run the webhook command to see the mapping change. The webhook command needs no token. The send command sends a template with no parameters, so pick one without variables for a first test.
The retry sets come from Meta’s error codes page (Meta error codes, accessed 2026-11-24). With Cloud API marketing turned off, /messages rejects a marketing template with “(#131063) Marketing templates disabled for Cloud API”. The Marketing Messages API table lists two codes for non-marketing content: 131055 “Only marketing template messages are supported” and 134100 “Only marketing messages supported”. Meta doesn’t say which one a recategorized template triggers, so the script handles both.
The script never switches endpoints on a timeout, a 429 or a 5xx. Those don’t confirm the request failed, and a second send could reach the user twice. Two other codes on /marketing_messages call for a wait, not a switch. Code 134101 “Your template is still syncing” covers a new template, which takes up to 10 minutes. Code 134102 “Template unavailable for use” comes back as HTTP 500.
On /marketing_messages, Meta also returns 131063 when a fallback to Cloud API is blocked. Switching endpoints would hit the same block, so the script doesn’t retry it.
A Chatwoot fork merged a pull request that routes by cached category and retries once on the other endpoint after 131063 (PR, merged 2026-11-04). It does not retry on 429 or 5xx. It leaves template_category_update handling as a follow-up. In a .NET SDK issue, a user asked for the new endpoint and could not confirm product_policy on Meta’s pages (issue, closed 2026-10-20).
Find the traffic that still falls back to Cloud API
Sending to /marketing_messages doesn’t guarantee the message stayed there. product_policy defaults to CLOUD_API_FALLBACK. Meta’s send page says “If onboarding requirements are not met, the marketing messages will still be routed via Cloud API.” With STRICT, “no fallback to Cloud API is attempted regardless of the disable_marketing_messages_on_cloud_api setting.”
The status webhook shows which path a message took. Sends through the Marketing Messages API carry pricing.category set to marketing_lite. Fallback sends carry marketing, the same value as a marketing template sent straight to /messages. The script’s webhook command prints every status billed as marketing. That list is the traffic that fails once Cloud API marketing ends for the account. Max price sends carry a third value, marketing_lite_dynamic, covered in max price for marketing messages.
Onboarding checks before you turn off Cloud API marketing
Accepting the terms and reading marketing_messages_onboarding_status are covered in the Marketing Messages API for WhatsApp.
Partners can list client accounts from GET /<BUSINESS_PORTFOLIO_ID>/client_whatsapp_business_accounts and filter on marketing_messages_onboarding_status. Each account that signs the terms sends an account_update webhook with the event MM_LITE_TERMS_SIGNED. To onboard a client, Meta recommends WhatsApp Manager, with Embedded Signup and the Intent API (POST /<END_BUSINESS_ID>/onboard_partners_to_mm_lite) as alternatives (Meta onboard business customers, accessed 2026-11-24).
Don’t copy the Embedded Signup sample on that page. It still sets "version": "v3" and a marketing_messages_lite feature in extras. Embedded Signup v3 was removed on October 15, 2026 and is now served as v4, as Embedded Signup v5 migration explains.
Once an account shows ONBOARDED and your router is live, turn Cloud API marketing off. You get the sunset’s behavior early, on your own date, with a known error code.
curl -X POST "https://graph.facebook.com/v26.0/$WABA_ID" \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-d '{"disable_marketing_messages_on_cloud_api": true}'
Meta’s response is the account id. Read the flag back with GET /<WABA_ID>?fields=disable_marketing_messages_on_cloud_api. From then on, a stale cache surfaces as 131063, which the router retries, instead of as Cloud API marketing you didn’t intend.
What Meta has not said
Meta hasn’t said which error code Cloud API returns for marketing after the sunset. The overview says only that sending “will produce an error”. Code 131063 is documented for the opt-in flag, and nothing says the sunset reuses it.
Nothing documents what CLOUD_API_FALLBACK does for accounts created from April 13, 2027, or for anyone after October 13, 2027. If you need certainty that a send stayed on the Marketing Messages API, use STRICT.
There is no word yet on whether existing accounts get a warning before October 13, 2027, or whether it will set disable_marketing_messages_on_cloud_api for them. It documents no API call for accepting the terms.
Meta hasn’t said how the sunset affects group_marketing, which exists as a pricing category, or coexistence numbers. The send, onboarding and get-started pages don’t mention the sunset at all. Only the overview and the max price billing page do.
Delivery failures on the new endpoint also change in 2027. From February, Meta will return a new code for marketing messages held back for template quality or price, covered in error 131066. The per-user limit behind error 131049 doesn’t go away with the endpoint change.
Z-API Omni team