Get Started

Learn how to get started with the Einstein Bot channel connector framework to send messages between your external messaging channel, such as Twitter or Slack, and the Salesforce bot.

Create a Channel Connector App

You can create an app that uses the channel connector framework with this Maven archetype command. Set archetypeVersion to the most recently released version of the Einstein Bot Channel Connector Archetype. Set package, groupId, and artifactId to the names of your choice.

mvn archetype:generate \
    -DarchetypeGroupId=com.salesforce.einsteinbot \
    -DarchetypeArtifactId=einstein-bot-channel-connector-archetype \
    -DarchetypeVersion=1.0.1 -Dpackage=com.mycompany.myapp.channel \
    -DgroupId=com.mycompany.myapp -DartifactId=myapp-channel-connector \
    -Dversion=1.0.0-SNAPSHOT

Alternatively, you can use this command to run it in interactive mode and provide the groupId and artifactId when prompted.

mvn archetype:generate \
    -DarchetypeGroupId=com.salesforce.einsteinbot \
    -DarchetypeArtifactId=einstein-bot-channel-connector-archetype \
    -DarchetypeVersion=2.0.1

Run the Channel Connector App

First, configure the src/main/resources/application.properties file. You can start by copying the example properties from the src/main/resources/application.example.properties file.

This table lists the available application properties.

Property Name Environment Variable Name Description
sfdc.einstein.bots.runtime-url BOT_RUNTIME_URL Required. The base URL of the bot runtime.
sfdc.einstein.bots.integration-name BOT_INTEGRATION_NAME The integration name that you used when connecting the connected app API to the bot. See Get Started with Einstein Bots API.
sfdc.einstein.bots.oauth.private-key-file OAUTH_PRIVATE_KEY_FILE_PATH Required. The path to the private key in DER encoded format to get OAuth tokens.
sfdc.einstein.bots.oauth.login-endpoint LOGIN_END_POINT Required. The Salesforce URL to get the OAuth Token. This is https://login.salesforce.com for the production org and https://test.salesforce.com for the test org.
sfdc.einstein.bots.oauth.connected-app-id CONNECTED_APP_ID Required. The consumer key of your connector app setup.
sfdc.einstein.bots.oauth.connected-app-secret CONNECTED_APP_SECRET Required. The consumer secret of your connector app setup.
sfdc.einstein.bots.oauth.user-id SFDC_USER_ID Required. The login user ID that you use to log in to Salesforce.
sfdc.einstein.bots.cache.ttlseconds CACHE_TTL_SECS The time in seconds to cache information for tracking sessions. Provide a value appropriate to your external channel.
sfdc.einstein.bots.cache.redis-url CACHE_REDIS_URL The Redis URL. Required to use the Redis cache.
sfdc.einstein.bots.oauth.cache.ttlseconds OAUTH_CACHE_TTL_SECS The time in seconds to cache oauth tokens to avoid network requests.
sfdc.einstein.bots.oauth.cache.redis-url OAUTH_CACHE_REDIS_URL The Redis URL. Required to use Redis for caching OAuth tokens.

Start the app by running Spring Boot with this Maven command.

mvn spring-boot:run

Use the Default Spring Bean

Use @Autowired or @Inject in your Spring-managed code to use Bean with the default configuration.

@Autowired
private BasicChatbotClient basicChatbotClient;

@Autowired
private SessionManagedChatbotClient sessionManagedChatbotClient;

@Autowired
private BotsHealthIndicator health;

Now, let’s Explore Example Channel Connector Apps to build your connector app.