Connect WhatsApp to Klugon with an AI coding agent

The Meta side of connecting WhatsApp is the fiddly part. If you already use an AI coding agent with browser access, you can hand it the whole thing with one prompt, and step in only for the password and verification-code moments it's deliberately not allowed to click through.

Start 3-day free trial

Updated · 8 min read

To connect WhatsApp to Klugon, you have to work through Meta's own developer console: a Meta app, a phone number, a webhook, a verification code, a permanent access token. None of it is hard on its own, but it's a lot of clicking through screens you'll likely never open again. If you already use an AI coding agent that can drive a browser — Claude Code with the Chrome extension is what we used to write this guide — you can hand it the whole thing in one message and only step in for the handful of moments it won't do unsupervised.

This post walks through what the agent can do, what it can't, and gives you the exact prompt to paste in.

What you need before you start

  • A phone number that can receive an SMS or voice call, and that isn't currently active on regular WhatsApp or the WhatsApp Business app. If it is, delete that WhatsApp account from the phone first (Settings → Account → Delete My Account in the WhatsApp app). Meta won't let a number move onto the Cloud API while it's still registered to a consumer WhatsApp account.
  • Access to the Meta Business account (or admin rights on one) that will own the number.
  • Your Klugon dashboard open at Integrations, so you can paste in the final details, or let your agent do it.

What the agent can do for you

Working from the Setup Guide inside Klugon's own WhatsApp integration, an AI agent with browser access can:

  1. Create or open a Meta app and add the WhatsApp product.
  2. Add your phone number from inside that app's own API Setup page, not from WhatsApp Manager directly. This matters more than it sounds: a number added through WhatsApp Manager on its own can land in a WhatsApp Business Account the app was never given access to, and it won't show up for sending or receiving until you fix that. Adding it through the app's own "Add phone number" flow avoids the problem entirely.
  3. Pick up the SMS or voice verification code once you read it out, and submit it.
  4. Set the webhook callback URL to https://klugon.ai/api/webhooks/whatsapp and a verify token of its choosing.
  5. Subscribe the app to the messages webhook field, so Klugon actually receives messages.
  6. Register the number for the Cloud API with a two-step verification PIN.
  7. Walk you through creating a System User in Business Settings, giving it access to the WhatsApp account and a role on the app itself (both are needed — a System User with only WhatsApp access but no app role will hit "No permissions available" when generating a token), and generating a permanent access token for it, scoped to WhatsApp management and messaging.
  8. Make sure the Meta app is published, not just created. An unpublished app will let you register the number and generate a token, but production messages won't actually reach Klugon until you fill in the missing fields under App Settings → Basic (Category, Data Deletion URL) and click Publish.
  9. If sending still fails after all that with an error like (#10) Viewer cannot access the provided Paid Message Account, check the System User's Finance role in Business Settings (System Users → your System User → Edit info → Finance role), and set it to Finance editor. If it still fails even after that, fall back to a long-lived User access token instead of a System User token — it works immediately, at the cost of expiring every ~60 days instead of never.
  10. Paste the resulting Phone Number ID, access token and verify token into Klugon's WhatsApp integration for you.

What it won't do, and why

A well-behaved AI agent should refuse a short, specific list of steps, by design:

  • Typing your Meta account password, even if a field has auto-filled it. Deleting a phone number from a WhatsApp Business Account requires your password, and that confirmation should be yours to click, not the agent's.
  • Creating a System User, or granting it access to anything. This covers both assigning it your WhatsApp Business Account and giving it a role on the app — each is a new standing permission on your business, and that's exactly the kind of decision an agent shouldn't wave through on its own judgement. You'll need to click "Add", name it, and assign each piece of access yourself; the agent can tell you exactly where to click.
  • Changing the System User's Finance role, or clicking "Publish" on the app. Both are standing changes to what your business account and app can do in production, not routine setup clicks — a careful agent will tell you exactly where to click rather than doing it for you.
  • Any one-time code that only you receive. The SMS or voice code Meta sends to the number is yours to read and relay.

If your agent happily does any of these without pausing to ask you, that's worth treating as a bug, not a convenience.

The prompt to connect WhatsApp to Klugon

Paste this into your AI coding agent once it has access to a browser (Claude Code with the Chrome extension, or an equivalent setup). You'll find the same prompt ready to copy on Klugon's WhatsApp integration page.

Swap in any Meta app you already have. If the agent hits a step it won't do — your account password, a verification code, creating the System User — it should stop and tell you exactly what to click, rather than trying to find a way around it.

Frequently asked questions

Can an AI agent really create a Meta developer app and WhatsApp number on its own?

Most of it, yes — app creation, adding the number, setting the webhook, subscribing to messages, and registering the number for the Cloud API are all routine browser actions. The exceptions are the password-gated and account-security steps above.

Why can't the agent create the System User itself?

A System User is effectively a new login with standing access to your business, including your WhatsApp account. Creating one, and deciding what it can touch, is a decision about who and what can act on your behalf going forward — not something that should happen without you clicking "yes" yourself.

What if my number is already on regular WhatsApp?

Delete that WhatsApp account from the phone (Settings → Account → Delete My Account) before trying to register it on the Cloud API. Meta's error for this is explicit: "This phone number is already in use by another WhatsApp account. Moving a phone number between WhatsApp accounts isn't supported."

Do I still need to read Klugon's WhatsApp setup guide if I'm using an agent?

It helps the agent, not just you — pointing it at the WhatsApp booking setup guide and the Setup Guide inside Klugon's own integrations page gives it the exact callback URL and field names it needs, rather than guessing.

Is the access token the agent generates permanent?

Only if you generate it from a System User, with the expiration set to never. The token Meta's own dashboard offers during testing is temporary and will expire; it works for trying things out, but swap it for a System User token before you rely on the number day to day.

Why does "Generate token" say "No permissions available"?

The System User has access to your WhatsApp Business Account but no role on the app itself yet. In Business Settings, open the app, click "Assign people", select the System User, and turn on at least "Develop app" access. Only then will WhatsApp permissions show up in the token wizard.

Do I need to install or log into WhatsApp on the number afterward?

No — and you shouldn't. Once a number is registered on the Cloud API, it's meant to be managed entirely through Meta's API and Klugon's dashboard, not the consumer WhatsApp app. Installing WhatsApp and logging in with that number isn't how the Cloud API number is used day to day, and a number generally can't be active on both the consumer app and the Cloud API at once unless a provider has specifically set up Meta's "coexistence" feature for you, which Klugon's direct Cloud API connection doesn't use. Customers message the number exactly as before; your AI assistant replies through Klugon, and there's no app to open or stay signed into.

Try Klugon's AI receptionist on your own calls and messages

Seven days free, and you can cancel anytime before you're charged. Plans start at $99 a month.