Get Started with Einstein Bots API
To access Einstein Bots APIs over a public network, you must set up an OAuth connected app in the org that authorizes the service calls to Einstein Bots APIs.
To get started, create a connected app in Salesforce and connect an Einstein bot to the app.
A connected app is a framework that allows external services to integrate with Salesforce APIs and services through well-known authorization protocols such as SAML, OAuth, and OIDC. A connected app authenticates and authorizes an inbound external service call. This connection allows the external services to talk to Salesforce APIs over a public network. To learn more about Salesforce Connected Apps, refer to Connected Apps in Salesforce Help.
- Create a connected app following Configure Basic Connected App Settings and Enable OAuth Setting for API Integration with these OAuth scopes.
- Access chatbot services (
chatbot_api): Required. This scope enables access to the Einstein Bots services.
- Perform requests at any time (
offline_access): Required. This scope permits you to get an OAuth access token.
- Access chatbot services (
- Choose an OAuth Authorization Flow. We recommend the JWT Bearer Flow. To use it, make sure to configure JWT bearer flow settings in the connected app. Username-password flow isn’t supported.
- Go to Manage Connected Apps in Setup in your org and set the Permitted Users Policy to Admin-approved users are pre-authorized. This policy setting ensures that all valid scopes are included when the access token is issued.
- Retrieve the access token with the auth flow of your choice. You need a valid OAuth access token with proper scopes to access the Einstein Bots API.
Next, connect your bot to the OAuth-enabled connected app.
- Create and set up an Einstein Bot using the Einstein Bots setup instructions. Linking your bot to an existing deployment is optional.
- In the Connections section of the Update the Bot Overview Page click Add and fill in the fields.
- Connection: Select API.
- Integration Name: Add a unique name for this bot API and connected app integration, for example, “Einstein Bots Open API”. A maximum of 128 characters is allowed.
- Connected App: Select the name of the OAuth-enabled connected app that you created.
- Keep a copy of the runtime base URL and the ForceConfig endpoint. The runtime base URL is the host URL of the Einstein Bots API endpoint. You need those parameters to begin a session using the API, SDK, or connector framework.
You can find the runtime base URL only here. You can find the ForceConfig endpoint under Setup | My Domain too.
- Click Save.
- Click Activate to activate your bot.
You’ve now established the connection between your Einstein Bot and a Salesforce OAuth-enabled connected app.