green-api / issues

11 stars 0 forks source link

whatsapp-chatbot-python:ERROR:'NoneType' object has no attribute 'lower' #569

Closed srmbackisdeveloper closed 1 month ago

srmbackisdeveloper commented 1 month ago

Hi. I am getting this error because my notification.message_text is lost. Showing Nonetype. Getting this error for any of the string methods.

Please, could you guide me on this and show possible cases to solve?

Info: I am using: whatsapp-chatbot-python library - https://github.com/green-api/whatsapp-chatbot-python

dephea commented 1 month ago

Hello! notification.message_text will look through a webhook to get parameters like "textMessage" or "extendedTextMessage". Some types of webhooks do not have these parameters, for example VideoMessage. That's why I recommend you to handle the case if notification.message_text would be null. Also, since the whatsapp-chatbot-python is using ReceiveNotification loop under the hood to retreive incoming messages, you can use the ReceiveNotification method yourself to see what message was not proccessed and make according fixes in your implementation of the bot.