Connect ChatGPT to Salesforce Service Cloud
A GPT Actions guide connecting a Custom GPT to Salesforce Service Cloud via OAuth, to pull and update case data from ChatGPT.
Why it matters
Leverage ChatGPT's natural language capabilities to directly interact with Salesforce Service Cloud. This integration allows users to pull case data and update cases seamlessly.
Outcomes
What it gets done
Pull case data from Salesforce Service Cloud using natural language.
Update existing cases in Salesforce Service Cloud.
Reduce customer response times by enabling direct interaction with CRM data.
Ensure consistent customer communication through integrated knowledge and instructions.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/oai-gptactionsalesforce | bash Steps
Steps in the chain
Overview
Gpt Action Salesforce
A GPT Actions Library guide connecting a Custom GPT to Salesforce Service Cloud via a Connected App OAuth flow, letting the GPT pull and update case data on the user's behalf. Use it when building a Custom GPT that needs Salesforce Service Cloud case access. Requires Salesforce admin-level access to create a Connected App first.
What it does
A GPT Actions Library guide for connecting a Custom GPT to Salesforce Service Cloud, letting the GPT pull case data and update cases directly from ChatGPT. The guide notes other Salesforce Cloud solutions reuse the same Connected App and authentication setup, just with a different API schema. Named example use cases: reducing average response time to customers, reducing time to troubleshoot cases, and - combined with the GPT's own knowledge and instructions - more consistent brand voice in customer responses.
When to use - and when NOT to
Use it when building a Custom GPT that needs to read and update Salesforce Service Cloud cases through natural-language requests. It requires permission to create a Connected App in Salesforce first, so it is not usable without that Salesforce admin-level access.
Inputs and outputs
Setup is a multi-step Salesforce Connected App flow: create a New Connected App under Setup > App Manager, enable OAuth settings with a placeholder callback URL such as https://chat.openai.com/aip//oauth/callback to be updated later once the real Action callback URL is known, select OAuth scopes per your security policy, and ensure Client Credentials Flow, Authorization Code and Credentials Flow, and Token Exchange Flow are enabled while the PKCE requirement is left unchecked. Saving the app exposes a Consumer Key and Consumer Secret under Manage Consumer Details (verified via an emailed code) - these map directly to ChatGPT's Client ID and Client Secret. A second pass through Manage > Edit Policies re-confirms Token Exchange Flow is enabled. In ChatGPT's Authentication panel, select OAuth, reuse the Client ID/Client Secret from the steps above, and set the Authorization URL to https://[inserturlhere].my.salesforce.com/services/oauth2/authorize, the Token URL to https://[inserturlhere].my.salesforce.com/services/oauth2/token, the Scope to full, and Token to Default (POST).
Finally, copy the GPT Action's callback URL and add it directly into the Salesforce Connected App - the guide's own FAQ flags this as the most common source of a callback URL error, and a separately-listed Internal Server Error usually traces back to a wrong OAuth flow checkbox in the Connected App settings.
Integrations
Connects ChatGPT's Custom GPT / GPT Actions framework to Salesforce Service Cloud's API via a Connected App OAuth flow; links to Salesforce's own documentation on Lightning Apps, OAuth tokens and scopes, and the Salesforce API reference.
Who it's for
Support and customer-success teams building a Custom GPT that needs live Salesforce case data and update access, who have (or can obtain) permission to create a Connected App in their Salesforce org.
Source README
Introduction
This page provides an instruction & guide for developers building a GPT Action for a specific application. Before you proceed, make sure to first familiarize yourself with the following information:
- Introduction to GPT Actions
- Introduction to GPT Actions Library
- Example of Building a GPT Action from Scratch
This particular GPT Action provides an overview of how to connect to Salesforce, specifically, Salesforce Service Cloud. This schema detailed in this Action allows the user to pull case data and update cases directly from ChatGPT. The setup process to create Actions for other Salesforce Cloud solutions uses the same Connected App and authentication setup, but will require a different API schema.
Value + Example Business Use Cases
Value: Users can now leverage ChatGPT's natural language capability to connect directly to Salesforce
Example Use Cases:
- Reduce average response time to customers
- Reduce time to troubleshoot cases or issues
- Ensure more consistent brand voice in response to customers when combined with knowledge and instructions in the GPT
Application Information
Application Key Links
Check out these links from the application before you get started:
Application Prerequisites
Before you get started, make sure you go through the following steps in your application environment:
- Ensure you have permissions to create an App in Salesforce
ChatGPT Steps
Custom GPT Instructions
Once you've created a Custom GPT, copy the text below in the Instructions panel. Have questions? Check out Getting Started Example to see how this step works in more detail.
OpenAPI Schema
Once you've created a Custom GPT, copy the text below in the Actions panel. Have questions? Check out Getting Started Example to see how this step works in more detail.
Authentication Instructions
Below are instructions on setting up authentication with this 3rd party application. Have questions? Check out Getting Started Example to see how this step works in more detail.
Pre-Action Steps
Before you set up authentication in ChatGPT, please take the following steps in the application.
Before you set up authentication in ChatGPT, please take the following steps in the application.
Navigate to Salesforce Setup
Search for “App Manager”
Click “New Connected App”
Enter a Connected App Name
Enter contact email (your email)
Check the box to enable OAuth settings
Insert a callback URL (use a placeholder like https://chat.openai.com/aip//oauth/callback for now, you’ll update this later when you create the Action in ChatGPT)
Select “Selected OAuth Scopes” and grant the appropriate permissions. Scope these based on your internal security policies.
Ensure the following boxes are checked:
- Enable Client Credentials Flow
- Enable Authorization Code and Credentials FLow
- Enable Token Exchange Flow
- Ensure the following box is unchecked:
- Require Proof Key for Code Exchange (PKCE) Extension for Supported Authorization Flows
- Save your New Connected App
- Under “Consumer Key and Secret” click “Manage Consumer Details”. Verify your access using the code emailed to your account, and then copy the key and secret.
- Salesforce Consumer Key = ChatGPT Client ID
- Salesforce Consumer Secret = ChatGPT Client Secret
Return to App page
Click “Manage”
Click “Edit Policies”
Under OAuth Policies, check the “Enable Token Exchange Flow” box
Click save!
In ChatGPT
In ChatGPT, click on "Authentication" and choose "OAuth". Enter in the information below.
- Client ID: use Client ID from steps above
- Client Secret: use Client Secret from steps above
- Authorization URL: https://[inserturlhere].my.salesforce.com/services/oauth2/authorize
- Token URL: https://[inserturlhere].my.salesforce.com/services/oauth2/token
- Scope: full
- Token: Default (POST)
Post-Action Steps
Once you've set up authentication in ChatGPT, follow the steps below in the application to finalize the Action.
- Copy the callback URL from the GPT Action
- Navigate back to your Connected App in Salesforce, and add your callback URL.
FAQ & Troubleshooting
- Callback URL Error: If you get a callback URL error in ChatGPT, pay close attention to the screenshot above. You need to add the callback URL directly into Salesforce for the action to authenticate correctly
- Internal Server Error: Ensure all the correct boxes are checked and/or unchecked in the OAuth settings for your connected app.
Are there integrations that you’d like us to prioritize? Are there errors in our integrations? File a PR or issue in our github, and we’ll take a look.
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.