0
votes

I am using Dialogflow with a custom server as backend server, sending JSONs once in a while for fulfilment.

As an example, I want to make a very simple login in my system. For that, I have an intent, "session.login", that has one required parameter, namely username: login-intent

That intent has fulfilment enabled, and my backend simply checks if the given parameter username exists in a database, and then either forwards (using a followup-event) to another intent "login-failed", or "login-success": {"followupEventInput": {"name": "login-failed", "languageCode": "en"}}.

This all works so far, but now I simply want this intent to be able to say something like "hello, $username": enter image description here

However I don't manage to do this, as the parameter username seems to be gone by then. When I try the code as given above, Actions on Google fails, meaning my bot leaves the conversation and I get the error MalformedResponse expected_inputs[0].input_prompt.rich_initial_prompt: 'rich_response' must contain at least one item.

I tried sending the information about the parameter back from my fulfilment server, such that my new response forwarding me to the session.login.success intent would look like this: {'outputContexts': [{'lifespanCount': 5, 'name': 'projects/MY_AGENT/MY_SESSION/contexts/login-incomplete', 'parameters': {'username': 'aron'}}], 'followupEventInput': {'languageCode': 'en', 'name': 'login-success'}}, but this doesn't help either.

If anybody has any help on how to do this that would be great, thanks!

1

1 Answers

0
votes

Figured it out myself.

First of all, I don't need to set a new parameter at all, and just need to use the #oldcontext.oldparameter in my response, and secondly, if one dereferences from a context, there's no need for the dollar-sign anymore:

enter image description here