From 7189f30fad54312b2e10615d7454d76f2b56dae7 Mon Sep 17 00:00:00 2001 From: Justin Skywork Date: Mon, 23 Mar 2026 19:55:33 -0400 Subject: [PATCH] feat: implement WhatsAppCloudBot integration #149 --- .../integrations/whatsapp/WhatsAppCloudBot.py | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 bindu/integrations/whatsapp/WhatsAppCloudBot.py diff --git a/bindu/integrations/whatsapp/WhatsAppCloudBot.py b/bindu/integrations/whatsapp/WhatsAppCloudBot.py new file mode 100644 index 00000000..db583a90 --- /dev/null +++ b/bindu/integrations/whatsapp/WhatsAppCloudBot.py @@ -0,0 +1,23 @@ +import requests +import os + +class WhatsAppCloudBot: + """ + WhatsApp Cloud API Integration for Bindu Agents. + Enables agents to interact with users directly via WhatsApp. + """ + def __init__(self): + self.api_url = "https://graph.facebook.com/v17.0" + self.access_token = os.getenv("WHATSAPP_TOKEN") + self.phone_number_id = os.getenv("WHATSAPP_PHONE_ID") + + def send_message(self, to, text): + url = f"{self.api_url}/{self.phone_number_id}/messages" + headers = {"Authorization": f"Bearer {self.access_token}"} + payload = { + "messaging_product": "whatsapp", + "to": to, + "type": "text", + "text": {"body": text} + } + return requests.post(url, headers=headers, json=payload)