Set Up the Basic Bot Client

First, create an instance of the basic bot client.

// Create a JWT Bearer authentication mechanism.
AuthMechanism oAuth = JwtBearerOAuth.with()
    .privateKeyFilePath(privateKeyFilePath)
    .loginEndpoint(loginEndpoint)
    .connectedAppId(connectedAppId)
    .connectedAppSecret(secret)
    .userId(userId)
    .build();

// Create a basic bot client.
BasicChatbotClient client = ChatbotClients.basic()
    .basePath(basePath)
    .authMechanism(oAuth)
    .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.

RequestConfig config = RequestConfig.with()
    .botId(botId)
    .orgId(orgId)
    .forceConfigEndpoint(forceConfigEndPoint)
    .build();