Integrations
Payments (Razorpay, Stripe), WhatsApp via Meta, SMS gateways, email, AI providers, push, Meta Conversions API, Zoho Books and data import.
7 min read
Overview
Kagami talks to third parties through small adapters where a swap is likely (payments, messaging) and through direct calls elsewhere. Credentials live in server environment variables (platform-wide) or in per-brand rows (messaging_settings, integration_credentials, zoho_sync_settings). Secrets are never sent to the browser. This page names env vars only, never values.

There is no single "Settings -> Integrations" page. Each integration has its own settings page, listed per section below.
Payments
PaymentProvider Interface
Online deposits at booking go through PaymentProvider (web/src/lib/payments/types.ts):
createOrder(params)creates a provider order or PaymentIntent and returns browser-safe client configverifyPayment(params)confirms a payment; false means "do not confirm"refund(paymentId, amount?)full or partial refundverifyWebhookSignature(rawBody, signature)- optional reconcile step that looks at an existing order before creating another, so a customer who reloads the page is not charged twice
Providers
| Provider | Status | Use |
|---|---|---|
| Cash | Always available | In-salon cash |
| Razorpay | Live | UPI, cards, wallets: online deposits and card payments at POS checkout (Razorpay orders and Checkout, not payment links) |
| Stripe | Live | Card payments for online deposits, via PaymentIntents and the Payment Element |
A provider counts as configured only when both its server secret and its public key are set, and the booking page offers only configured providers (Razorpay, Card). Env vars: RAZORPAY_KEY_ID, RAZORPAY_KEY_SECRET, NEXT_PUBLIC_RAZORPAY_KEY_ID, RAZORPAY_WEBHOOK_SECRET, STRIPE_SECRET_KEY, NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY, STRIPE_WEBHOOK_SECRET.
Webhooks
/api/webhooks/razorpay (header x-razorpay-signature) and /api/webhooks/stripe (header stripe-signature) verify the signature before doing anything and return 401 otherwise. Events are de-duplicated (Stripe by event id, Razorpay by a key derived from event type and entity id) and, if processing fails, the dedup key is released so the provider's retry is handled.
WhatsApp (Meta Cloud API)
Kagami calls Meta's WhatsApp Cloud API directly (Graph API v25.0); there is no BSP in between.
- Connect: Settings -> WhatsApp & AI -> Message settings. Embedded Signup (needs
NEXT_PUBLIC_META_APP_ID,META_APP_SECRET,NEXT_PUBLIC_META_EMBEDDED_SIGNUP_CONFIG_ID) or connect an existing number with WABA id, phone number id, token and PIN. Kagami registers the number and subscribes the app. Per-brand credentials are stored inmessaging_settings. - Templates: the standard set is submitted to Meta on connect; custom templates are built in Settings -> WhatsApp templates. Status comes back through the webhook.
- Webhook:
/api/webhooks/whatsapp, verified withX-Hub-Signature-256(META_APP_SECRET) andWHATSAPP_WEBHOOK_VERIFY_TOKEN. Routes inbound messages to the inbox and the AI receptionist, and records delivery and template status. - Instagram and Messenger DMs: "Connect Instagram" in Settings -> Social profiles;
/api/webhooks/meta(META_WEBHOOK_VERIFY_TOKEN) feeds the same inbox and AI.
See Communications for the sending rules.
SMS (OTP only)
SMS is used for one-time codes, not for reminders or campaigns. Providers are tried in this order, skipping any that is not configured:
| Order | Provider | Env vars |
|---|---|---|
| 1 | Self-hosted android-sms-gateway (phone-as-gateway, proxied through the app). The send polls the message status and treats one stuck in "Pending" as a failure | ANDROID_SMS_GATEWAY_URL, ANDROID_SMS_GATEWAY_USERNAME, ANDROID_SMS_GATEWAY_PASSWORD |
| 2 | TextBee (hosted phone-as-gateway) | TEXTBEE_API_KEY, TEXTBEE_DEVICE_ID |
| 3 | httpSMS | HTTPSMS_API_KEY, HTTPSMS_FROM_NUMBER |
| 4 | WhatsApp otp_verification template (last resort) |
per-brand WhatsApp credentials |
Twilio is not used for SMS or for voice webhooks (the /api/webhooks/voice/* routes were removed).
Email (Resend)
Transactional email goes through Resend (RESEND_API_KEY, sender EMAIL_FROM). With no API key, email is skipped. Sent mail: booking confirmation, invoice receipt, reminder copy, portal, signup and password-reset codes, staff invitations, shift swaps, referral mail, alert emails, daily exceptions digest and AI hand-off escalation. Marketing campaigns do not use email; they are WhatsApp only.
AI Providers (OpenRouter, Groq)
The AI receptionist (web/src/lib/ai/llm.ts) talks to any OpenAI-compatible chat endpoint and fails over down an ordered list, each attempt with a 25 second timeout:
- OpenRouter (primary,
OPENROUTER_API_KEY). Model fromOPENROUTER_MODEL, default a DeepSeek flash model with reasoning disabled. - OpenRouter pinned to Groq (only when
OPENROUTER_GROQ_BYOK=1), modelOPENROUTER_GROQ_MODEL. - Groq direct (
GROQ_API_KEY,GROQ_MODEL). - Anthropic (only when
ANTHROPIC_API_KEYis set).
Providers without a key are left out. Cost-per-million-token overrides exist (OPENROUTER_COST_*, GROQ_COST_*) for cost logging only. A brand's saved model is honoured only when AI_HONOR_BRAND_MODEL=1. Campaign copy and review-reply drafts use the separate callAI gateway in web/src/lib/ai-gateway.
Push Notifications (Firebase, Web Push)
notifyUsers fans out to browser Web Push subscriptions (VAPID: NEXT_PUBLIC_VAPID_PUBLIC_KEY, VAPID_PRIVATE_KEY) and native Android device tokens through Firebase Cloud Messaging (FIREBASE_PROJECT_ID, FIREBASE_CLIENT_EMAIL, FIREBASE_PRIVATE_KEY). It never throws, and a channel without credentials is skipped. Dead endpoints and tokens are deleted. Tokens registered by the old in.salonos.* apps belong to a different Firebase project and are skipped.
Meta Conversions API (ad tracking)
Settings -> Marketing -> Meta Ads (CAPI). A brand saves its Pixel / Dataset ID and access token (stored in integration_credentials, provider meta_capi; the token is only ever shown masked). Kagami then sends server-side events to Meta:
| Event | When |
|---|---|
Lead |
A new client is created by online booking, added by staff (including POS quick add for a walk-in), or starts a first WhatsApp conversation. Event id lead-<clientId>, so Meta counts each client once. Not sent when quick add reuses an existing client. |
Schedule |
An appointment is booked online or at the desk (not walk-ins) |
Purchase |
A POS invoice is created, with its value in INR |
Phone, email, name and other match keys are SHA-256 hashed before sending. Each event has a stable id so Meta de-duplicates retries; a failed send is retried once. Results are logged to meta_capi_events (kept 90 days) and shown on the settings page, which also has a "Send test event" button. Limitation: a later invoice void or edit is not reflected in Meta.
Accounting - Zoho Books
Settings -> Payments -> Zoho Books. A brand enters its Zoho client id, secret and organisation id and completes OAuth (India data centre, zohoapis.in).
- Direction: one way, Kagami to Zoho. Paid invoices are pushed; expenses are not pushed at present.
- Trigger: manual. Choose a start date and press Run sync. There is no scheduled sync.
- Idempotent: each pushed record is logged in
zoho_sync_logsand skipped next time. - The settings form has a "payments" switch, but no payment push exists in code yet.
Separately, Accounting -> Exports produces CSV files for Zoho Books, Tally, a P&L statement and GSTR-1 / GSTR-3B.
Ads Attribution
There is no Google Ads or Meta Ads API import. Booking links carry utm_source, which is stored on the appointment. Ad spend is entered by hand per source and date in Reputation -> Attribution & ROI, and the report pairs it with bookings and revenue to show ROAS. Kagami does write conversion events to Meta (see above), but nothing else to ad platforms.
Calendar and Reviews
- Google Calendar sync is a stub (it only logs). Appointments can be exported as iCal.
- Google Business Profile is not connected by API. Google reviews are not fetched; review links are configured per brand and per store, and star ratings and review text are entered by hand. See Reputation.
Data Import
Settings -> Import & export (/dashboard/data-import), shown to owners. Sources: Google Sheets link or Excel / CSV upload. Record types include clients, staff, services, service price updates, products, vendor bills and invoices, each with column mapping, preview, duplicate detection and a result summary. There is also CSV export.
Zylu
Zylu is the salon software YLG used before Kagami. The live Zylu integrations were retired on 2026-11-25 (SALO-3006):
- Import wizard (Data Import -> From other apps -> Zylu), nightly bill sync (
/api/cron/zylu-sync) and inbox poller (/api/cron/zylu-inbox): retired in SALO-3006, code removed in SALO-3041. A salon moving from Zylu exports a spreadsheet and uses the CSV / Sheets import. Bills, clients and wallets already imported from Zylu stay in Kagami as history.
Configuring Integrations
| Integration | Where |
|---|---|
| WhatsApp, templates | Settings -> WhatsApp & AI |
| Instagram / Messenger | Settings -> Marketing -> Social profiles |
| Meta Conversions API | Settings -> Marketing -> Meta Ads (CAPI) |
| Zoho Books | Settings -> Payments -> Zoho Books |
| Alert channels | Settings -> Team & access -> Alerts |
| API and MCP keys for other apps | Settings -> Team & access -> API & MCP keys |
| Payments, SMS, email, AI, push | Server environment variables (not a tenant setting) |
Permissions
| Action | org_owner | brand_manager | location_manager |
|---|---|---|---|
| Connect WhatsApp, edit message settings | Yes | Yes | Yes |
| Connect Instagram | Yes | Yes | No |
| Meta Conversions API | Yes | Yes | Yes |
| Zoho Books (nav: manager roles; needs the analytics feature) | Yes | Yes | Yes |
| Open Import & export | Yes | No (nav is owner-only; some import actions accept managers) | No |
Roles are taken from the settings navigation (manager roles). Server actions enforce them again.