WhatsApp API
Complete guide to the Convrly WhatsApp platform: connecting the official Cloud API, the team inbox, broadcasts, sequences, flow and AI bots, Google Sheet and Meta form automation, booking reminders, the website chat button and settings. Product overview
Overview
Convrly WhatsApp is a self-hosted portal for the official WhatsApp Business Cloud API (PHP 8.1 + MySQL, no framework). Your whole team works from one inbox, and automations reply to leads in seconds.
| Page | What it does |
|---|---|
| Dashboard | Lead pipeline, lead sources, upcoming bookings, recent leads, account health, estimated WhatsApp spend |
| Inbox | Every conversation with assignment, window timers, media, bot handover, booking |
| Contacts | All contacts with source, status and opt-out |
| Broadcast | CSV upload, template preview, send and results |
| Templates | Approved templates from Meta and recent send failures |
| Lead forms | Meta Instant Form → template mappings |
| Google Sheet → WhatsApp | Welcome message for new sheet rows |
| Bots | Flow bot and AI bot with knowledge bases |
| Snippets | Saved replies used by AI suggestions |
| Bookings | Demo/appointment bookings and the bulk scheduler |
| Widgets | Website WhatsApp chat buttons |
| Team | Users and roles |
| Settings | Auto-reply, Telegram, AI, calls, reminders |
Requirements
| Component | Requirement |
|---|---|
| Hosting | VPS or shared hosting with HTTPS (1st year included) |
| PHP | 8.1+ with cURL and PDO MySQL |
| Database | MySQL / MariaDB |
| Cron | Every minute |
| Meta | A Meta Business account, a Meta app with WhatsApp, a phone number not already used on the WhatsApp app |
| Optional | Telegram bot (alerts), Anthropic API key (AI bot and suggestions) |
Installation
- Create a database and import
install-fresh.sql. In phpMyAdmin, click the database name in the sidebar first, otherwise you get “No database selected”. - Fill in
config.php: the database block,phone_number_id,waba_id,access_token,app_secret, and invent a long randomverify_token. Settimezoneto your local time zone. - Upload everything to
public_html/wa/. Check.htaccesskept its leading dot. Opening/wa/config.phpmust return 403. - Add the worker cron job, every minute:
/usr/bin/php /home/USER/domains/yourdomain.com/public_html/wa/worker.php- Set the webhook in your Meta app → WhatsApp → Configuration: Callback URL
https://yourdomain.com/wa/webhook.php, Verify token = the one in config. Subscribe tomessages(andcallsfor call logging). - Subscribe the app to your WhatsApp Business Account — this step is not in Meta's UI and without it nothing arrives:
curl -X POST "https://graph.facebook.com/v21.0/<WABA_ID>/subscribed_apps" \
-H "Authorization: Bearer <TOKEN>"- Open
login.php. The first person to load it creates the owner account.
One app per WhatsApp Business Account: subscribing this portal's webhook takes the slot from any other tool connected before. That tool stops receiving messages immediately.
WhatsApp rules you must know
| Rule | What it means for you |
|---|---|
| 24-hour window | Free-form replies only work within 24 hours of the customer's last message (72 hours after a Click-to-WhatsApp ad). Outside it you must use an approved template, which Meta charges for. |
| Marketing cap | Meta delivers roughly 2 marketing templates per person per 24 hours across all businesses. Blocked sends return error 131049. |
| Quality rating | Spam reports lower your rating. Broadcast only to people who recently engaged — never to cold lists. The portal refuses to broadcast unless your rating is GREEN. |
| Media | Media is sent by public HTTPS URL; the file must be reachable online. |
Team inbox
- Every conversation in one list with unread badges, search and open/unread filters.
- A live 24-hour window countdown on each chat.
- Assign a chat to a team member; agents see their inbox.
- Send text, images and PDF documents; customer media (images, PDFs, documents) is downloaded and shown in the chat.
- Send template when the window is closed.
- Stop bot & take over to end a running bot session.
- Use this reply on an AI suggestion to send your saved snippet.
- 📅 Schedule demo to book a slot from the chat (see Bookings).
- Works on mobile with a full-screen list and a back arrow.
Multiple WhatsApp numbers
Connect more than one WhatsApp number. A switcher at the top selects the active number; every page — inbox, contacts, broadcasts — filters to it. The same person messaging two of your numbers is treated as two separate conversations.
Contacts
Contacts show name, number, product of interest, last message, source and status. Filter by source:
- Click-to-WhatsApp ad
- Instant Form (Meta lead form)
- Imported
- Messaged us directly
Mark contacts as opted in or opted out, and bulk-delete. Anyone who replies STOP is opted out permanently and never messaged again.
Team & roles
| Role | Access |
|---|---|
| Owner | Everything, created on first login |
| Admin | Everything except deleting the owner |
| Agent | Inbox only |
Add people from Team with a temporary password. Sessions use bcrypt passwords, login lockout and CSRF protection.
Install as an app
On Android Chrome an install bar appears — tap it to add Convrly WhatsApp to your home screen. On iPhone use Share → Add to Home Screen. The icon shows your unread count.
Templates
Templates are pulled from Meta and refreshed hourly. The Templates page shows each approved template rendered as a WhatsApp bubble with its category, header type and variables, and lets you set a media URL for templates with an image header. Recent send failures lists every failed send with the error code and campaign.
Broadcasts
- Open Broadcast and pick an approved template — a preview is shown before you send.
- Upload a CSV of numbers (up to 500 per file).
- Send. Numbers messaged in the last 24 hours are skipped, and the page is safe to refresh.
Results shows per campaign: queued, sent, delivered, read, replied, failed, capped and errors.
Templates that need {{1}} variables can't be used in broadcasts yet. Broadcasting is blocked when your quality rating isn't GREEN.
Follow-up sequences
Leads can receive automatic follow-up messages over time. As soon as a human team member replies to the lead, all pending automated follow-ups for that lead are cancelled — so nobody gets a robotic message after a real conversation has started.
Opt-outs
Replies like STOP are honoured permanently across broadcasts, sequences and Sheet automation.
Auto-reply & missed calls
- Auto-reply (Settings → General): sent once, on a lead's first message. Keep it free of prices — a human handles those.
- Missed-call message (Settings → Voice calls): WhatsApp calls are logged and you get an alert; missed callers automatically receive your “we'll call you back” text. Calls can optionally be auto-rejected.
The portal cannot answer WhatsApp voice calls. For AI voice, see AI Voice Calling.
Google Sheet → WhatsApp
Send a welcome template to every new row added to a Google Sheet — perfect for leads collected by other tools.
- In Google Sheets: File → Share → Publish to web → CSV. Copy the URL.
- In Google Sheet → WhatsApp, add a source: paste the published CSV URL and press Test fetch.
- Map the columns: Phone*, Name, Email, Product.
- Choose a default product and a welcome template (or “don't send, just import”).
- Only rows added after you activate the source are messaged — your existing rows are marked as seen, not sent.
- One message per phone per source, ever.
- Respects opt-outs and the GREEN quality rule.
- Throttled to 40 sends per run.
Meta Instant Forms → WhatsApp
When someone fills your Meta (Facebook/Instagram) lead form, they instantly get a WhatsApp template.
- Open Lead forms. Forms seen in incoming leads are listed with their Form ID.
- Map a form: Form ID, a label, the product and the template to send on submission.
- Save. Active mappings are listed with lead counts.
Reading lead-form data requires the leads_retrieval permission, which needs Meta App Review.
Click-to-WhatsApp ads
Leads arriving from Click-to-WhatsApp ads are tagged with that source automatically, and get the longer 72-hour free window.
Telegram alerts
- Create a bot with @BotFather in Telegram and copy its token.
- Message @userinfobot to get your chat ID.
- Paste both in Settings → Notifications and press Send a test.
You'll be alerted for new messages and calls — the best way to never miss a lead, even with the app closed.
Flow bot
A step-by-step bot built from your own questions, buttons and lists — no AI, so it never says anything you didn't write.
- Starts on a new lead's first message.
- Each step can show buttons or a list and branch on the answer.
- Ends by handing over to a human, with a summary sent to Telegram.
- The lead can type “human”, “agent” or “talk to person” at any time to reach your team.
- One flow bot is active at a time.
AI chatbot
The AI bot answers incoming messages using your knowledge base.
- In Bots, create a knowledge base and paste your content (products, prices, timings, FAQs).
- Click Activate on the one to use.
- Set the bot's persona / tone and the daily reply cap per contact (default 15).
- Turn the AI bot on.
- Only replies inside the open 24-hour window.
- “Human” or “agent” stops the bot for that lead.
- Uses your Anthropic API key (Settings → AI).
AI reply suggestions & snippets
Create snippets — your own pre-written answers, each with a label, slug and hint. When a message arrives, the AI picks the snippet that best answers it and shows it as a suggestion in the inbox; your agent sends it with one click.
- The AI only chooses — the text is always yours, so prices and dates are never invented.
- Set a confidence threshold in Settings → AI reply suggestions.
- Each snippet shows how often it was used.
Booking from the inbox
- After a call with a lead, open their chat and click 📅 Schedule demo.
- Pick the product, date, time and joining link, and add notes to include.
- Click Schedule & send.
The lead immediately gets two confirmation messages, and three automatic reminders are scheduled before the slot. Reminders are sent free inside the 24-hour window; otherwise your approved reminder template is used (set the template name and language in Settings → Demo reminders).
From Bookings you can reschedule (old reminders are cancelled and recreated and the lead is notified), cancel, mark done or mark no-show. Select several chats to schedule all at once.
Bulk scheduler
Book a whole group into the same session at once — for example everyone attending Tuesday's webinar.
- Open Bulk demo scheduler and fill the session details once: product, date, time and join link.
- Upload a CSV of numbers (it only needs a
phonecolumn), or add one number at a time. - Click Upload & schedule all.
- Each person is added to your contacts and appears in the inbox.
- Everyone gets the confirmation plus the reminder ladder.
- The page shows scheduled, sent, delivered and read counts, today's bookings, and lets you retry failed sends.
phone
919876543210
919812345678
Connected to AI Voice Calling
When the AI caller gets a “yes” on a call, it sends the booking to /wa/api/enqueue_reminder.php with a shared secret, and the same confirmation and reminder ladder starts automatically.
Website WhatsApp button
Create a floating WhatsApp chat button for any website under Widgets:
| Setting | Options |
|---|---|
| WhatsApp number | The number visitors will chat with |
| Pre-filled message | Text already typed when the chat opens |
| Button text & colour | Your label and brand colour |
| Greeting bubble | A short greeting shown next to the button |
| Position | Bottom right or bottom left |
| Show delay | Seconds before the button appears |
Copy the snippet into your website. Changes go live within about 5 minutes.
<script src="https://yourdomain.com/wa/w.js?id=your-widget-slug" async></script>
All settings
| Section | Settings |
|---|---|
| General | Business name, auto-reply on/off and text |
| Notifications | Telegram bot token, chat ID, alert on inbound, test |
| AI reply suggestions | Anthropic API key, model, confidence threshold |
| AI bot | On/off, persona, daily cap per contact |
| Voice calls | Missed-call message, auto-reject calls |
| Demo reminders | Reminder template name and language |
| Spend estimate | Your per-message rates (marketing, utility, authentication) and GST % |
Dashboard & spend
The dashboard shows the lead pipeline, where leads came from, upcoming bookings, recent leads, account health (quality rating) and an estimated WhatsApp spend based on your per-message rates.
Troubleshooting
| Problem | Fix |
|---|---|
| Nothing arrives in the inbox | Run the subscribed_apps curl command; check the webhook and verify token |
| Messages queued but not sent | Check the worker cron is running every minute |
| Error 131049 | Meta's per-person marketing cap — not fixable by sending more |
| Reminders at the wrong time | Set timezone in config.php to your local time zone |
| A page shows error 500 | Open wa/error_log — the last lines name the file and line |
| “Table users doesn't exist” | Run the upgrade SQL for your version |
Known limits
- No self-service password reset — an admin sets passwords.
- No push notifications when the app is closed — Telegram covers this.
- Broadcast templates can't use
{{1}}variables yet. - Log tables grow over time and should be trimmed occasionally.
FAQ
| Question | Answer |
|---|---|
| Is it the official API? | Yes — Meta's WhatsApp Business Cloud API. |
| Limits on users or bots? | None. |
| Who pays for messages? | You pay Meta directly, at Meta's rates. |
| Can I use numbers from any country? | Yes. Always store numbers with the country code. |
Need help? Every purchase includes three months of support. Contact us and we'll walk you through it.