Set Up the Basic Bot Client

First, create an instance of the basic bot client.

1// Create a JWT Bearer authentication mechanism.
2AuthMechanism oAuth = JwtBearerOAuth.with()
3    .privateKeyFilePath(privateKeyFilePath)
4    .loginEndpoint(loginEndpoint)
5    .connectedAppId(connectedAppId)
6    .connectedAppSecret(secret)
7    .userId(userId)
8    .build();
9
10// Create a basic bot client.
11BasicChatbotClient client = ChatbotClients.basic()
12    .basePath(basePath)
13    .authMechanism(oAuth)
14    .build();

The basePath is the runtime URL that you configured in the Set Up the Dependency and Configuration Variables section.

Then create a RequestConfig object and add the bot ID, org ID, forceConfig endpoint configuration variables.

1RequestConfig config = RequestConfig.with()
2    .botId(botId)
3    .orgId(orgId)
4    .forceConfigEndpoint(forceConfigEndPoint)
5    .build();