Prompt Chain

Query and Analyze Box Content with ChatGPT

A GPT Actions guide connecting ChatGPT to Box.com via OAuth, using an Azure Function middleware so ChatGPT can read file contents directly.

Works with boxazure

69
Spark score
out of 100
Updated 12 days ago
Version 1.0.0
Models

Add to Favorites

Why it matters

Leverage ChatGPT to query, analyze, and gain insights from your Box.com files and metadata. This integration enables advanced content analysis, summarization, and audit trail visibility.

Outcomes

What it gets done

01

Connect ChatGPT to your Box.com account.

02

Query file details, content, and metadata from Box.

03

Enable OpenAI-powered analysis of Box documents.

04

Provide visibility into Box audit trails for administrators.

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/oai-gptactionbox | bash

Steps

Steps in the chain

01
Set up Box Developer Account
02
Configure Box Application
03
Set up Azure Environment
04
Create Custom GPT
05
Create Action 1: Box API Action
06
Configure OAuth Authentication
07
Update Box Redirect URI
08
Create Azure Function
09
Configure Action 2: Azure Function

Overview

GPT Action Library: Box

A GPT Actions guide connecting ChatGPT to Box.com through a Box API action and an Azure Function middleware, so ChatGPT can read file contents rather than just metadata, authenticated via OAuth 2.0. Use it to give a Custom GPT the ability to query and read Box-stored files and metadata, not for Box operations outside file/folder querying.

What it does

Connects ChatGPT to a Box.com account through two chained GPT Actions: a Box API action that queries file, folder, and metadata details directly from Box, and an Azure Function action that reformats Box's response so ChatGPT can actually download and read file contents - without the Azure Function, the GPT can only query metadata about a file, not its contents, and the function call itself stays transparent to the end user. Setup requires a Box developer account and a custom Box app configured for OAuth 2.0, providing a Client ID, Client Secret, redirect URI, and two scopes - read all files and folders, and manage enterprise properties - plus an Azure environment with rights to create Function Apps and Entra App Registrations. In ChatGPT, authentication is configured as OAuth using the Box Authorization URL (https://account.box.com/api/oauth2/authorize?...) and Token URL (https://api.box.com/oauth2/token), initially with a placeholder redirect URI that gets replaced with ChatGPT's real callback URL once the action is saved - that callback URL then has to be added back into the Box app's own OAuth redirect URI list. The Box action's schema is a starting point, not exhaustive - it doesn't cover every Box API endpoint, so it needs editing against Box's own developer documentation to expose whichever operations the GPT should support. The Azure Function itself is deployed following a separate Azure Functions cookbook guide, with sample files (function_app.py, jwt_config.json.sample, requirements.txt) provided as a customizable starting point rather than a drop-in solution.

When to use - and when NOT to

Use it to give a Custom GPT the ability to query and read files stored in Box - visualizing datasets, summarizing across folders, or supporting Box admins with audit-trail and health-check visibility - rather than for Box operations outside file and folder querying, since the guide's own scope covers read-oriented actions.

Inputs and outputs

Input is Box OAuth credentials (Client ID, Client Secret, scopes) and an Azure environment for the middleware function. Output is a working Custom GPT with two chained actions - one that queries Box directly and one that formats the response for file download - authenticated via OAuth against the user's Box account.

Integrations

Built on the Box API (OAuth 2.0 authentication, file/folder/metadata endpoints) and Azure Functions as required middleware for formatting file-content responses, configured through ChatGPT's Actions and Authentication panels.

Who it's for

For developers building a Custom GPT that needs to read Box-stored files and metadata, and for Box admins wanting GPT-powered audit-trail and health-check visibility. The guide flags two known gotchas to watch for: ChatGPT calling the wrong project or dataset, fixable by tightening the GPT's instructions, and large Box result sets causing event-stream errors.

Source README

GPT Action Library: Box

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:

