How to extract parameters from Dialogflow response with Formulas

In many occasions we want to get information from Dialogflow response, like the name of the intent triggered or the confidence. Here is a list of different ways to extract in a simple way with Formulas all this information:

Output Context Name

If the variable we use in the Dialogflow block is @df_outputcontext:

The Formula to store the value in the variable @outputcontext will be:

GetValue(Split(GetValue(@df_outputcontext, 0, "name"),"/"),6)

Payload - Custom Payload

If the variable we use in the Dialogflow block is @df_payload:

And in Dialogflow, for example, our set up is the following:

The Formula to store the value in the variable @df_payload_param will be:

GetValue(@df_payload, 0 ,"param")

Query Response - Intent Name

If the variable we use in the Dialogflow block is @query_response:

The Formula to store the value in the variable @intent_name will be:

GetValue(@query_response, "intent", "displayName")

Query Response - Intent Detection Confidence

If the variable we use in the Dialogflow block is @query_response:

The Formula to store the value in the variable @confidence will be:

GetValue(@query_response, "intentDetectionConfidence")

Query Response - Language Code

If the variable we use in the Dialogflow block is @query_response:

The Formula to store the value in the variable @language_code will be:

GetValue(@query_response, "languageCode")

Brick - Dialogflow Params V0.1

You can also import this Brick with the formulas already built, bear in mind to adapt the name of the variables to your needs:


How did we do?


Powered by HelpDocs

Powered by HelpDocs