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 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 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.
-
Click Test to verify the connection, then click Save Changes.
Part 2: Configure the Prompt activity
The Prompt activity is a target: it consumes data mapped from a transformation and submits it to OpenAI.
Note
This guide uses the Prompt activity, which calls OpenAI's Chat Completions API. The connector also provides a newer Prompt V2 activity, built on OpenAI's Responses API, that adds richer response data, chat context retention across operations, and the ability to call tools registered with the Register Tools V2 or Register MCP Server Tools activities. For new projects that need those capabilities, use Prompt V2. See OpenAI Prompt V2 activity.
-
On the design component palette, expand the OpenAI endpoint you created. Drag the Prompt 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. -
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. The request schema includes prompt, model, max_tokens, temperature, and top_p. The response schema includes choices (an array containing a message object with the generated content, plus index and finishReason), usage (token counts), and errors.
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 activity, map the source fields to the Prompt activity's request schema.
The most important field to map is prompt. 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 activity itself. Map only the fields that need to vary based on source data.
Part 4: Access the AI response
The Prompt 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 operation's On Success action to run a second operation that processes the AI response:
-
Open the Prompt 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 activity's response schema provides the AI-generated text in choices[0].message.content. Map this field to the target:
<trans>
Source.choices[0].message.content
</trans>
For example, map choices[0].message.content 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 activity uses the OpenAI Chat Completions API, which returns the generated text in choices[0].message.content. The response schema also exposes a legacy choices[0].text field that applies only to older completion-style models; current chat models (such as gpt-4) populate message.content. The Azure OpenAI connector also uses the Chat Completions API and returns choices[0].message.content.
Check for errors
The response schema also includes an errors array. If OpenAI returns an error (for example, due to an invalid model name or an exceeded token limit), the error details appear in errors[0].message. To surface these in the operation log, add a script node to the transformation that calls RaiseError when errors is populated:
<trans>
if(Length(Source.errors) > 0,
RaiseError(Source.errors[0].message)
);
</trans>
Verify the integration
-
Deploy and run the Prompt operation manually.
-
In the operation logs, confirm that the Prompt activity completed successfully and that the downstream operation was triggered.
-
Inspect the downstream operation's log to verify that
choices[0].message.contentcontains a valid AI-generated response. -
If the Prompt 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.