This guide explains how to connect ChatGPT to a Box.com account. The GPT uses two actions to pull data from Box. It interacts with the Box API directly but requires middleware, such as an Azure Function, to format the response so ChatGPT can download and read the file contents. The Azure Function action is transparent to the end user, so the user does not need to call it explicitly.

  • Action 1: Box API action - Leverages the Box API to query data from Box
  • Action 2: Azure Function - Formats the response from Box, enabling ChatGPT to download the file directly from Box

Value + Example Business Use Cases

Existing Box customers can leverage these guidelines to query details about files, contents of files and any metadata related. This enables OpenAI-powered analysis of any content stored in Box such as visualizing data sets and creating summaries across multiple folders and files. This GPT can access folders, files and business process data such as metadata in Box. Additionally, Box admins can use this GPT action for visibility into audit trails and health checks.

Application Information

Application Key Links

Check out these links from Box and Azure before you get started:

Box Action


Azure Function

Application Prerequisites

Before you get started, make sure you go through the following steps in your Box environment:

  • This requires a Box developer account to get started : https://developer.box.com/
  • Follow the Box Developer site to create a custom app with OAuth 2.0 authentication type : https://developer.box.com/guides/getting-started/first-application/
  • Navigate to Configuration tab for the following values
    • OAuth 2.0 Credentials (Client ID / Client Secret) You will need both of these values for the ChatGPT configuration
    • OAuth 2.0 Redirect URIs : You will fill this value in from ChatGPT action configuration below
    • Application scopes (Read all files and folders in Box, Manage Enterprise properties)

You will want to keep this window open, the Redirct URIs needs to be filled in from the gpt configuration.


Middleware information : required for Action 2

Make sure you go through the following steps in your Azure environment:

  • Azure Portal with access to create Azure Function Apps and Azure Entra App Registrations
  • There is a detailed section in this guide related to deploying and designing the function required to wrap the response from Box in order to view the contents of the file. Without the function the GPT will only be able to query data about the file and not the contents. Be sure to read this section after creating the first action.

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.

Action 1 : Box API Action

Once you've created a Custom GPT, you will need to create 2 actions. Copy the text below in the 1st Actions panel, this will be for the Box action. Have questions? Check out Getting Started Example to see how this step works in more detail.

Note : this schema above does not contain all possible API endpoints, be sure to edit the schema to produce the appropriate actions from Box Developer documentation

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.

In ChatGPT

In ChatGPT, click on "Authentication" and choose OAuth


OAuth Connection

  • Client ID - value from Box custom app you created earlier
  • Client Secret - value from Box custom app you created earlier
  • Authorization URL - : https://account.box.com/api/oauth2/authorize?response_type=code&client_id=[client ID from above]&redirect_uri=[use a placeholder like chat.openai.com/aip//oauth/callback for now, you’ll update this later when you create the Action in ChatGPT]
  • Token URL : https:api.box.com/oauth2/token

    You need to save the configuration and navigate back to the gpt Configuration tab to copy the Callback URL, edit the configuration for the Box action Authorization URL and format the URL as https://account.box.com/api/oauth2/authorize?response_type=code&client_id=[client_ID]&redirect_uri=[callBack URL]

Post-Action Steps

Update the Box.com custom application

  • Copy the CallBack URL from the gpt and add a OAuth 2.0 Redirect URIs in Box.com


Action 2 : Azure Function

Now that we have the GPT created and authenticating against Box.com, we can create the azure function to handle the response formatting enabling the GPT to download the files from Box.

Follow this Azure Cookbook Guide for further details deploying an Azure function. Below you will find sample code to add to the function.

This code is meant to be directional - while it should work out of the box, it is designed to be customized to your need.


Data flow



Now that you have the azure function created, add the sample code below:

function_app.py

jwt_config.json.sample

requirements.txt

Make sure to follow the rest of the Azure guide for post authentication steps and ChatGPT configuration : Azure Cookbook Guide

FAQ & Troubleshooting

  • Schema calls the wrong project or dataset: If ChatGPT calls the wrong project or dataset, consider updating your instructions to make it more explicit either (a) which project / dataset should be called or (b) to require the user provide those exact details before it runs the query
  • Box can return a large set of data in the event stream which can cause errors,

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.