In this article, we will cover how to Integrate Salesforce with ChatGPT in 30 minutes. You’ll be chatting anywhere in Salesforce, no developer needed. You’ll be able to
- Use ChatGPT inside salesforce
- Allow specific team members to use it
- Report on the conversations that you and your team had
- Extend to other OpenAI API’s like image generation and text to speech.
We’ll cover the first three points to get you started!
Developers
If you’re looking to collaborate on this open source project, check out our github repo!
Guide
This guide is accompanied by a video. We recommend having both since the written guide has content to copy and paste, while the video shows exactly where to go.
Install or Deploy the Package
First, you need the app. You can install the package directly into a salesforce org via these links
You could also deploy the code directly, which in that case have your developer do that.
Create Credentials
A named credential allows you to use the OpenAI securely by keeping your API key encrypted. You need to create the Named Credential for this app to work.
Create an External Credential
External Credential Naming
Label | Name |
OpenAI API
|
OpenAI_API |
Principals
Paremeter Name | Parameter 1 Name | Value |
Token | Token | OpenAI API Key |
Custom Headers
Name | Value |
Authorization | Bearer {!$Credential.OpenAI_API.Token} |
Creating a Named Credential
Named Credential Label
Label | Name | URL | Enabled for Callouts |
OpenAI API |
OpenAI_API | https://api.openai.com/ | True |
Authentication
Select you “OpenAI API” External Credential
Callout Options
Generate Authorization Header | Allow Formulas in HTTP Header | Allow Formulas in HTTP Body | Managed Package Access |
False | True | True | oai_sf_i |
Custom Headers
Create two Custom Headers
Name | Value |
Accept | application/json |
Content-Type | application/json |
Clone & Assign Permission Sets
You can follow these steps, or follow along in this video.
- Search for permission sets in the setup
- Filter to the letter “o” to find “OpenAI Admin Access”
- Clone both the Admin and User access
- Update both to have access the the External Principal Named Credential of “OpenAI API”
- Assign to your users
Assign Chat Component to Apps
You can use our Lightning Web Component and assign it to record pages, the utility bar, app pages, or the home page.
We prefer the utility bar so that it is accessible anywhere in Salesforce under an app.
Follow the steps below, or follow along in this video.
Utility Bar Assignment
- Go to the Setup
- Search App Manager
- Select App Manager
- Find an app you want to edit like Sales Console or Service Console
- Click the little arrow on the far right and choose edit
- In the App Editing window, select utility items
- Add one
- Search for OpenAiChat
- Choose it!
There you have it! You should be able to use chatgpt in Salesforce! There are many ways to improve on this so either enlist you developer to expand, or reach out to one of ours! We’re happy to help you with any Salesforce related project whether highly technical or simply administrative.