Skip to Content

Process documents with AI in Jitterbit Studio

Introduction

The Google Docs connector and OpenAI connector can be combined to build document processing pipelines in Studio. This guide covers a common pattern: fetching a Google Docs document by ID, passing its text content to OpenAI with a prompt that instructs the model how to process it, and posting the AI-generated result to a Slack channel.

Typical use cases include meeting notes summarization, contract analysis, and structured data extraction from unstructured documents.

This guide focuses on the document-specific parts of the integration: configuring the Google Docs connection, mapping document content into the prompt, and routing the AI response. For OpenAI connection setup and general Prompt activity configuration, see Use OpenAI to process data in a Studio operation.

Design pattern

The integration uses two chained operations:

flowchart LR A["Transformation
Map document ID"] --> B[Google Docs Get Docs] --> C["Transformation
Map content to prompt"] --> D[OpenAI Prompt] D -->|On Success| E["Transformation
Map AI response"] --> F[Slack Post Message]

Operation 1 uses two transformations: a request transformation that maps the document ID into the Get Docs request schema, and a transformation that maps the returned content field into the OpenAI prompt field. Operation 2 reads the AI response from the Prompt activity and posts it to a Slack channel.

Part 1: Configure the Google Docs connection and activity

Step 1: Create the Google Docs connection

  1. In Studio, open your project and click the Project endpoints and connectors tab in the design component palette.

  2. Click the Google Docs connector to open the connection configuration.

  3. Connection Name: Enter a name that identifies this connection, for example Google Docs.

  4. Configure authentication as described in Google Docs prerequisites.

  5. Click Test to verify the connection, then click Save Changes.

Step 2: Configure the Get Docs activity

  1. On the design component palette, expand the Google Docs endpoint you created. Drag the Get Docs activity type onto the design canvas to create an activity instance.

  2. Double-click the activity to open its configuration.

  3. Name: Enter a name for the activity, for example Get Document.

  4. Click Next to review the data schemas, then click Finished.

The Get Docs activity uses these schema fields:

  • Request: docid: the document ID of the Google Doc to retrieve.
  • Response: docname (document title), content (body text of the document), and errormsg (error message, if any).

The document ID appears in the Google Docs URL: https://docs.google.com/document/d/<document-id>/edit.

Step 3: Map the document ID

Add a request transformation before the Get Docs activity to supply the document ID. Map the docid request field using a project variable so the ID can be changed without editing the transformation:

<trans>
$google_docs_document_id
</trans>

Tip

For dynamic document selection (for example, processing the most recently modified document), set google_docs_document_id in a script step that precedes the Get Docs operation, using results from a Google Drive List Files activity.

Part 2: Map document content to the OpenAI prompt

Before configuring the transformation, set up the OpenAI connection and Prompt activity as described in Use OpenAI to process data in a Studio operation.

In the transformation between the Get Docs activity (source) and the OpenAI Prompt activity (target), map the following fields.

Map the prompt

Map the OpenAI prompt field to combine a static instruction with the document body. Use Source.content to reference the content field from the Get Docs response schema:

<trans>
"Summarize the following meeting notes in three bullet points:\n\n" +
Source.content
</trans>

Request structured output

If downstream processing requires a predictable format, include formatting instructions in the prompt:

<trans>
"Extract the key decisions and action items from the following meeting notes. " +
"Return the result as a JSON object with these fields: " +
"\"summary\" (a one-sentence overview), \"decisions\" (an array of strings), " +
"\"action_items\" (an array of strings).\n\n" +
Source.content
</trans>

For guidance on parsing structured JSON responses in a downstream operation, see Route LLM responses to Studio operations using function calling.

Handle Get Docs errors

Add a script node to the transformation to surface errors returned by the Get Docs activity:

<trans>
if(Source.errormsg != "",
  RaiseError("Google Docs error: " & Source.errormsg)
);
</trans>

Part 3: Access the AI response and post to Slack

Chain the Slack operation

Configure the OpenAI operation's On Success action to run the downstream Slack operation:

  1. Open the OpenAI operation's settings.

  2. On the Actions tab, set the On Success action to Run Operation and select the Slack operation.

For more information on chaining operations, see Configure error handling in operations.

Map the AI response

In the Slack operation's transformation, map choices[0].message.content from the Prompt activity's response schema to the Slack message text field:

<trans>
Source.choices[0].message.content
</trans>

Handle OpenAI errors

Add a script node to raise an error if OpenAI returns a non-empty errors array:

<trans>
if(Length(Source.errors) > 0,
  RaiseError(Source.errors[0].message)
);
</trans>

For full Slack connection and message configuration steps, see Send a Slack notification from a Studio operation.

Verify the integration

  1. Deploy and run the Get Docs operation manually.

  2. In the operation logs, confirm the Get Docs activity completed successfully and that the content field contains the expected document text.

  3. Confirm the OpenAI Prompt operation was triggered and completed successfully.

  4. Inspect the OpenAI operation log to verify that choices[0].message.content contains a valid AI-generated response.

  5. Check the Slack channel for the posted result.

If the Get Docs activity returns an empty content field, verify that the document ID is correct and that the service account configured in the Google Docs connection has read access to the document.