this is the error i get when i try to use telegram app to chat with the chatbot that i create using rasa. all workes fine but when it reaches the custom action replay it states this error
Exception occurred while handling uri: 'http://bbf2-196-191-48-171.in.ngrok.io/webhooks/telegram/webhook'
Traceback (most recent call last):
File "handle_request", line 83, in handle_request
)
File "C:\Anaconda\envs\install_demo\lib\site-packages\rasa\core\channels\telegram.py", line 236, in message
if self._is_user_message(msg):
File "C:\Anaconda\envs\install_demo\lib\site-packages\rasa\core\channels\telegram.py", line 185, in _is_user_message
return message.text is not None
AttributeError: 'NoneType' object has no attribute 'text'
my custom action
from typing import Any, Text, Dict, List
from rasa_sdk import Action, Tracker
from rasa_sdk.executor import CollectingDispatcher
class ActionHelloWorld(Action):
def name(self) -> Text:
return "action_hello_world"
def run(self, dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
x=tracker.latest_message.get('text')
print(x)
text1=["yes","ya","ofcourse","sounds good","nice","cute","cool"]
text2=["no", "n","not really","not sure"]
if x in text1:
dispatcher.utter_message(text="well thanks for contacting us, see you next time")
elif x in text2:
dispatcher.utter_message(text="well till am build enough am sorry, see you then")
else:
dispatcher.utter_message(text="sorry i did not understand you")
return []
one funny thing is that when i use desktop telegram app it works fine but when someone else uses the bot from other platform like desktop or phone it throws this error, does anyone knows why?