How to Integrate Salesforce with ChatGPT

by | Jun 16, 2023

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

  1. Use ChatGPT inside salesforce
  2. Allow specific team members to use it
  3. Report on the conversations that you and your team had
  4. Extend to other OpenAI API’s like image generation and text to speech.

We’ll cover the first three points to get you started!


If you’re looking to collaborate on this open source project, check out our github repo!


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



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 True


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.

  1. Search for permission sets in the setup
  2. Filter to the letter “o” to find “OpenAI Admin Access”
    1. Clone both the Admin and User access
  3. Update both to have access the the External Principal Named Credential of “OpenAI API”
  4. 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

  1. Go to the Setup
  2. Search App Manager
  3. Select App Manager
  4. Find an app you want to edit like Sales Console or Service Console
  5. Click the little arrow on the far right and choose edit
  6. In the App Editing window, select utility items
  7. Add one
  8. Search for OpenAiChat
  9. 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.