OAuth2 Example: Custom GPT
Connect a ChatGPT Custom GPT to Guru with an OAuth2 client, end to end.
This guide walks through connecting a ChatGPT Custom GPT to Guru with an OAuth2 client, so your employees can search Guru, read announcements, and create drafts from ChatGPT.
Step 1: Create an OAuth2 client in Guru
Following Create an OAuth2 Client, create a client via the API. The redirectUris field is required, but you won't know your Custom GPT's callback URL yet, so pass a placeholder for now; you'll update it in Step 4.
In the scopes array, pass these values:
read:announcementsread:cardswrite:drafts
The response looks like the example below. You'll need the clientId and clientSecret later in this process.
{
"clientId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"clientSecret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx6e3004",
"redirectUris": [
"https://chat.openai.com/aip/g-bc7dcb2bca26fae70b42c403f4dbbfd73b68e4a6/oauth/callback"
],
"scopes": [
"read:announcements",
"write:drafts",
"read:cards"
],
"name": "My Guru OAuth Client",
"logoUrl": "https://pp.getguru.com/58e8cb652537496b88edfc297a764f67.png",
"description": "Here is the OAuth2 Client description.",
"bottomDescription": "Here is the OAuth2 Client bottomDescription"
}Step 2: Set your OAuth2 client logo
When a user connects their Custom GPT to Guru, they see a screen asking them to authorize Guru to perform actions on their behalf. You control the logo on the right side of that screen by updating the OAuth2 client's logo; a natural choice is the logo you picked for your Custom GPT. Use the Update OAuth2 Client Logo endpoint.

Step 3: Create a Custom GPT
Initial setup
After logging into ChatGPT, click your avatar in the top right corner and select My GPTs, then click "Create a GPT". Give your GPT a name, description, and logo. In the "Instructions" box, tell your GPT its purpose, how it should behave, and what to avoid. The sample instructions below work well with Guru; copy and tweak as needed:
Instructions
This GPT is an enterprise search GPT designed to leverage content from Guru, providing employees with accurate, up-to-date information needed for their job roles. It responds to work-related or company-specific queries, maintaining a boundary against personal inquiries. Guru Enterprise Search delivers concise and informational responses, ensuring clarity and relevance in its communication. In scenarios where sufficient information isn't available, Guru Enterprise Search will ask follow-up questions to gather more details, ensuring accurate and helpful responses. This approach aids in effective information dissemination and supports employees in their day-to-day tasks, fostering a more informed and efficient workplace.
If the content contains links to other applications, include the links when appropriate.
If the content contains links to images, include the images in the response when appropriate.
For any question, I want you to be cognizant of today's date and always be considerate of it for any questions that involve a component of time.
Further, use your reasoning skills to think step by step through how to answer the question.
When providing an answer that is generated from search results, please include any source links and names in your response. Make sure the links are properly generated.
If the content contains "unverified" Guru cards, and you use that information to generate the answer, then state that the answer comes from unverified information.
If there are similar results found, then use the latest information to provide the answer.
When calling the document search API, make sure to set "showArchived=false".
If the answer cannot be generated from the results of the document search API, then state that there is not enough information available to answer the question but provide a link to the documents that were returned.
Actions
In the "Actions" section, click "Create New Action". For "Authentication", select "OAuth" and fill in the form:
| Field | Value |
|---|---|
| Client ID | The clientId from the response when you created your OAuth2 client |
| Client Secret | The clientSecret from that same response |
| Authorization URL | https://api.getguru.com/oauth/authorize |
| Token URL | https://api.getguru.com/oauth/token |
| Scope | read:cards,read:announcements,write:drafts |
| Token Exchange Method | Default (POST Request) |
After clicking Save, you'll need to enter a schema.
Schema
In the "Schema" section, click "Import from URL" and paste in https://api.getguru.com/api/v1/openapi_ai.json.
The schema tells your Custom GPT what actions it can take on your behalf and how to make them. This file lets your users search Guru, read announcements, and create drafts from ChatGPT.
Step 4: Update your OAuth2 client with the callback URL
After adding Guru as an action, return to your GPT's Configuration page. A Callback URL now appears at the bottom of the page.

Using your clientId, call Get an OAuth2 Client and copy the response body. Then call the update endpoint with the clientId in the URL, pasting the response you copied as the request body, and replace the placeholder redirectUris value with the Callback URL ChatGPT provided.
Step 5: Test your GPT
Your employees can now connect to Guru via OAuth2. Try asking a question that your Guru content, or the Sources connected to Guru, should be able to answer, or ask your Custom GPT to create a draft in Guru. On first use, each user is prompted to allow Guru to perform actions on their behalf.
If you run into issues during setup, contact [email protected].
Updated 10 days ago

