We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi, I think it would be easier to add more arguments to the function and not put everything in one dictonary. The function could look like this;
def send_interactive_list(self, recipient_id, body_text, button_text, sections, header_text=None, footer_text=None): interactive_dict = {} if header_text: interactive_dict["header"] = {"type": "text", "text": header_text} if footer_text: interactive_dict["footer"] = {"text": footer_text} if body_text: interactive_dict["body"] = {"text": body_text} interactive_dict["type"] = "list" interactive_dict["action"] = {} interactive_dict["action"]["button"] = button_text interactive_dict["action"]["sections"] = sections data = { "messaging_product": "whatsapp", "to": recipient_id, "type": "interactive", "interactive": interactive_dict, } logging.info(f"Sending buttons to {recipient_id}") r = requests.post(self.url, headers=self.headers, json=data) if r.status_code == 200: logging.info(f"Buttons sent to {recipient_id}") return r.json() logging.info(f"Buttons not sent to {recipient_id}") logging.info(f"Status code: {r.status_code}") logging.info(f"Response: {r.json()}") return r.json()
What are your thoughts?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi,
I think it would be easier to add more arguments to the function and not put everything in one dictonary.
The function could look like this;
What are your thoughts?
The text was updated successfully, but these errors were encountered: