kenari.dev

Connecting a number#

You need a connected number before kenari can proxy Cloud API calls or forward webhooks for it. Open Numbers in the dashboard and choose Connect a number. There are three ways to connect:

Option in the dashboardMethodBest for
Bring your own accountYour Meta app's credentialsYou already have a Meta app with WhatsApp set up
Connect a dedicated phone numberMeta Embedded SignupA number used only through the API
Keep using the WhatsApp Business appEmbedded Signup, coexistence variantA number that stays in the WhatsApp Business app as well (Coexistence)

Before you connect#

  • Active subscription. Your account must be trialing, active, or past_due within its 3-day grace period. Otherwise connecting fails with 402 billing_inactive.
  • Room in your quota. Each plan allows a fixed number of connected numbers. Connecting past it fails with 409 quota_reached.
PlanNumbersPrice
Starter1$3 / month
Basic2$5 / month
Pro5$8 / month

New accounts start with a 7-day trial. The Numbers page shows how many numbers you've used out of your limit.

A WhatsApp Business account (WABA) can be bound to only one kenari account at a time. Connecting a WABA that another kenari account already holds fails with 409 waba_owned_elsewhere.

Bring your own account (BYO)#

Use this when you already run your own Meta app with the WhatsApp product. kenari calls Meta with your credentials. Meta sends webhooks to your app's callback URL, and you point that URL at kenari.

1. Gather five values#

FieldWhere to find itNotes
WABA IDWhatsApp Manager or your app's WhatsApp → API Setup pageDigits only
Phone number IDAPI Setup, next to the numberThe number's Meta ID, not the phone number itself
Access tokenA system user token for your appMust include both whatsapp_business_management and whatsapp_business_messaging, and must be granted access to this WABA. Meta tokens start with EAA.
App IDApp settings → BasicDigits only
App secretApp settings → Basic32 hexadecimal characters. kenari uses it to verify the webhooks Meta sends for this number.

The access token and app secret are encrypted before they're stored. They're never shown again or sent back to the browser.

2. Submit the form#

Choose Connect a number → Bring your own account, fill in the five fields and choose Connect. Before storing anything, kenari checks the credentials with Meta:

  1. The token is valid and was issued for your App ID. This call also proves the app secret is correct.
  2. The token has both WhatsApp permissions.
  3. The token can access the WABA.
  4. The phone number exists and belongs to that WABA.
  5. kenari subscribes your app to the WABA's webhooks.

If a check fails, nothing is saved. The response is 400 byo_invalid, with the failing field marked:

FieldReasonMeaning
app_secretapp_credentials_rejectedMeta rejected the app ID and secret pair
access_tokentoken_invalidThe token is expired or invalid
app_idtoken_app_mismatchThe token belongs to a different app
access_tokenscope_missingThe token lacks a WhatsApp permission
waba_idwaba_not_grantedThe token hasn't been granted this WABA
phone_number_idphone_not_foundMeta can't find this phone number ID
waba_idwaba_unreadablekenari couldn't list the WABA's numbers
phone_number_idphone_not_in_wabaThe number isn't in this WABA
waba_idsubscribe_failedMeta wouldn't subscribe your app to the WABA

3. Point your Meta app's webhook at kenari#

When the connection succeeds, the dashboard shows a Callback URL and a Verify token. In your Meta app, go to WhatsApp → Configuration → Webhook, paste both and save.

text
Callback URL:  https://<kenari api host>/webhook/byo/<your-inbound-token>
Verify token:  <shown in the dashboard>

When you save, Meta sends a verification request to this URL. kenari answers it with your verify token and marks the webhook as verified. In the same Meta screen, subscribe to the webhook fields you want forwarded, such as messages. kenari can only forward what Meta sends.

To see these values again later, open the number's ⋯ menu. The Meta webhook settings panel shows the callback URL and verify token, when the webhook was verified, and when kenari last received an event for it.

kenari checks every event on this URL against your app secret (X-Hub-Signature-256) and rejects any that fail. Each callback URL accepts up to 600 requests per minute. Above that, it answers 429.

Rotating BYO credentials#

If you rotate the token or app secret at Meta, choose Update credentials in the number's ⋯ menu. You can replace the access token, the app secret or both. kenari runs the same checks with Meta before saving.

Embedded Signup (dedicated number)#

  1. Choose Connect a number → Connect a dedicated phone number, then Continue with Facebook.
  2. In Meta's popup, sign in, then pick or create a business, a WABA and a phone number. Grant both WhatsApp permissions (management and messaging).
  3. kenari exchanges the code Meta returns, subscribes the WABA to webhooks and registers the number.

If you create a WABA in the popup but don't add a number, kenari saves the WABA and lists the numbers it finds so you can choose one.

If registration doesn't finish, the number shows Registration pending. Choose Register number in its ⋯ menu, then Retry registration. If the number already has a two-step verification PIN, Meta rejects kenari's PIN, and the dashboard asks for your existing 6-digit PIN (pin_required).

Connection errors#

CodeStatusMeaning
billing_inactive402No active or trialing subscription
quota_reached409Your plan's number limit is full
waba_owned_elsewhere409The WABA is connected to another kenari account
embedded_signup_restricted403Embedded Signup isn't enabled for your account
byo_invalid400BYO credentials failed a check (see the field table above)
token_invalid400Meta rejected the credentials, or the token doesn't grant this WABA
scope_missing400A WhatsApp permission wasn't granted in the popup
subscribe_failed502Meta couldn't subscribe the WABA to webhooks
meta_unreachable503Meta didn't respond. Try again.
pin_required409Registration needs the number's existing two-step verification PIN

Number status#

Each number on the Numbers page shows one of these statuses:

StatusWhat it means
ConnectedReady to send
Registration pendingMeta registration didn't finish. Retry it.
Access revokedThe token expired or was revoked. Reconnect, or update BYO credentials.
Disconnected by MetaMeta ended the connection (for example, partner removal or a ban). Reconnect to resume.
RestrictedMeta restricted the number
FlaggedMeta temporarily blocked the number

kenari updates a number's quality rating, throughput and messaging tier when Meta sends a phone_number_quality_update or phone_number_name_update event. To pull fresh details from Meta now, choose Refresh from Meta in the number's ⋯ menu (at most once every 10 seconds per number).

Disconnecting#

Open a number's ⋯ menu and choose Disconnect. kenari then:

  • deregisters the number with Meta (best effort; the local disconnect goes ahead even if Meta is down)
  • stops proxying and forwarding events for it immediately
  • if it was the last number on its WABA, unsubscribes the WABA from webhooks and deletes the stored token
  • frees a slot in your quota

You can connect the number again later.

Downgrading below your number count#

If you move to a plan with fewer numbers than you have connected, the dashboard shows You're over your number allowance. Choose which numbers to disconnect and confirm.