For the complete documentation index, see llms.txt. This page is also available as Markdown.

Automation Examples

Examples of DocStudio Automations that notify chat services and approve vacation requests.

The following examples demonstrate how multiple automation types can be combined into workflows for common integration and business-process scenarios.

Send a Chat Notification When an Envelope Is Completed

This example sends a notification when an envelope reaches the COMPLETED status. The workflow detects the envelope, builds a JSON message, and sends it through an HTTP request.

The workflow uses the following automation types:

Build the notification message

The xslt-converter transforms envelope.xml into the JSON body sent to the external service. The following XSLT creates a Google Chat message containing the envelope subject and status:

The generated Google Chat message has the following format:

Configure the target service

Use a Google Chat incoming-webhook URL with the Google Chat message above.

For Telegram, use the sendMessage endpoint and include the target chat_id:

Use the Telegram API URL in this format:

Automation payload

Set contentType to application/json. The request then uses the expected content type. For Telegram, use the Telegram URL and XSLT shown above.

Verify the notification

Complete an envelope that matches the trigger. Then retrieve the execution and confirm its state is SUCCEED.

If the request fails, retrieve the execution log. Check the api-caller operation for the response from the chat service.

Auto-Approve or Reject a Vacation Request Based on an External Balance

This example checks an employee's available vacation balance using an external REST API. When a vacation request reaches the approver's mailbox, the automation retrieves the available balance, compares it with the requested number of days, and automatically approves or rejects the request.

The workflow uses the following automation types:

Build the balance request

The xslt-converter creates the request body for the external service using values from the vacation request envelope. The exact XPath expressions depend on how the required fields are represented in envelope.xml.

The resulting request must contain the information required by the external service to identify the employee and determine the requested number of vacation days.

Check the vacation balance

The api-caller sends the generated request to the external HR or leave-management API:

The response must provide both the available vacation balance and the requested number of days so that the following conditions can evaluate the result.

Approve or reject the request

Two if-condition operations process the API response. Both are direct children of api-caller.

The first condition checks whether the available balance is sufficient:

When this condition matches, the workflow continues to envelope-approver, which approves the pending request:

The second condition checks the opposite case:

When the available balance is insufficient, the workflow continues to envelope-rejecter. The request is rejected automatically with a predefined rejection reason:

Automation payload

The automation must run for the mailbox that holds the pending approver role. Both envelope-approver and envelope-rejecter act on that mailbox's pending approval step, just as the approver would when processing the request manually.

The example uses a static Insufficient vacation balance rejection reason. A dynamic reason can be used if the external API already returns an appropriate message that can be passed to the rejection operation.

AI Review of a Membership Application

This example uses AI to review a membership application and automatically write the generated result back into the envelope. The workflow extracts the applicant's answer, builds an AI prompt, sends it to OpenAI, converts the AI response into XML, and fills the aiSummary field in the envelope.

The workflow uses the following automation types:

Template structure

The example template uses two roles and two fields on the same document:

  • Role 0 — applicant fills applicationText.

  • Role 1 — assignee owns the empty aiSummary field that is populated by the automation.

When the applicant sends the envelope with applicationText completed, the envelope moves to WAITING. The automation catches the envelope when Role 1 becomes active.

Build the AI prompt

Use parameter-extractor with the xpath executor to build a prompt from the value of applicationText.

The prompt output parameter is passed directly to the next openai operation. Because the parameter name matches the prompt input expected by openai, the prompt property can be omitted from the OpenAI operation configuration.

Configure the AI operation

The openai automation type requires a stored OpenAI credential. Create it first:

A successful request returns the credential ID:

Use this value as credentialsId in the openai workflow item.

The openai operation can then be configured as follows:

The same workflow can use gemini instead of openai. The credential type, credentialsId, and automation type must be changed accordingly.

Convert the AI response

The AI response is JSON, while envelope-filler ultimately requires an XML fill payload. Use json2xml-converter before the XSLT transformation.

For an OpenAI response with the following shape:

json2xml-converter produces XML in which the response text can be selected with:

Use this XPath in the following xslt-converter operation when building the envelope fill payload.

Build the envelope fill payload

The xslt-converter must create the XML structure expected by the envelope fill operation. The generated payload includes the target field and places the AI response into aiSummary.

The template UUID, template version, and role mailbox UUIDs are static values for the template used by this automation. The AI-generated response is inserted dynamically into the aiSummary field.

Automation payload

When the workflow completes successfully, envelope-filler writes the generated text into aiSummary. In the verified scenario, Role 1 is the last active role, so filling the field completes the envelope and moves it from WAITING to COMPLETED.

Last updated

Was this helpful?