Google RASA connector issue

Hi Team,

I am going through the blog “Going beyond ‘Hey Google’: building a Rasa-powered Google Assistant” to connect my rasa bot with google assistant. However facing issues with latest rasa version. Please check below steps which I performed, after that facing one small issue in run-app file.

  1. trained the nlu and core model separately.
  2. Changed the imports and model path in run_app file as mentioned below

from rasa_core.interpreter import RasaNLUInterpreter from ga_connector_updated import GoogleConnector from rasa.utils.endpoints import EndpointConfig

action_endpoint = EndpointConfig(url=“http://localhost:5055/webhook”) nlu_interpreter = RasaNLUInterpreter(’./models/nlu’) agent = Agent.load(’./models/core’, interpreter = nlu_interpreter, action_endpoint=action_endpoint)

input_channel = GoogleConnector()

agent.handle_channels([input_channel], 5004)

  1. used the ga_connector_updated file for google connector

  2. Ran the run-app file successfully .

  3. ran this command >python -m rasa_core_sdk.endpoint --actions actions

  4. Exposed the port 5004 using ngrok and updated URL in action.json.

  5. When I ran this command with project Id - gactions update --action_package action.json --project sample-bot-b3759

  6. After running test command , gactions test --action_package action.json --project sample-bot-b3759

  7. On google console , when I started testing it says, place finder dosent exist and can see below logs in console

Exception occurred while handling uri: ‘http://5040971a.ngrok.io/webhooks/google_home/webhook’ Traceback (most recent call last): File “C:\Ana\lib\site-packages\sanic\app.py”, line 917, in handle_request response = await response File “C:\RASA\SampleBot\Demo\tutorial-rasa-google-assistant-master\tutorial-rasa-google-assistant-master\place_finder\ga_connector.py”, line 118, in receive sender_id = payload[‘user’][‘userId’] KeyError: ‘userId’

When I removed userId key in connector class,getting below exception

C:\Ana\lib\site-packages\rasa_core_init_.py:12: UserWarning: The ‘rasa_core’ package has been renamed. You should change your imports to use ‘rasa.core’ instead. UserWarning, Exception occurred in one of response middleware handlers Traceback (most recent call last): File “C:\Ana\lib\site-packages\sanic\app.py”, line 958, in handle_request request, response File “C:\Ana\lib\site-packages\spf\framework.py”, line 543, in _run_response_middleware _response = await _response File “C:\Ana\lib\site-packages\sanic_cors\extension.py”, line 266, in unapplied_cors_response_middleware set_cors_headers(req, resp, context, res_options) File “C:\Ana\lib\site-packages\sanic_cors\core.py”, line 248, in set_cors_headers if resp.headers is None: AttributeError: ‘str’ object has no attribute ‘headers’ Invalid response object for url b’/webhooks/google_home/webhook’, Expected Type: HTTPResponse, Actual Type: <class ‘str’> Exception occurred while handling uri: ‘http://###.ngrok.io/webhooks/google_home/webhook’ Traceback (most recent call last): File “C:\Ana\lib\site-packages\sanic\server.py”, line 417, in write_response response.output( AttributeError: ‘str’ object has no attribute ‘output’

Root cause - In request json there is no user Id , when we test through simulator

{‘user’: ‘locale’: ‘en-US’, ‘lastSeen’: ‘2019-07-08T12:37:40Z’, ‘userVerificationStatus’: ‘VERIFIED’}

Hey @ShivamBajpai. I am currently updating this tutorial, I will ping you once I pushed all the updated and resolved this issue. The response from Google Assistant indeed changed so the connector needs a few changes.

2 Likes

Hey @ShivamBajpai. The tutorial has just been updated. Give it a try and let me know if you still have any issues :slight_smile:

1 Like

Hey @Juste this works like charm now. I really appreciate your quick response :slight_smile:

1 Like

Hey @Juste i need to know how to add rich responses of google assistant while connecting with rasa. As rasa supports quick replies for facebook ui but when we use google assistant connector we have also rich responses like suggestion chips, Carousel Cards etc. so how to add these rich responses. Thanks in advance.

Hi @saif. I’ll have a look. If you happen to investigate this in more detail yourself, updating the connector would be a great contribution to Rasa :slight_smile:

sure @Juste i am also trying from my end and will update you soon . And also wanted to know how to handle context in rasa just like dailogflow . if you have any information regarding that please update . Thank You.