This is a sample of Bot Framework Direct Line API with Java.
You can use this sample after following below steps.
- Make a bot applicaton with Bot Framework and deploy on Azure App Service.
- Register your bot application at https://dev.botframework.com/, enable Direct Line API and get secret key of it.
- Edit BotDirectlineApp-Java/src/main/java/com/mydomain/App.java with your secret key.
You can get swagger.json from https://docs.botframework.com/en-us/restapi/directline3/#navtitle and generate Java codes for Direct Line API.
Run below commands in a folder including swagger.json.
wget https://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/2.1.4/swagger-codegen-cli-2.1.4.jar
java -jar swagger-codegen-cli-2.1.4.jar generate -i swagger.json -l java
After generating Java codes, there will be some malformed codes. Revise two classes.
Generated code is below.
@ApiModel(description = "Set of key-value pairs. Advantage of this section is that key and value properties will be
\n rendered with default style information with some delimiter between them. So there is no need for developer to specify style information.")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-11-25T17:39:24.796+09:00")
public class Fact {
Revised code is below.
@ApiModel(description = "Set of key-value pairs. Advantage of this section is that key and value properties will be rendered with default style information with some delimiter between them. So there is no need for developer to specify style information.")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-11-25T17:39:24.796+09:00")
public class Fact {
Generated code is below.
public Conversation conversationsStartConversation () throws ApiException {
Object postBody = null;
byte[] postBinaryBody = null;
Revised code is below.
public Conversation conversationsStartConversation () throws ApiException {
Object postBody = "";
byte[] postBinaryBody = null;