public class DialogflowApp
extends DefaultApp
Implementation of App for Dialogflow based webhook. Developers must extend this class if they are using Dialogflow (as against ActionsSDK) to handle requests. The DialogflowApp parses the incoming JSON request into an ActionRequest that encapsulates the JSON protocol between Dialogflow and your webhook as described here.
Note that the value of the @ForIntent annotation must match (case-sensitive) the name of the intent as defined in Dialogflow.
Usage:
class MyActionsApp extends DialogflowApp {
@ForIntent("welcome")
public CompletableFuture showWelcomeMessage(
ActionRequest request) {
ResponseBuilder builder = getResponseBuilder();
builder.add("some text");
// Intent handler implementation here.
}
Companion
Constructor and Description |
---|
DialogflowApp()
Implementation of App for Dialogflow based webhook. Developers must extend
this class if they are using Dialogflow (as against ActionsSDK) to handle
requests. The DialogflowApp parses the incoming JSON request into an
ActionRequest that encapsulates the JSON protocol between Dialogflow and
your webhook as described here.
|
Modifier and Type | Method and Description |
---|---|
ActionRequest |
createRequest(java.lang.String inputJson,
java.util.Map<?,?> headers)
Creates an ActionRequest for the specified JSON and metadata.
|
ResponseBuilder |
getResponseBuilder(ActionRequest request) |
createRequest, getErrorMsg_badReturnValue, getResponseBuilder, handleError, handleRequest, routeRequest
handleRequest
public DialogflowApp()
Implementation of App for Dialogflow based webhook. Developers must extend this class if they are using Dialogflow (as against ActionsSDK) to handle requests. The DialogflowApp parses the incoming JSON request into an ActionRequest that encapsulates the JSON protocol between Dialogflow and your webhook as described here.
Note that the value of the @ForIntent annotation must match (case-sensitive) the name of the intent as defined in Dialogflow.
Usage:
class MyActionsApp extends DialogflowApp {
@ForIntent("welcome")
public CompletableFuture showWelcomeMessage(
ActionRequest request) {
ResponseBuilder builder = getResponseBuilder();
builder.add("some text");
// Intent handler implementation here.
}
public ActionRequest createRequest(java.lang.String inputJson, java.util.Map<?,?> headers)
Creates an ActionRequest for the specified JSON and metadata.
inputJson
- The input JSON.headers
- Map containing metadata, usually from the HTTP request
headers.public ResponseBuilder getResponseBuilder(ActionRequest request)