Skip to Content

Trigger a Studio operation from a webhook in Jitterbit Studio

Introduction

API Manager lets you publish a Studio operation as an HTTP endpoint. When an external system sends an HTTP request to that endpoint, API Manager receives the request and immediately runs the linked operation, passing the request body and headers through Jitterbit variables.

This pattern is useful for reacting to real-time events from external systems such as CRM platforms, ticketing tools, or custom applications that support outbound webhooks.

This guide covers the Custom API type in API Manager. It assumes the following:

  • A custom API is configured and published in API Manager in the same environment as the project.
  • A Studio project exists with at least one operation to receive the incoming request.

The general flow is:

flowchart LR A[External system] -->|HTTP POST| B[API Manager custom API] --> C[Studio operation] --> D[HTTP response]

Part 1: Create the custom API

Step 1: Create the API

  1. Open API Manager and click New API.

  2. Select Custom API as the API type.

  3. API Name: Enter a name for the API (for example, Webhook Receiver). This name appears in API Manager and in operation logs.

  4. URL Prefix: Enter the base path segment for the public endpoint URL (for example, my-webhook).

  5. Version: Enter a version string (for example, 1.0). This becomes part of the endpoint URL.

  6. Enable SSL: Enable to require HTTPS connections. This is recommended for all production endpoints.

  7. Enable CORS: Enable if the external system sends cross-origin requests from a browser context.

  8. Click Save.

Step 2: Configure the service endpoint

  1. In the API editor, click Add Service.

  2. Method: Select the HTTP method that the external system uses to send the webhook (for example, POST).

  3. Path: Enter the endpoint sub-path (for example, /events). This is appended to the base URL.

  4. Operation: Select the Studio operation that will process the incoming request.

  5. Response Type: Select Variable. With this setting, the response body is determined by the value the operation assigns to $jitterbit.api.response.

  6. Timeout: Set the maximum time API Manager waits for the operation to complete. The default is 30 seconds.

  7. Click Save, then click Publish.

After publishing, API Manager displays the full endpoint URL in the format https://<host>/<prefix>/<version>/<path>. Copy this URL and configure the external system to post webhook payloads to it.

Part 2: Access the request payload in the operation

When API Manager triggers the linked operation, it populates Jitterbit variables with the incoming request data. Read these variables in a script step at the start of the operation.

Variable Contents
$jitterbit.api.request.body The raw request body as a string.
$jitterbit.api.request.headers.content-type The value of the Content-Type request header.
$jitterbit.api.request.headers.fulluri The full request URI, including path. Useful for routing when multiple paths map to one operation.
$jitterbit.api.request.method The HTTP method of the request (for example, POST).

The following example logs the incoming body and URI to the operation log:

<trans>
WriteToOperationLog("Received body: " + $jitterbit.api.request.body);
WriteToOperationLog("URI: " + $jitterbit.api.request.headers.fulluri);
</trans>

To use the payload in a transformation, assign it to a variable and map that variable as the source:

<trans>
$payload = $jitterbit.api.request.body;
</trans>

Route requests across multiple paths

If the API has several service paths (for example, /createRecord and /updateRecord), you can map all paths to a single controller operation and use a Case() statement to dispatch to sub-operations based on the URI:

<trans>
Case(
  Index($jitterbit.api.request.headers.fulluri, "/createRecord") >= 0,
    RunOperation("<TAG>operation:Create Record</TAG>");,
  Index($jitterbit.api.request.headers.fulluri, "/updateRecord") >= 0,
    RunOperation("<TAG>operation:Update Record</TAG>");
);
</trans>

This keeps the API configuration simple (one entry point) while the controller operation handles dispatch logic.

Part 3: Return a response to the caller

When Response Type is set to Variable, API Manager returns the value of $jitterbit.api.response as the HTTP response body. Set this variable in the operation before it completes.

The following example returns a JSON acknowledgment:

<trans>
$jitterbit.api.response = '{"status":"received"}';
</trans>

If $jitterbit.api.response is not set, API Manager returns an empty 200 OK response.

To return a non-200 HTTP status code, set $jitterbit.api.response.status_code alongside the response body:

<trans>
$jitterbit.api.response.status_code = "400";
$jitterbit.api.response = '{"error":"Missing required field"}';
</trans>

Note

Some external systems require a response within a short timeout window (often 3–10 seconds). If the operation performs time-consuming work, consider returning an acknowledgment immediately and processing the payload asynchronously using RunOperation with the async parameter set to true.

Verify the integration

  1. Deploy and run the project.

  2. In API Manager, copy the published endpoint URL.

  3. Send a test POST request to the endpoint using a tool such as curl or Postman, including a JSON body.

  4. Open the operation logs and confirm the operation ran and that the logged body matches the test payload.

  5. Confirm the HTTP response body and status code match the values set in $jitterbit.api.response and $jitterbit.api.response.status_code.