Custom integrations let you connect any API-enabled tool to an assistant. This opens up endless possibilities. Below you find a comprehensive guide on how to build integrations, actions, and triggers.
Build integration
to get started.
Next, specify an integration name and upload an icon (shown in chat when using actions and in the integrations overview). Add a description to help assistants know when to use this integration. Hit Save
to create it.
Build
tab. Select your authentication type and configure it following the steps below:
data.auth.fieldId
.
Use the built-in ld.request
and ld.log
functions for requests and logging.
Test your action and create your first connection.
client ID
and secret, add them to Langdock in step 4, save the OAuth Redirect URL
, and enable the Google Calendar API.
Change Authorization URL
Check the OAuth documentation for your service and extract the Authorization URL
. Usually, changing the BASE_URL
in our template is sufficient.
For Google Calendar:
Access Token URL
and Refresh Token URL
. Usually, updating the tokenUrl
in our template works.
For Google Calendar:
const tokenUrl ='https://oauth2.googleapis.com/token';
Test Authentication Setup
Provide a test API endpoint (like /me
) to verify authentication. The return value of that test request can be used inside the OAuth Client Label to influence the naming of the established connections. You can access the return value via: {{data.input}}
For Google Calendar: Google Sheets - {{data.input.useremail.value}}
Test by adding a connection and verifying the authorization flow works.
For Google Calendar, we test with:
None
for publicly available APIs without authentication.
Type | Purpose | Notes |
---|---|---|
TEXT | Short text input | Single line text |
MULTI_LINE_TEXT | Long text input | Multiple lines, good for descriptions |
NUMBER | Numeric input | Integers or decimals |
BOOLEAN | True/false toggle | Checkbox input |
SELECT | Dropdown options | Pre-defined choices |
FILE | File upload | Single or multiple files (see file support guide) |
OBJECT | Complex data | JSON objects with custom schema |
PASSWORD | Sensitive text | Hidden input for secrets |
data.input.{inputFieldId}
for input field values and data.auth.{authenticationFieldId}
for authentication field values from the user’s current connection.
ld.request()
creates a web request using the format specified by the passed object and returns the response. The parameters must be valid JSON objects since JSON.stringify()
is called internally. For complex JSON objects, you’ll need to apply JSON.parse()
first.
ld.log()
outputs the passed values to the Logs field, which appears below the Test Action
button after running an action.
Example usage from the Google Calendar integration:
JSON.stringify()
(converting a JavaScript JSON object into a string) and JSON.parse()
(converting a string into a JavaScript JSON object) are available in custom code blocks.
The parameters passed to the ld.request()
function must be valid JSON objects since JSON.stringify()
is called internally. For complex JSON structures, you’ll need to apply JSON.parse()
beforehand to ensure proper formatting.
Example usage from the HubSpot integration:
btoa()
encodes a string to Base64, while atob()
decodes a Base64 string back to plain text.
Example usage:
Custom integration code runs in a secure sandboxed environment.
You cannot install or import external libraries (npm, pip, etc.)—only a limited set of built-in JavaScript/Node.js APIs are available.
For advanced processing (e.g., PDF parsing, image manipulation), use external APIs or services and call them from your integration code.
ld.log()
to help with debuggingGet deal context
function for HubSpot uses GET endpoints to gather internal IDs for available pipelines and stages. This enables assistants to use actions like Create deal
or Update deal
much more effectively since they now have the required context.