简体   繁体   中英

How to enable fulfillment webhook for Intent using java client in Dialogflow

I have written below code to set intent using java code. Its woorking fine. Now I want to enable webhook fulfillment for this intent however I am not able to find any method for that. Can someone help me with it.

Intent intent =
          Intent.newBuilder()
              .setDisplayName(displayName)
              .addMessages(message)
              .addAllTrainingPhrases(trainingPhrases)
              .build();

To enable the webhook fulfillment in the intent, you can add setWebhookState(int value) and set the value to 1 . See reference for int values of enable webhook state.

public static final Intent.WebhookState WEBHOOK_STATE_ENABLED
Webhook is enabled in the agent and in the intent.

  • WEBHOOK_STATE_ENABLED = 1;

You code will look something like this:

Intent intent =
          Intent.newBuilder()
              .setDisplayName(displayName)
              .addMessages(message)
              .addAllTrainingPhrases(trainingPhrases)
              .setWebhookState(value) // value = 1
              .build();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM