Dialogflow CX with Cloud functions

793 views
Skip to first unread message

Warissara C.

unread,
Jul 2, 2021, 12:29:23 PM7/2/21
to Dialogflow CX Edition users
Hi! 

According to the Dialogflow ES, we can use app.intent() in the inline editor to go to the parameters at specific intent. So, for Dialogflow CX, how can I extract the parameters at specific page in the cloud function? Instead of using intent name..

Dialogflow CX
app.intent('intent name', (conv, {name}) => {
conv.close(`Alright, your silly name is ${name}! `
});

Mark Jonathan Pagatpat

unread,
Jul 2, 2021, 7:57:15 PM7/2/21
to Dialogflow CX Edition users
You can get page parameters in your webhook service from the webhook request json body depending on where they are extracted from.

1. If the parameters are extracted as Intent parameters, you can retrieve them from the webhookRequest.intentInfo.parameters.<parameter-id>.resolvedValue json body:
{
    intentInfo : {
      parameters: {
        param1: {
          originalValue: "sample1"
          resolvedValue: "sample1"
        }
      }
    }
}
Here’s a sample webhook code using Node.js extracting the resolved value of the “param1” parameter:
let yourParameter = request.body.intentInfo.parameters.param1.resolvedValue;
Note that you would need to enable webhook for the Route that extracts the Intent parameters.

2. If the parameters are extracted as Form parameters, you can retrieve them from the webhookRequest.pageInfo.formInfo.parameterInfo[] json body:
{
    pageInfo : {
      formInfo: {
        parameterInfo: [
          {
            displayName: "param2"
            value: “sample2”
          }
        ]
      }
    }
}
Here’s a sample webhook code using Node.js extracting the value of the “param2” parameter:
let yourParameter = request.body.pageInfo.formInfo.parameterInfo[0].value;
Note that you would need to enable webhook for the Form parameter.

3. Intent and Form parameters are also written to the session and become Session parameters.
You can get Session parameters from the webhookRequest.sessionInfo.parameters.<parameter-id> json body:
{
    sessionInfo : {
      parameters: {
        param3: "sample3”
      }
    }
}

Here’s a sample webhook code using Node.js extracting the value of the “param3” parameter:
let yourParameter = request.body.sessionInfo.parameters.param3;

Warissara C.

unread,
Jul 5, 2021, 10:34:42 AM7/5/21
to Dialogflow CX Edition users
Thank you so much.

I can use it now with session parameters. It works!

Reply all
Reply to author
Forward
0 new messages