0

I'm trying to build a chatbot with DialogFlow CX. We have an existing chatbot built on DF ES where with the help of contexts we have implemented a resume chat feature, which enables our end users to come back to the chat anytime and continue from where they left off. So currently we are building out the exact same bot in CX and we are facing challenges in recreating the resume chat flow.

So any help regarding how to to do this will be really helpful.

Thanks in advance

  • You can continue a conversation using the [session](https://cloud.google.com/dialogflow/cx/docs/concept/session) which stays active for 30m. In any case, could you provide more details of what you already implemented and would like to replicate. What have you tried so far? – Ksign Jun 16 '21 at 13:29
  • @Ksign I read about the 30minute timeout on the session, so currently, in Dialogflow ES we have implemented a chat flow and since its majorly controlled by contexts what we used to do is we would create a session and recreate the required contexts which would help us continue the chat from where the user left off. This had no time-bound to it as the user can resume the chat even after 24hours. We have implemented the same flow in CX and I'm trying to recreate the same resume chat flow without the 30minutes time-binding. – Vasuki Vardhan Jun 16 '21 at 14:31
  • I tried adding a decider page based on parameters being set to switch to the required page to continue the chat. But we have a set of list parameters and adding comparators on the array is proving to be challenging. We are trying to avoid going through the custom fulfilment route. – Vasuki Vardhan Jun 16 '21 at 14:34
  • I assume that, in ES, you have used fulfillment to achieve this by recreating a copy of the session when the user comes back, right? You will probably need the same approach in CX. Did you try something already? Do you have any snippet of code to share so we have a better insight? The best thing would be some minimal reproduction scenario for ES so we can try to achieve the same for CX. – Ksign Jun 27 '21 at 05:00
  • Is there any way to reset session within 30 min time? lets say if any case it 'll crash the flow how can we end the session in cx? – Oshini Sep 19 '21 at 18:47

1 Answers1

0

Dialogflow CX conversation (session) can be described and visualized as a state machine, configured to collect information or parameters from the end-user. This information is relevant to the conversation state on that page. Please be noted that for each conversational turn, the current page will either stay the same or transition to another page. This also applies for resuming or continuing the current state of the conversation.

Here are possible ways to continue/resume a conversation by passing previously collected customer data from a previous conversation into a new conversation:

  1. You can create a custom implementation using a webhook wherein a function will store the parameter and forms you collected and use that to continue the chat from where the user left off during a conversation flow or a session. In the webhookResponse you can set the fulfillment_response, target_page fields and session_info field to update and send back the stored parameters you collected from the previous conversation.

    Here’s an example of how to pass the session parameter, target page and fulfillment response from your webhook response:

    {
       sessionInfo: {
           parameters: {
               param1: {
                 value: "sample1"
               }
           }
       },
      targetPage: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>/pages/<Page ID>,
      fulfillment_response: { 
           messages: [{ 
             text: [“This is where you left”],
           }] 
       } 
    }
    
  2. You can use APIs or Client Libraries to set the queryParams.parameters and queryParams.currentPage in the detectIntent method.

    Here’s a sample reference using REST API to set the QueryParameters of the detectIntent method request body:

     {
        queryParams: {
            parameters: {
                  param1: {
                    value: "sample1"
                  },
        currentPage: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>/pages/<Page ID>,
            }
         }
    
     }
    
Jessica Rodriguez
  • 2,899
  • 1
  • 12
  • 27