Klosr Docs Sign in to Klosr

Chapter 8

For your technical team

Two pieces connect Klosr to your systems: your payment platform tells Klosr when a deposit is paid, and your WhatsApp Business number carries the agent's chats. Both belong to your organization: Klosr never holds the money, and Meta bills your own account.

The payment webhook

In the panelSettingsPaymentsPayment settingsNew webhook secret

Klosr sends each buyer a link to your own payment page. When they pay, your platform calls Klosr's webhook, and Klosr marks the deposit paid, reserves the unit and tells the lead.

Payment settings, where the link template is set and the webhook secret is made.
Payment settings, where the link template is set and the webhook secret is made.
  1. In Settings > Payment settings, an admin presses New webhook secret. It shows the webhook address and the secret once: copy both somewhere safe.
  2. Make the link template point at your payment page, with the slots below.
  3. Have your platform call the address when a payment succeeds or fails, as described below.

A new secret replaces the old one at once: calls signed with the old secret are refused from then on.

The call Klosr expects

POST a JSON body to the address, signed with HMAC-SHA256 of the raw body and your secret, in this header:

X-Klosr-Signature: sha256=<hex digest>
{
  "event_id": "unique-per-event",
  "type": "paid",
  "reference": "the {reference} from the link",
  "amount": "10000.00",
  "currency": "SAR",
  "unit_code": "B-0703",
  "payment_reference": "your platform's transaction id",
  "paid_at": "2026-11-06T09:30:00Z"
}
type
paid, failed or page_opened (the buyer opened your payment page).
Required
event_id, type and reference, as strings. For paid, also amount and currency, unless the deposit rule is "Set on the payment page": then send them if you have them, and Klosr keeps the amount.
unit_code
Send it when the buyer can pick the unit on your page. If it differs from the held unit, the deal moves to the unit paid for, in the same project: that unit is reserved and the held one goes back on sale.
event_id
Unique per event. A repeated event_id gets the same answer and changes nothing, so retries are safe.

Klosr's answers

AnswerMeans
204Received. Also the answer to a repeated event_id.
403Wrong signature, or an unknown address.
422A required field is missing.

Some payments need a person, and Klosr gives your team a task for each:

  • An amount below the deposit, or another currency, does not mark the deal paid.
  • A unit_code that is taken, or that matches no single unit, still counts as paid; someone sorts out the unit.
  • A payment after the hold ended still counts. If the unit went to another buyer meanwhile, someone refunds the deposit or offers another unit.

WhatsApp setup

In the panelSettingsChannelsConnections

Klosr uses Meta's WhatsApp Cloud API directly, with no reseller. Your organization brings its own Meta Business account, phone number and secrets, so Meta bills your account. Allow a few days: Meta's business verification can take longer.

A WhatsApp connection in Klosr, with the callback URL and verify token to paste at Meta.
A WhatsApp connection in Klosr, with the callback URL and verify token to paste at Meta.

Before you start, agree three things inside your organization:

  • A path to a person. WhatsApp's policy asks that automation offers a prompt, clear way to reach a human. Keep escalations on, and your team watching Conversations.
  • Selling your own units only. Meta's terms do not allow AI as the main thing offered on WhatsApp. The agent sells your units to your buyers; keep it to that.
  • Opt-in. Klosr sends marketing templates only to leads marked opted in. Meta asks that they agreed to hear from your business by name.

Part 1: at Meta

  1. Create or open your Meta Business account at business.facebook.com.
  2. Start business verification under Security Centre. Until it is done, the account reaches only 250 people in 24 hours.
  3. Get a phone number that is not on the WhatsApp app. To move a number that is, delete its WhatsApp account first.
  4. At developers.facebook.com, create an app of type Business and add the WhatsApp product. Connect your WhatsApp Business Account and add the number.
  5. Add a payment method in WhatsApp Manager. Meta charges for service replies beyond its monthly free allowance.
  6. Make a permanent token: Business settings > Users > System users > Add; then Add assets (the app and the WhatsApp account, full control); then Generate new token with whatsapp_business_messaging and whatsapp_business_management.
  7. Switch the app to Live mode.
  8. Note four things: the Phone number ID and the WhatsApp Business Account ID (WhatsApp > API Setup), the App secret (App settings > Basic), and the token.

Part 2: connect it in Klosr

  1. In Settings > Channels, press New channel connection, choose WhatsApp, paste the four things and save. A token or secret saved here is never shown again: leave the field empty later to keep it.
  2. Open the connection with Edit. Copy the Callback URL and the Verify token.
  3. At Meta: your app > WhatsApp > Configuration > Webhook > Edit. Paste both, then Verify and save.
  4. On the same page, under Webhook fields, subscribe to messages and user_preferences.
  5. Back in Klosr, open the connection's WhatsApp menu and press Connect. It shows your number when the token works.
  6. If Meta answers that the number is not registered (error 133010), register it once, choosing any six digits as the PIN and keeping them:
curl -X POST "https://graph.facebook.com/v27.0/PHONE_NUMBER_ID/register" \
  -H "Authorization: Bearer TOKEN" -H "Content-Type: application/json" \
  -d '{"messaging_product":"whatsapp","pin":"123456"}'
  1. Press Submit templates in the same menu. Klosr submits its message templates, in English and Arabic, to your account. Once Meta has reviewed them, press Sync templates: it says how many are approved, and the connection's page lists each with its status. Sync again after any change at Meta.
  2. Turn on Default channel for this organization, so leads hear from WhatsApp first.

Klosr turns WhatsApp on for your organization with you. Until then, messages to the number are answered and thrown away, and nothing is sent.

Part 3: try it on your own phone

Put your own numbers in WhatsApp test numbers (Settings > General), with the country code and digits only. While the list holds numbers, nobody else reaches the agent on WhatsApp. Then, from your phone:

  • Write to the business number. The agent answers, and the chat appears in Conversations with two ticks, then two blue ones when you read it.
  • Send an Arabic voice note: it is written out on the lead's timeline and answered.
  • Add yourself as a test lead, marked opted in, and send a first WhatsApp message from the lead's page. Tap the buttons in it: the agent answers. Tap Stop: you are marked opted out, and nothing more comes.

When it all works, empty the test numbers. Start with a small batch of leads, and watch your quality rating in WhatsApp Manager.

If something goes wrong

What you seeWhat it meansWhat to do
Meta will not verify the webhookThe URL or the verify token differs, or the connection is not activeCopy both again from the connection's page.
Messages reach Meta but not Klosrmessages is not subscribed, the number is not on the test list, or WhatsApp is not on yetCheck those three.
Sends fail with code 190The token expired or was revokedMake a new one and paste it on the connection's page.
Failed with code 131026The number is not on WhatsApp, or the app is very oldNothing to do.
Failed with code 131049Meta held back a marketing message to protect the personDo not resend for 24 hours.
Failed with code 131050The person stopped marketing messagesKlosr stops marketing to them; service messages still go.
Code 131048 or 368Meta has limited the accountStop sending first messages and check WhatsApp Manager > Account quality.
A template shows a problemPaused by Meta, or changed at MetaFix it at Meta, then Sync templates.

To stop everything at once, use Stop the agent in Conversations: no reply and no template goes out until it is started again.