Salesforce
Use Salesforce in assistant actions.
Prerequisites
This guide helps you to set up an assistant action for Salesforce. Before proceeding, we recommend to read the following guide Introduction to Actions.
In Salesforce, you will need to create Lightning Apps and set up authentication with OAuth tokens. You need to have permissions to create an app in Salesforce. Here are some additional resources:
This guide helps you to integrate Salesforce to Langdock using the Rest API. You can retrieve data or update data from Salesforce in Langdock. If you use other Salesforce solutions, the process with the app and the authentication will be the same, but you will need a different OpenAPI Schema. You can find the different Salesforce APIs here.
Setup
1. Assistant instructions
Create a new assistant. If you are new to creating assistants, you can read more about how to create assistants and write instructions in our [assistant guide](https://docs.langdock.com/resources/assistant-creation and our prompt engineering guide. Paste the following instructions into the according field.
2. OpenAPI Schema
Scroll to the bottom of the assistant configuration and click on New Action. Here you can configure actions and API requests to other tools. Copy the text below into the field OpenAPI Schema. You can also try out action assistant to write the OpenAPI schema.
Make sure to replace the base URL with your account’s base URL and replace XX.X with the Salesforce instance version. Here you can find more about the instance version.
Also, replace the objects with the objects defined in your instance.
Authentication
3. Salesforce App
Go to your Salesforce application and create a new app:
-
Navigate to the Setup page.
-
Search for App Manager
-
Click on New connected app and then on Create an External Client App with OAuth 2.0.
-
Enter a name for your app, e.g. “Langdock”
-
Enter your email address as the contact email
-
Enable OAuth by checking the according box
-
Add a callback URL placeholder. This can be any URL and will be updated at the end.
-
Select the permissions in Selected OAuth Scopes you want to grant this app and the assistant. This should be comply with your internal security guidelines.
-
Check these boxes (if they are not checked already):
-
Enable Client Credentials Flow
-
Enable Authorization Code and Credentials Flow
-
Enable Token Exchange Flow
-
-
Uncheck this box (if it is checked):
- Require Proof Key for Code Exchange (PKCE) Extension for Supported Authorization Flows
-
Save the application
-
Click on the Settings tab an on Consumer Key and Secret and click Manage Consumer Details. You will need to verify your access through a code sent to you in an email. Then, copy the key and secret.
The Salesforce Consumer Key
is theClient ID
in Langdock and theSalesforce Consumer Secret
is theClient Secret
.
-
Return to the main app page.
-
Switch back to the Policies tab and click on Edit.
-
Go to OAuth Policies and check this box: Enable Token Exchange Flow. Also make sure that Enforce IP Restrictions is selected and the Refresh Toekn Policy is set to Immediately expire refresh token.
-
Finish the setup by clicking Save
4. OAuth Configuration in Langdock
-
Go to the Authentication section at the top of the action settings. Select OAuth.
-
Enter the according information from your Salesforce Application:
-
Client ID: Enter the Salesforce Consumer Key from above
-
Client Secret: Enter the Salesforce Consumer Secret from before
-
Authorization URL: https://[your URL].my.salesforce.com/services/oauth2/authorize
-
Token URL: https://[your URL].my.salesforce.com/services/oauth2/token
-
Scopes: full
-
Token: Default
5. Paste redirect URL into Salesforce
-
Copy the redirect URL from the OAuth section in the action
-
Go to your Salesforce app, switch to the Settings tab and click on Edit.
-
Replace the placeholder URL from before with this URL.
-
Save the app.
Was this page helpful?