Use OpenAI to process data in a Studio operation in Jitterbit Studio
Introduction
The OpenAI connector lets Studio operations send data to OpenAI and receive AI-generated text in return. This guide covers the common pattern of constructing an OpenAI prompt from source data, sending it to OpenAI using the Prompt V2 activity, and then routing the AI response to a downstream target such as a database, a file, or a notification channel.
Design pattern
The operation that submits data to OpenAI follows the transformation pattern:
Map AI response"] --> E[Target activity]
The source activity provides the data used to build the prompt (for example, a Salesforce record query result or a database row). The transformation maps that data into the prompt request fields. The Prompt V2 activity sends the request to OpenAI and stores the response.
A second operation, chained on the success of the first, uses a transformation to read the AI response and route the generated text to the target activity (for example, posting it to a Slack channel or writing it to a database field).
Part 1: Configure the OpenAI connection
-
In Studio, open your project and click the Project endpoints and connectors tab in the design component palette.
-
Click the OpenAI connector to open the connection configuration.
-
Connection Name: Enter a name that identifies this connection, for example
OpenAI. -
API/Secret Key: Enter your OpenAI API key.
Tip
Store the API key as a project variable with its value hidden, then reference the variable here using the variable icon or by typing
[to select it. This keeps the key out of the connection configuration directly and makes it easy to rotate without editing the project. -
API Version: Leave this set to the default value V1, which is the only supported version. (This is the connection's OpenAI API version and is unrelated to the Prompt V2 activity used later in this guide.)
-
Click Test to verify the connection, then click Save Changes.
Part 2: Configure the Prompt V2 activity
The Prompt V2 activity is a target: it consumes data mapped from a transformation and submits it to OpenAI using OpenAI's Responses API.
-
On the design component palette, expand the OpenAI endpoint you created. Drag the Prompt V2 activity type onto the design canvas to create an activity instance.
-
Double-click the activity to open its configuration.
Step 1: Enter a name and specify settings
-
Name: Enter a name for the activity, for example
Summarize Record. -
Chat ID: Leave this blank for a single-turn prompt like the one in this guide; a
chatIdis generated automatically. To continue an existing conversation or call tools registered by a preceding Register Tools V2 or Register MCP Server Tools activity, enter that activity'schatIdhere instead. -
Prompt text: Enter the base prompt text. This field accepts a static string or a variable reference. If the prompt needs to incorporate source data fields dynamically (for example, including a record ID or field value), leave this field as a general instruction and override it with the full constructed prompt in the transformation (see Part 3).
Example static prompt:
Summarize the following support case in one sentence: -
Model: Select the OpenAI model to use. The default is
gpt-4. For a full list of supported models, see OpenAI connector. -
Optional settings: Click to expand:
- Role: Select User for a standard user prompt. Use System to set assistant behavior, or Assistant to provide example responses.
- Temperature: Controls response randomness. Values closer to
0produce more deterministic output; values closer to2produce more varied output. - Max Tokens: Limits the length of the response. Set this to avoid unexpectedly long completions.
-
Click Next.
Step 2: Review the data schemas
The request and response schemas are displayed. Per OpenAI's Responses API, the request schema includes input, model, max_tokens, temperature, and top_p. The response schema includes an output array of items; a message item has a content array, each with a type (output_text for generated content) and the generated text, plus its own per-item error field for items such as tool calls.
Click Finished to save the activity configuration.
Part 3: Map source data to the prompt in a transformation
In the transformation that precedes the Prompt V2 activity, map the source fields to the Prompt V2 activity's request schema.
The most important field to map is input. Use a script node to construct the full prompt string by combining the static instruction with field values from the source:
<trans>
"Summarize the following support case in one sentence:\n\n" +
"Subject: " + Source.Subject + "\n" +
"Description: " + Source.Description
</trans>
Where Source.Subject and Source.Description are fields from the source activity's response schema (for example, fields returned by a Salesforce Query activity).
To override the model set in the activity configuration, map the model field to a literal string or a project variable:
<trans>
$openai_model
</trans>
Tip
You do not need to map every request schema field. Fields left unmapped use the values configured in the Prompt V2 activity itself. Map only the fields that need to vary based on source data.
Part 4: Access the AI response
The Prompt V2 activity's response schema is available in any transformation within the same operation or in a downstream operation.
Chain a downstream operation
Configure the Prompt V2 operation's On Success action to run a second operation that processes the AI response:
-
Open the Prompt V2 operation's settings.
-
On the Actions tab, set the On Success action to Run Operation and select the downstream operation.
For more information on chaining operations, see Configure error handling in operations.
Read the generated text
In the downstream operation's transformation, the Prompt V2 activity's response schema provides the AI-generated text nested under output. Per OpenAI's Responses API, map the target field to the first output item's text:
<trans>
Source.output[0].content[0].text
</trans>
For example, map this field to a Slack message text field to post the AI summary to a channel (see Send a Slack notification from a Studio operation), or map it to a database field to store the result.
Note
The Prompt V2 activity uses OpenAI's Responses API, which nests the generated text under output rather than under choices as in OpenAI's Chat Completions API. The deprecated Prompt (Deprecated) activity and the Azure OpenAI connector both use the Chat Completions API and return choices[0].message.content.
Check for errors
Each item in the output array has its own error field, populated when that specific item fails (for example, a failed tool call). Add a script node to the transformation that checks output[0].error and calls RaiseError if it's populated:
<trans>
if(Length(Source.output[0].error) > 0,
RaiseError(Source.output[0].error)
);
</trans>
Verify the integration
-
Deploy and run the Prompt V2 operation manually.
-
In the operation logs, confirm that the Prompt V2 activity completed successfully and that the downstream operation was triggered.
-
Inspect the downstream operation's log to verify that
output[0].content[0].textcontains a valid AI-generated response. -
If the Prompt V2 activity fails with an authentication error, verify the API key in the OpenAI connection and confirm it has not been revoked in your OpenAI account.
Tip
To schedule the operation to run automatically, see Schedule an operation to run automatically.
For more advanced AI patterns built on this foundation, see Process documents with AI, Route LLM responses to Studio operations using function calling, and Build a multi-turn LLM chat with conversation history.