- Home
- Skills
- Agents & Orchestration
- WhatsApp Cloud AI Handoff & Output Guardrails
WhatsApp Cloud AI Handoff & Output Guardrails
Meta WhatsApp HMAC verifier, currency-bound bot reply auditor, and SQLite WAL handoff state machine.
$15
WhatsApp Cloud AI Handoff & Output Guardrails
Example session with this skill installed
Audit this draft reply against our catalog: 'The USB-C Dock Pro (SKU-100) is currently in stock for $49.50.' I also need to verify this Meta webhook signature for the incoming message.
- Read your context and instructions
- Compiled the whatsapp cloud ai
I have performed the output audit and verified the webhook signature. The draft reply matches the ground-truth catalog price of 49.50 USD for SKU-100. The webhook signature verification was successful using the provided secret.
Audit and Verification Results
| Component | Status | Details |
|---|---|---|
| Output Audit | PASS | Price 49.50 USD matches catalog; SKU-100 is in stock. |
| Signature Check | VALID | X-Hub-Signature-256 matches raw payload bytes. |
| Idempotency | NEW | wamid is unique; no duplicate detected in 4s window. |
| State Machine | BOT_ACTIVE | No active human session; bot is authorized to reply. |
{
"audit_result": {
"status": "approved",
"sku": "SKU-100",
"detected_price": 49.50,
"currency": "USD",
"in_stock": true
},
"webhook_metadata": {
"verified": true,
"message_id": "wamid.HBgLMTU1NTEyMzQ1NjcVAgIGFhEzRjU2NzQ5RUJBNkQzRjQ2AA==",
"sender": "15551234567"
}
}
Next steps
- Dispatch the approved reply to the WhatsApp Cloud API
messagesendpoint. - Commit the
wamidto the localinboxtable to prevent retry duplicates. - Update the 4-second debounce timer for sender
15551234567.
Connects securely to your tools. The creator never sees your data.
About this skill
Integrating LLMs with the WhatsApp Business Cloud API often results in double-replies during webhook retry storms and expensive price hallucinations. This skill implements a strict three-layer Deterministic Sandwich architecture to ensure webhooks are verified, messages are deduplicated, and bot outputs are audited against real catalog data before delivery.
What it does
- HMAC Verification validates Meta
X-Hub-Signature-256headers usingcompare_digestto prevent unauthorized webhook injection. - Idempotency Control uses SQLite WAL and atomic
wamidclaiming to stop duplicate replies during provider retry storms. - Burst Debouncing consolidates rapid-fire messages into a single agent turn using a 4-second idle window.
- Output Guardrails audits candidate LLM replies against
Decimalcatalog prices and stock counts to block delivery of hallucinated quotes. - Handoff Orchestration enforces a fail-closed state machine that locks out the bot when a human operator is active.
How it works
- Verify Webhooks using the
verify_meta_webhook.pyscript to sign and validate synthetic or live Meta payloads. - Audit Output by running
audit_bot_reply.pyagainst a local catalog JSON to ensure the LLM hasn't drifted from ground-truth pricing. - Manage State by implementing the provided SQLite patterns to track
HUMAN_PENDINGandHUMAN_ACTIVEconversation locks.
Frameworks & tools
Built for Python 3.10+ using only the standard library and SQLite for maximum portability. Optimized for FastAPI raw-body handling and LLM-agnostic integration.
Why this beats prompting it yourself
LLMs cannot reliably perform HMAC verification or atomic database operations, and system prompts frequently fail to prevent price hallucinations under pressure. This skill offloads critical security, idempotency, and financial accuracy tasks to deterministic code that fails closed if the LLM errs.
Use cases
- Preventing bots from quoting incorrect prices or out-of-stock items in WhatsApp commerce flows.
- Stopping duplicate bot responses caused by Meta's aggressive webhook retry logic.
- Building a reliable human-in-the-loop takeover system for customer support.
Known limitations
Requires access to raw HTTP request bytes for signature verification. Database deduplication requires a persistent SQLite volume or equivalent ACID store.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 8 days ago
- Software
Python 3.10+
Permissions
What's inside
Frequently Asked Questions
New in Agents & Orchestration
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Agents & Orchestration.