ENGINEERING
A WhatsApp assistant answered by your own gateway
Just activated iSol API? Your key lives in the customer portal, isollm.ai/account → API keys (the portal shows the raw sk-… value; store it in your secret manager). The endpoint for every guide on this blog is https://tokens.4clouders.com/v1, and per-key spend updates live on the same portal page. That is all you need to follow along.
Why WhatsApp + your own gateway
In Brazil, WhatsApp is the customer channel. Which is exactly why its AI assistant should not forward customer conversations to a vendor endpoint you cannot audit. The pattern is the same as every guide in this series: the messaging side stays standard (Meta Cloud API), and the intelligence comes from a gateway you control.
Step 1: WhatsApp side (Meta, once)
- Create an app at developers.facebook.com → add the WhatsApp product.
- From API Setup, note the
WHATSAPP_TOKENand theWHATSAPP_PHONE_ID(Meta gives you a test number to start). - Point the webhook at your server's
/webhookand subscribe tomessages.
Step 2: The webhook (complete)
import os, requests
from flask import Flask, request
app = Flask(__name__)
ISOL = "https://tokens.4clouders.com/v1/chat/completions"
KEY = os.environ["ISOL_API_KEY"]
WA_TOKEN = os.environ["WHATSAPP_TOKEN"]
PHONE_ID = os.environ["WHATSAPP_PHONE_ID"]
def ask_isol(text: str) -> str:
r = requests.post(ISOL, timeout=60,
headers={"Authorization": f"Bearer {KEY}"},
json={"model": "isol-4.9", "messages": [
{"role": "system", "content": "You are the company's WhatsApp assistant. Be brief and friendly."},
{"role": "user", "content": text}]})
r.raise_for_status()
return r.json()["choices"][0]["message"]["content"]
@app.post("/webhook")
def incoming():
change = request.json["entry"][0]["changes"][0]["value"]
for msg in change.get("messages", []):
if msg.get("type") == "text":
reply = ask_isol(msg["text"]["body"])
requests.post(
f"https://graph.facebook.com/v21.0/{PHONE_ID}/messages",
headers={"Authorization": f"Bearer {WA_TOKEN}"},
json={"messaging_product": "whatsapp", "to": msg["from"],
"type": "text", "text": {"body": reply}})
return "ok"
Step 3: Run one message through it, for real
Below, the handler processes a message exactly as Meta delivers it, and the reply comes back from the sovereign gateway, in Portuguese, ready to post to graph.facebook.com:

Gotchas we hit running this for real
- Answer the webhook fast. Meta retries on slow responses; for volume, queue the model call and return
okimmediately. - The 24-hour window. Outside it you must use approved templates, the assistant pattern works best replying inside active conversations.
- LGPD is the whole point. Customer messages are personal data; a sovereign gateway keeps the AI leg of that flow inside infrastructure you answer for.
Same gateway, rest of your stack: every guide with real sessions
The pattern: one gateway, every tool
Telegram
GitHub Actions
Teams
Claude Code
Cursor
VS Code
aider
OpenCode
n8n
Zapier
Power Automate
Power BI
Google Sheets
Website chatbot
Hermes Agent
Try it on ours
Our gateway (iSol API) runs exactly this setup on sovereign infrastructure, US$ 99/month, 14-day trial.