From 60688f4e831a3a47dbbbfc52865e1408a915097b Mon Sep 17 00:00:00 2001 From: Filippo Romani Date: Fri, 13 Sep 2024 18:19:18 +0200 Subject: [PATCH] Update __init__.py --- whatsapp/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/whatsapp/__init__.py b/whatsapp/__init__.py index d60d27b..c83e9f3 100644 --- a/whatsapp/__init__.py +++ b/whatsapp/__init__.py @@ -331,8 +331,8 @@ def mark_as_read(self) -> dict: logging.error(response.json()) return response.json() - def send(self,sender, preview_url: bool = True) -> dict: - print(sender) + def send(self,sender = None, preview_url: bool = True) -> dict: + try: sender = dict(self.instance.l)[sender] print(self.instance.l) @@ -344,6 +344,9 @@ def send(self,sender, preview_url: bool = True) -> dict: except: print(22) sender = self.instance.phone_number_id + + if sender == None: + sender = self.instance.phone_number_id url = f"https://graph.facebook.com/v18.0/{sender}/messages" data = {