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 = {