One Async Python AI Agent Across WhatsApp, Messenger, and Instagram - Without SaaS Middlemen A developer published meta-agent-bridge v0.1.0, an async, MIT-licensed Python 3.12+ SDK that lets a single AI agent handle WhatsApp, Facebook Messenger, and Instagram DMs through one canonical schema instead of per-channel glue code or a paid SaaS messaging middleman. The library normalizes Meta's divergent webhook payloads into sans-I/O AgentMessageEvent and AgentStatusEvent objects, verifies X-Hub-Signature-256 with HMAC-SHA256, and compiles channel-neutral AgentResponse objects into per-platform send plans over a shared httpx.AsyncClient. The author stress-tested it against live Meta Graph API v27.0 traffic with a FastAPI tool-calling sales and support agent behind a single /webhook route. If you've ever tried to put a Python AI agent onto WhatsApp, Facebook Messenger, and Instagram DMs , you know the pain starts after the LLM works. The agent logic itself is the easy part. The hard part is that Meta's messaging surfaces look similar on the surface, yet behave like four completely different platforms underneath: entry .changes .value.messages , introduces from user id bsuid alongside phone numbers, splits interactive replies into 1–3 reply buttons vs. 4–10 list rows, and couples mark read + typing indicator in one call. entry .messaging , routes by PSID , uses quick replies up to 13 and sender action , and caps text at 2,000 characters. graph.facebook.com/{page id}/messages vs. graph.instagram.com/{ig account id}/messages , with a 1,000-character limit and strict media/choice separation. Most teams end up either paying a SaaS messaging middleman per message or writing fragile if channel == "whatsapp": ... elif channel == "messenger": ... glue code across every webhook and worker. So I built and published meta-agent-bridge https://pypi.org/project/meta-agent-bridge/ v0.1.0 , Python 3.12+, MIT — an async, agentic-first SDK that lets one AI agent speak to all four Meta surfaces through a single canonical schema. To stress-test v0.1.0 end-to-end against real Meta Graph API v27.0 traffic not mocks , I wired up a NovaGear Sales & Support AI agent powered by FastAPI + a tool-calling LLM search products , lookup order , create support ticket behind a single /webhook route. Here is the exact same prompt — "What laptops do you have in stock?" — plus interactive button taps running live across all three platforms: graph.instagram.com Login Flow uvicorn Logs Look at the server trace: every channel hits the same /webhook endpoint, verifies X-Hub-Signature-256 , deduplicates event id , dispatches MARK READ + TYPING ON + reply 200 OK , and cleanly processes sent / delivered / read status webhooks: meta-agent-bridge Is Designed php flowchart TD Meta "Meta Platforms WhatsApp / Messenger / Instagram " -- |"POST /webhook + X-Hub-Signature-256"| FastAPI "FastAPI Webhook Route" FastAPI -- |"bridge.parse webhook "| Verify "HMAC-SHA256 Verify & Surface Detect core/crypto " Verify -- Drivers "Channel Drivers whatsapp.py / meta messaging.py " Drivers -- |"Inbound Message"| MsgEvt "AgentMessageEvent JSON-serializable, sans-I/O " Drivers -- |"Sent / Delivered / Read"| StatusEvt "AgentStatusEvent" Drivers -- |"Echo / Reaction / Unknown"| UnknownEvt "UnknownEvent safe fallback " MsgEvt -- |"Optional media id or URL"| Media "bridge.media MediaDownloader " MsgEvt -- Agent "AI Agent LLM + Tools " Media -- Agent Agent -- |"Channel-neutral AgentResponse"| Compile "bridge.compile core/compiler + capabilities " Compile -- Plan "CompiledPlan ActionStep / TextStep / MediaStep / ButtonsStep " Plan -- |"bridge.send plan + per-call SecretStr"| Transport "GraphTransport shared httpx.AsyncClient " Transport -- |"WhatsApp / Messenger / IG FB"| FB "graph.facebook.com/v27.0" Transport -- |"IG Direct Login"| IG "graph.instagram.com/v27.0" Four architectural choices make it safe for real agent workloads: AgentEvent / AgentResponse button reply or a Messenger quick reply , your agent receives an AgentMessageEvent with a normalized interactive reply and returns a plain AgentResponse text=..., choices= Choice ... , , actions= SenderAction.MARK READ, SenderAction.TYPING ON . core/ bridge.parse webhook and bridge.compile have httpx or network imports schema version="1.0" , deterministic event id for deduplication with no .reply method or bound HTTP client — serialize them straight to Redis, Celery, or FastAPI BackgroundTasks . httpx.AsyncClient across all tenants and channels. GraphTransport binds Authorization: Bearer ... and base url graph.facebook.com vs. UnknownEvent Resilience echo message , emoji reactions, and new webhook fields constantly. Instead of raising a ValidationError and dropping your queue, raw preserved. Here is the actual /webhook route running in the live test above: And inside your agent worker, there is zero channel-specific formatting: python from meta agent bridge import AgentMessageEvent, AgentResponse, Choice, SenderAction async def handle message event: AgentMessageEvent - AgentResponse: Run your LLM / LangGraph / PydanticAI / tool-calling loop here return AgentResponse text="In stock: NovaBook Pro 14 $1,499 and NovaBook Air 13 $999 .", choices= Choice id="compare laptops", title="Compare Laptops" , Choice id="track order", title="Track Order" , , actions= SenderAction.MARK READ, SenderAction.TYPING ON , reply to message id=event.message id, When bridge.compile response, event.target, creds runs: MARK READ + TYPING ON , renders interactive reply buttons or a list menu if 4–10 choices , and routes via phone or Testing against live Meta apps caught real-world quirks that mocks miss: POST /{waba id}/subscribed apps before Meta forwards inbound messages. v27.0 already sends PK.2438501963353892 in live payloads — TenantTarget . reply text and use choices strictly for follow-up actions. uv add meta-agent-bridge or pip install meta-agent-bridge examples/nvidia sales agent/ : If you're building AI agents on WhatsApp, Messenger, or Instagram, give it a try — issues, PRs, and feedback on v0.2.0 templates, URL buttons, reactions are very welcome