Hi,
I am trying to connect RASA with Google Assistant as mentioned in the blog Going beyond ‘Hey Google’: building a Rasa-powered Google Assistant
I deployed my Google assistant skill in the Google Actions. While testing its always saying “Place Finder isn’t responding right now. Try again soon”
from rasa_core.utils import EndpointConfig input_channel = GoogleConnector() nlu_interpreter = RasaNLUInterpreter(model_directory) action_endpoint = EndpointConfig(url=“http://localhost:5055/webhook”) agent = Agent.load(‘models/dialogue’, interpreter=nlu_interpreter,action_endpoint=action_endpoint) agent.handle_channels([input_channel], 5004, serve_forever=True)
i getting this error:
ERROR:flask.app:Exception on /webhooks/google_home/webhook [POST] Traceback (most recent call last): File “c:\users\lenovo\appdata\local\programs\python\python35\lib\site-packages\flask\app.py”, line 2292, in wsgi_app response = self.full_dispatch_request() File “c:\users\lenovo\appdata\local\programs\python\python35\lib\site-packages\flask\app.py”, line 1815, in full_dispatch_request rv = self.handle_user_exception(e) File “c:\users\lenovo\appdata\local\programs\python\python35\lib\site-packages\flask\app.py”, line 1718, in handle_user_exception reraise(exc_type, exc_value, tb) File “c:\users\lenovo\appdata\local\programs\python\python35\lib\site-packages\flask_compat.py”, line 35, in reraise raise value File “c:\users\lenovo\appdata\local\programs\python\python35\lib\site-packages\flask\app.py”, line 1813, in full_dispatch_request rv = self.dispatch_request() File “c:\users\lenovo\appdata\local\programs\python\python35\lib\site-packages\flask\app.py”, line 1799, in dispatch_request return self.view_functionsrule.endpoint File “”, line 23, in receive payload = json.loads(request.data) File “c:\users\lenovo\appdata\local\programs\python\python35\lib\json_init_.py”, line 312, in loads s.class.name)) TypeError: the JSON object must be str, not ‘bytes’ 127.0.0.1 - - [2019-06-02 11:46:42] “POST /webhooks/google_home/webhook HTTP/1.1” 500 411 0.028898
Below is the Connector code:
class GoogleConnector(InputChannel):
@classmethod
def name(cls):
return "google_home"
#def __init__(self):
# self.out_channel = CustomOutput(url, access_token)
def blueprint(self, on_new_message):
google_webhook = Blueprint('google_webhook', __name__)
@google_webhook.route("/", methods=['GET'])
def health():
return jsonify({"status": "ok"})
@google_webhook.route("/webhook", methods=['POST'])
def receive():
payload = json.loads(request.data)
sender_id = payload['user']['userId']
intent = payload['inputs'][0]['intent']
text = payload['inputs'][0]['rawInputs'][0]['query']
if intent == 'actions.intent.MAIN':
message = "<speak>Hello! <break time=\"1\"/> Welcome to the Rasa-powered Google Assistant skill. You can start by saying hi."
else:
out = CollectingOutputChannel()
on_new_message(UserMessage(text, out, sender_id))
responses = [m["text"] for m in out.messages]
message = responses[0]
r = json.dumps(
{
"conversationToken": "{\"state\":null,\"data\":{}}",
"expectUserResponse": 'true',
"expectedInputs": [
{
"inputPrompt": {
"initialPrompts": [
{
"ssml": message
}
]
},
"possibleIntents": [
{
"intent": "actions.intent.TEXT"
}
]
}
]
})
return r
return google_webhook
My actoin.json is
{ “actions”: [ { “description”: “Default Welcome Intent”, “name”: “MAIN”, “fulfillment”: { “conversationName”: “welcome” }, “intent”: { “name”: “actions.intent.MAIN”, “trigger”: { “queryPatterns”:[“talk to Place Finder”] } } }, { “description”: “Rasa Intent”, “name”: “TEXT”, “fulfillment”: { “conversationName”: “rasa_intent” }, “intent”: { “name”: “actions.intent.TEXT”, “trigger”: { “queryPatterns”:[] } } }], “conversations”: { “welcome”: { “name”: “welcome”, “url”: “https://b6938789.ngrok.io/webhooks/google_home/webhook”, “fulfillmentApiVersion”: 2 }, “rasa_intent”: { “name”: “rasa_intent”, “url”: “https://b6938789.ngrok.io/webhooks/google_home/webhook”, “fulfillmentApiVersion”: 2 } } }
Can anyone please help me?
Thanks in advance.