Rishi Saraf
Rishi Saraf

Reputation: 1812

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();

Upvotes: 0

Views: 101

Answers (1)

Ricco D
Ricco D

Reputation: 7287

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();

Upvotes: 1

Related Questions