Search code examples
dialogflow-es

DialogFlow: simple ways of passing parameters between intents and from previous context to the current context? (Without using fullfillment)


Hi I’m look in for simple solutions for passing values between intents and contexts.

I’ve tried to set output context (c1) for intent A, and use c1 as input context for intent B. However, I’m not able to access the parameters value within intent B. Do I have to use fullfillment to implement this ?

Besides, I also want to use the previous parameters’ value of intent A when intent A is triggered next time. Again, can we do this without using fullfillment?

If fullfillment is essential, can you give some guidance please?


Solution

  • Accessing parameter values from one intent to another where contexts are used can be done from the Console itself. Fulfillment Webhook response can also be used but for your use case this can be done from the Console itself.

    You can refer to the below replication steps:

    • In the text response of Default Welcome Intent add Hi what is your name? and add an output context awaiting_name.

    enter image description here

    • Create another Intent Get Name and in that pass “awaiting_name” as input context . Pass some training phrases like "john,sandeep,jacob" and map it with them to the @sys.given.name entity.
    • In the Get Name Intent the text response is Ok $name, what is your email address?. Add awaiting_email in the output context field of this intent.

    enter image description here

    enter image description here

    • Create another intent “Get Email” and add awaiting_email in the Input context. Add training phrases like "sandeep@abc.com","john@xyz.com" and map them with @sys.email entity.

    enter image description here

    • When you want to fetch the parameter value from another intent to the present intent where context is used you need to call it by #context-name.parameter-name as per this doc.
    • My final output response is Thanks #awaiting_name.name we will contact you soon on $email

    enter image description here