Search code examples
pythondialogflow-cx

How to use webhook to transition from one page to another in Dialogflow CX


I am trying to make a bot that can book meeting rooms.

Flow is pretty simple so far:

Flow

From the check meetingroom availability page I want to transition to either a page called "ledig" if the desired meeting room is vacant or a page called "optaget" if the meetingroom is occupied. These pages are created, but not connected as I cannot figure out what response to return in order to get the condition right.

I have set up this python repl: https://repl.it/@KennethMundt/Webhook#main.py to play around. Currently it's returning text, which obviously is not correct. Returning a value parameter seems more like the right thing to do, but I just cannot figure out how.


Solution

  • This syntax for the weebhook (switch out "vacant" for whatever the page you want to transition to is called):

     jsonResponse = { 
      "session_info": 
      { 
        "parameters": 
        { 
          "transition_page": "Vacant" 
        } 
      } 
    };
    

    And something like this for the condition routing:

    Condition routing

    Edit: You are gonna have to deal with the bad formatting. For some reason I cannot get the insert code snippet to work properly