Code
js
// Read-only checks for a WhatsApp Business Coexistence number. Node 22+, no packages.
const CONFIG = {
base: process.env.GRAPH_BASE_URL || "YOUR_GRAPH_API_BASE_URL", // Meta Graph API root incl. version
wabaId: process.env.WABA_ID || "YOUR_WABA_ID",
token: process.env.WHATSAPP_TOKEN || "", // keep the token in the environment only
};
const HINTS = {
190: "Token is expired or invalid. Create a new one.",
100: "Wrong ID, or the token cannot see this object. Check the WABA ID and asset access.",
10: "Permission missing. The token needs whatsapp_business_management.",
200: "Permission missing. The token needs whatsapp_business_management.",
};
async function graphGet(path, { base, token, fetchImpl }) {
const res = await fetchImpl(`${base}/${path}`, {
headers: { Authorization: `Bearer ${token}` },
});
const body = await res.json().catch(() => ({}));
if (!res.ok) {
const { error = {} } = body;
const { code = 0, message = "no detail" } = error;
const hint = HINTS[code] || "Read the message; it usually names the failing field.";
throw new Error(`[${res.status}] code ${code}: ${message} -> ${hint}`);
}
return body;
}
async function diagnose({ base, wabaId, token, fetchImpl = fetch }) {
const ctx = { base, token, fetchImpl };
const findings = [];
const fields = "id,status,platform_type,is_on_biz_app,code_verification_status";
const { data: list = [] } = await graphGet(`${wabaId}/phone_numbers?fields=${fields}`, ctx);
if (list.length === 0) {
findings.push("No phone number on this WABA: onboarding did not finish, or the WABA ID is wrong.");
}
for (const { id, status, platform_type, is_on_biz_app } of list) {
if (is_on_biz_app !== true) findings.push(`${id}: not flagged as a Business App (Coexistence) number.`);
if (platform_type !== "CLOUD_API") findings.push(`${id}: platform_type is ${platform_type}, expected CLOUD_API.`);
if (status !== "CONNECTED") findings.push(`${id}: status is ${status}, expected CONNECTED.`);
}
const { data: apps = [] } = await graphGet(`${wabaId}/subscribed_apps`, ctx);
if (apps.length === 0) {
findings.push("No app is subscribed to this WABA: the partner side of the signup did not complete.");
}
return findings;
}
async function main() {
if (!CONFIG.token) {
console.log("Set GRAPH_BASE_URL, WABA_ID and WHATSAPP_TOKEN, then run again.");
return;
}
const findings = await diagnose(CONFIG);
console.log(findings.length ? findings.join("\n") : "Meta side looks complete. Create the connection in Make again.");
}
main().catch((err) => {
console.error(err.message);
process.exitCode = 1;
});Why it happens
Coexistence signup has two halves. You approve the link in the WhatsApp Business app, then the partner (here Make) finishes the setup on Meta's side. If the second half stops, the app keeps showing "Complete setup" and no usable connection exists. Make then asks Meta to verify the connection, and Meta answers with HTTP 400. Make shows only the status code, so the real reason stays hidden.
Steps
- In Meta Business settings, create a system user and give it access to your WhatsApp account.
- Generate a token for it with the
whatsapp_business_managementpermission. This needs a Meta app of your own. - Copy the WABA ID from WhatsApp Manager.
- Set
GRAPH_BASE_URL(the Graph API root with a current version),WABA_IDandWHATSAPP_TOKENas environment variables. - Save the code to a file and run it with Node 22.
- If it reports no phone number or no subscribed app, the signup stopped half-way. Open Business Platform in the WhatsApp Business app, disconnect Make, then repeat the signup in one browser session.
- If it reports nothing, create the connection in Make again. If that still fails, send the output to Make support.
Pitfalls
- The script uses your own token, not the one Make holds. It shows the state on Meta's side, not Make's internal state.
- Keep the token in an environment variable. Never paste it into a scenario, a screenshot or a forum post.
- The calls are read-only GET requests. They send no messages and cost nothing.
- Meta sets eligibility rules for Coexistence, such as region, app version and how long the number was used. A number that does not qualify can fail at this same step.
- The findings are hints. An unexpected
statusvalue is worth reading, but it does not always mean a fault.
Seen on: Make Community ·
Related service: Telegram and WhatsApp bots