Skip to content
New issue

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

Any way to handle incoming WA calls via bot.router webhooks? #36

Open
dimitrii9000 opened this issue Feb 20, 2024 · 3 comments
Open

Any way to handle incoming WA calls via bot.router webhooks? #36

dimitrii9000 opened this issue Feb 20, 2024 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@dimitrii9000
Copy link

No description provided.

@lent0s
Copy link

lent0s commented Feb 20, 2024

@dimitrii9000
Good afternoon!
To process incoming call notifications, you must enable the "incomingCallWebhook": "yes" option in the instance settings
You can get acquainted with the type of webhook notifications about calls here

@lent0s
Copy link

lent0s commented Feb 20, 2024

@dimitrii9000
At the moment, the bot does not have an incoming call handler. Clients can add it themselves. We will take your wishes into account and add this feature in future releases

@dimitrii9000
Copy link
Author

Thanks!
For any other interested parties, it's quite easy to add custom handler to handle calls

from whatsapp_chatbot_python.manager.observer import Observer


class WhatsappMessageHandler:
    def __init__(self, bot: GreenAPIBot):
        self.bot = bot
        self.bot.router.incoming_call = Observer(self.bot.router)
        self.bot.router.observers["incomingCall"] = self.bot.router.incoming_call

        @self.bot.router.incoming_call()
        def message_handler(notification: Notification) -> None:
            logging.info(notification.event)

@Amele9 Amele9 self-assigned this Mar 11, 2024
@Amele9 Amele9 added the enhancement New feature or request label Mar 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants