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.

HI @Juste is there any updated posts relating to the new gactions cli and online builder? There is no gactions text or gactions update commands anymore, and a gactions init appears to create a completely different project structure. I’ve been trying to follow the general idea but create a connection in this new google actions environment and I cannot work out how to create the actions.intent.TEXT without warnings of no training phrases. Any pointers appreciated.

Hi @davemac . Following the updates of other tools is always a challenge. Thanks for pointing this out! I’ll have a look and see if we can introduce and update to the tutorial.

take a look here Google Actions CLI 3.1.0 version and actions.intent.TEXT - Stack Overflow to see the answer

@Juste blank_template.zip|attachment](upload://cRUgbkuOKbFlaTXeaA25j6aGexC.zip) (13.9 KB) Here is a blank template, created using the above method in AoG and then pulled into local dev via gactions cli. Create a new blank, custom actions project. Get the Project Id and edit the files where it says HERE with your project details, and then use gactions push in your terminal to update your project. The only complaint should be the missing icon.