dialogflow-esdialogflow-cxvoximplant

Access Dialog flow Context Variables in Vox implant, I have some parameters set in the dialog flow. I want to access those in Vox implant engine


My question is how can I access the parameters that are sent by dialog flow over the conversation? For example, When live agent hand off is done. I want to transfer to specific phone numbers which will come from dialog flow. In short, How Can I access a parameter in Vox engine for dialog flow CX integration ? enter image description here


Solution

  • liveAgentHandoff value is included in the response to Voximplant and your parameters will be available in the metadata field: https://cloud.google.com/dialogflow/cx/docs/reference/rpc/google.cloud.dialogflow.cx.v3#google.cloud.dialogflow.cx.v3.ResponseMessage.LiveAgentHandoff

    Here's the code sample on how to recognize a liveAgentHandoff request in Voximplant scenario

    let number;
    conversationParticipant.addEventListener(CCAI.Events.Participant.Response, (e) => {
      if (e.response.automatedAgentReply?.responseMessages) {
        e.response.automatedAgentReply.responseMessages.forEach((response) => {
          if (response.liveAgentHandoff) { 
          transfer = true; 
          number = response.liveAgentHandoff.metadata.phoneNumber;
          Logger.write('###### LiveAgentHandoff being triggered: ' +   JSON.stringify(response));
          }
        })
      }
    });