Configure your Bot for BDK 2.0 for Java
This section requires
npm
(Node Package Manager) to be installed on your local machine as a prerequisite.The Symphony Generator offers a fast way to bootstrap your Symphony BDK 2.0 project in several languages, including Java.
For all Symphony BDK 2.0 applications, you should start with the Symphony Bot Generator. As part of the below steps we will also be installing Yeoman which is a project scaffolding framework utility.
$ npm i -g yo @finos/generator-symphony
$ mkdir botProject && cd botProject
$ yo @finos/symphony
This will prompt you with a number of questions about your bot and Pod configuration. Type in your bot's metadata, use arrows to scroll, and press enter to move on to the next prompt:
$ yo @finos/symphony
__ __ ___ _
\ \ / /__ / __|_ _ _ __ _ __| |_ ___ _ _ _ _
\ V / _ \ \__ \ || | ' \| '_ \ ' \/ _ \ ' \ || |
|_|\___/ |___/\_, |_|_|_| .__/_||_\___/_||_\_, |
|__/ |_| |__/
https://developers.symphony.com
Welcome to Symphony Generator v2.6.0
Application files will be generated in folder: /Users/Development/bdk-sample-bot
______________________________________________________________________________________________________
? Enter your pod host develop2.symphony.com
? Enter your bot username bdk-sample-bot
? Select your type of application Bot Application
? Select your programing language Java
? Select your framework Java (no framework)
? Select your build system Maven
? Enter your project groupId com.symphony
? Enter your project artifactId bot-application
? Enter your base package com.symphony.bdksamplebot
Generating RSA keys...
...
-----BEGIN RSA PUBLIC KEY-----
MIICCgKCAgEAlToybEs8ovplnlYCrmVp9l81GAUC+JxK2RIjMleQS2giH/9EHuwlmskgp40Z
QcFXQvaXdryo8ftPoZS32KdcvB7kbC0eX1nltPRHic+e/fQAu4N1A0hTQGd8kGQ3CUabNOeN
VsahEj7P2OrIfsN4+5kOEV5JHIA1kSsB/csLETAyDuMPoGqEE7Nm8MMlO/74WezG7R8EmIlH
HnOlz9qtaZH4SOCrMTj7mY0zy3HtYztnBcAPuclbaHoQWkh05EdSE2j4SjlZpNe9aD9gSjLQ
3dYmTfrQZMC8Dqlfm2yDG5jr78jUY9sXPAM8UThjl2i4YrnH6kH5kj1tujn4RaF++tzU1uVJ
W30HEi6hzVsnbUfvv1qEo5v8AZYc91TN6tLMuClGz4h7RmejX3yRBYV90csaqhyvJQlBLR/r
RAo6mv+7PaAK5rPvZVbH1ogW1UBQnYaGfCu4OxAWTXNnUO9g6yuVr3LVxsLlpEkltNj9Hn60
YD9i/FwNKtxsPja0vQXxqrmaNAHZkSbhVsRPaZZArBSnSbEWyNoE+GN26D5rWtK9ubjDzD0e
6G4FrGZeX/oyYb1BhmgQ3WRddEzF8y0cltzuckVnPJY0jEc3THhmOPZfNjwiONlVeHOPP8qk
aRby39IdyszVeVTbNlq727vxCJFzzUxx8VpaSlB0P3byypcCAwEAAQ==
-----END RSA PUBLIC KEY-----
Your Java project has been successfully generated !
This section will help you to understand how to create your bot application from scratch.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>symphony-bdk</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>symphony-bdk</name>
<description>Demo project for Symphony BDK</description>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.finos.symphony.bdk</groupId>
<artifactId>symphony-bdk-bom</artifactId>
<version>2.1.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- Core dependencies -->
<dependency>
<groupId>org.finos.symphony.bdk</groupId>
<artifactId>symphony-bdk-core</artifactId>
</dependency>
<dependency>
<groupId>org.finos.symphony.bdk</groupId>
<artifactId>symphony-bdk-http-jersey2</artifactId> <!-- or symphony-bdk-http-webclient -->
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.finos.symphony.bdk</groupId>
<artifactId>symphony-bdk-template-freemarker</artifactId> <!-- or symphony-bdk-http-handlebars -->
<scope>runtime</scope>
</dependency>
<!-- Logger Configuration -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>runtime</scope>
</dependency>
</dependencies>
</project>
plugins {
id 'java-library'
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
repositories {
mavenCentral()
}
dependencies {
// import a BOM
implementation platform('org.finos.symphony.bdk:symphony-bdk-bom:2.1.0')
// define dependencies without versions
implementation 'org.finos.symphony.bdk:symphony-bdk-core'
runtimeOnly 'org.finos.symphony.bdk:symphony-bdk-http-jersey2' // or symphony-bdk-http-webclient
runtimeOnly 'org.finos.symphony.bdk:symphony-bdk-template-freemarker' // or symphony-bdk-http-handlebars
// logger configuration
implementation 'org.slf4j:slf4j-api'
runtimeOnly 'ch.qos.logback:logback-classic'
}
Once you have your generated bot scaffold, the next step is to configure your bot user.
Ensure that your pod admin has created a corresponding service account on the admin portal of your Symphony Pod. Additionally, you must upload the generated RSA public key for the service account created.
Copy the entire contents of this RSA public key including the dashes on either side, and hand it to your pod admin and request for it to be saved against the respective service account you will be using.
Note: The bot username and bot email address entered to the Symphony Bot Generator must match exactly the Basic Information shown in the Pod above.

Before implementing any code, you need to navigate to your
src/main/resources/config.yaml
configuration file, and adjust it according to your Symphony environment. The following configuration file is generated by default:src/main/resources/config.yaml
host: develop2.symphony.com
bot:
username: bdk-documentation-bot
privateKeyPath: /bdk-documentation-bot/src/main/resources/rsa/privatekey.pem
Depending on your Symphony environment you may need to make, update and add additional values to your
config.yaml
file.Now that you have configured your Bot project using the BDK 2.0 and Symphony Bot Generator, checkout one of our dedicated BDK 2.0 tutorials: