Google RASA connector issue - Getting Started with Rasa / Tutorials, Resources & Videos - Rasa Community Forum

Google RASA connector issue

post by ShivamBajpai on Jul 8, 2019

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)
    ```

3. used the ga_connector_updated file for google connector

4. Ran the run-app file successfully.

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

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

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

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

9. On google console , when I started testing it says, place finder doesn't 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'}}

### post by Juste on Jul 9, 2019

Hey [@ShivamBajpai](https://forum.rasa.com/u/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.

### post by Juste on Jul 9, 2019

Hey [@ShivamBajpai](https://forum.rasa.com/u/shivambajpai). The tutorial has just been updated. Give it a try and let me know if you still have any issues :)

### post by ShivamBajpai on Jul 11, 2019

Hey [@Juste](https://forum.rasa.com/u/juste) this works like charm now. I really appreciate your quick response :)

### post by saif on Sep 14, 2019

Hey [@Juste](https://forum.rasa.com/u/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.

### post by Juste on Sep 16, 2019

Hi [@saif](https://forum.rasa.com/u/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 :)

### post by saif on Sep 17, 2019

sure [@Juste](https://forum.rasa.com/u/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.

### post by davemac on Apr 11, 2021

HI [@Juste](https://forum.rasa.com/u/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.

### post by Juste on Apr 13, 2021

Hi [@davemac](https://forum.rasa.com/u/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.

### post by davemac on Apr 13, 2021

take a look here [Google Actions CLI 3.1.0 version and actions.intent.TEXT - Stack Overflow](https://stackoverflow.com/questions/67060437/google-actions-cli-3-1-0-version-and-actions-intent-text/67061271?noredirect=1#comment118542422_67061271) to see the answer

### post by davemac on Apr 19, 2021

[@Juste](https://forum.rasa.com/u/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.