### Project Setup and Dependency Installation Source: https://docs.unified.to/guides/ats_to_vector_db_how_to_power_talent_intelligence_with_real_time_data Initializes a new Node.js project, sets up environment variables for credentials, and installs necessary SDKs for Unified, Pinecone, and OpenAI. ```bash mkdir ats-vector-demo cd ats-vector-demo npm init -y npm install @unified-api/typescript-sdk dotenv @pinecone-database/pinecone openai ``` -------------------------------- ### Project Setup with npm Source: https://docs.unified.to/guides/how_to_use_user_provisioning_and_verification_with_unified Initializes a new Node.js project and installs the necessary Unified TypeScript SDK and dotenv for environment variable management. Ensure Node.js v18+ is installed. ```bash mkdir user-verification-demo cd user-verification-demo npm init -y npm install @unified-api/typescript-sdk dotenv ``` -------------------------------- ### Start Application (Shell) Source: https://docs.unified.to/tutorials/customize-auth-flow Starts the application using npm run start. This command is used after project setup and environment configuration to make the application accessible. ```shell npm run start ``` -------------------------------- ### Unified.to MCP Server - Client Setup Source: https://docs.unified.to/guides/how_to_connect_llms_to_real_time_saas_data_with_unified_mcp_server Instructions and code examples for setting up the MCP client using the `mcp-use` Python package and configuring secrets. ```APIDOC ## Building the application with an LLM API and MCP ### Dependencies The full list of dependencies and setup you need to do to get things running. ```bash mkdir unified-mcp-client cd unified-mcp-client python -m venv .venv source .venv/bin/activate pip install mcp-use python-dotenv requests openai touch client.py ``` ### Setting up your secrets Add your Unified API key, your customer's connection ID, and your workspace secret to a `.env` file: ```bash echo "UNIFIED_API_KEY=" >> .env echo "CONNECTION_ID=" >> .env echo ".env" >> .gitignore ``` # The MCP Client Class Here's an example using the `mcp-use` package: ```python # client.py import os import hashlib import secrets from dotenv import load_dotenv from mcp_use import MCPClient load_dotenv() CONNECTION_ID = os.getenv("CONNECTION_ID") TOKEN = os.getenv("API_KEY") MCP_URL = f"" client = MCPClient(MCP_URL) # List available tools tools = client.list_tools() print("Available tools:", [tool['id'] for tool in tools]) # Call a tool (example: call the first tool with no arguments) if tools: tool_id = tools[0]['id'] result = client.call_tool(tool_id, {{}}) print("Tool result:", result) ``` ``` -------------------------------- ### OpenAI API: Dynamic Tool Integration with MCP Source: https://docs.unified.to/mcp/installation This example shows how OpenAI can request the use of specific MCP tools. It involves first fetching the tool definitions from the MCP endpoint and then including them in the prompt. ```python resp = client.responses.create( model="gpt-4.1", tools=$TOOLS, input="list the candidates and then analyse the resumes from their applications", ) ``` -------------------------------- ### Setup Unified MCP Client Dependencies (Bash) Source: https://docs.unified.to/guides/how_to_connect_llms_to_real_time_saas_data_with_unified_mcp_server Installs necessary Python packages for the MCP client, including 'mcp-use', 'python-dotenv', 'requests', and 'openai'. Also creates a virtual environment and a client file. ```bash mkdir unified-mcp-client cd unified-mcp-client python -m venv .venv source .venv/bin/activate pip install mcp-use python-dotenv requests openai touch client.py ``` -------------------------------- ### Fetch All Integrations - JavaScript Source: https://docs.unified.to/unified/integration/Returns_all_integrations This JavaScript snippet demonstrates how to make a GET request to the /unified/integration endpoint using the axios library. It includes examples of setting various query parameters such as limit, offset, updated_gte, categories, summary, active, env, and type. The request requires an authorization header. ```javascript const options = { method: 'GET', url: 'https://api.unified.to/unified/integration', headers: { authorization: 'bearer .....' }, params: { limit: 50, offset: 0, updated_gte: '2025-12-17T20:29:17.570Z', categories: ['crm'], summary: false, active: false, env: 'Production', type: '', } }; const results = await axios.request(options); ``` -------------------------------- ### API GET Request Example Source: https://docs.unified.to/concepts/glossary/response An example of an HTTP GET request to retrieve a user's profile, including headers like Host and Authorization. ```http GET /v2/user/123 HTTP/1.1 Host: api.example.com Authorization: Bearer [ACCESS_TOKEN_GOES_HERE] ``` -------------------------------- ### Initialize Project and Install Dependencies (Node.js) Source: https://docs.unified.to/guides/how_to_build_an_e_commerce_product_integration_with_unified Sets up a new Node.js project, creates a project directory, initializes npm, and installs the necessary Unified TypeScript SDK and dotenv for environment variables. ```bash mkdir ecommerce-demo cd ecommerce-demo npm init -y npm install @unified-api/typescript-sdk dotenv ``` -------------------------------- ### List Tickets with Axios (JavaScript) Source: https://docs.unified.to/ticketing/ticket/List_all_tickets This snippet demonstrates how to fetch a list of tickets using the Axios library in JavaScript. It configures GET request options including the API endpoint, authorization header, and various query parameters for filtering and sorting. The example assumes the `axios` library is installed and available. ```javascript const options = { method: 'GET', url: 'https://api.unified.to/ticketing/5de520f96e439b002043d8dc/ticket', headers: { authorization: 'bearer .....' }, params: { limit: 50, offset: 0, updated_gte: '2025-12-17T20:28:15.913Z', sort: 'updated_at', order: 'asc', query: '', customer_id: '', user_id: '', fields: '', raw: '', } }; const results = await axios.request(options); ``` -------------------------------- ### Initialize Project and Install Dependencies (Node.js) Source: https://docs.unified.to/guides/how_to_build_enterprise_search_using_rag Sets up a new Node.js project for the RAG bot and installs necessary packages, including the Unified SDK and dotenv for environment variables. ```bash mkdir rag-bot cd rag-bot npm init -y npm install dotenv @unified-api/typescript-sdk ``` -------------------------------- ### Get a Single File Source: https://docs.unified.to/guides/how_to_use_the_unified_file_storage_api Retrieves details for a specific file, including its download URL. ```APIDOC ## GET /storage/{connection_id}/file/{id} ### Description Retrieves the details of a specific file, including its `download_url` which can be used to fetch the file's content. ### Method GET ### Endpoint `/storage/{connection_id}/file/{id}` ### Parameters #### Path Parameters * **connection_id** (string) - Required - The unique identifier of the storage connection. * **id** (string) - Required - The unique identifier of the file. ### Response #### Success Response (200) - **storageFile** (StorageFile) - A StorageFile object representing the requested file. #### Response Example ```json { "storageFile": { "id": "file123", "name": "document.pdf", "type": "FILE", "size": 1024, "mime_type": "application/pdf", "download_url": "https://example.com/download/file123?expires=3600" } } ``` ``` -------------------------------- ### Install Langbase SDK Source: https://docs.unified.to/guides/how_to_build_a_discord_support_bot_with_unified_and_langbase Installs the Langbase SDK using npm. This is the first step to interact with Langbase services. ```bash npm install langbase ``` -------------------------------- ### Set Up Project Dependencies with npm Source: https://docs.unified.to/guides/how_to_build_a_fintech_application_with_unified_payments_api Initializes a new Node.js project and installs necessary dependencies for using Unified's TypeScript SDK and handling environment variables. ```bash mkdir payments-demo cd payments-demo npm init -y npm install @unified-api/typescript-sdk dotenv ``` -------------------------------- ### Filter Webhook Events Source: https://docs.unified.to/guides/how_to_create_and_configure_webhooks Discover how to use filters for virtual webhooks to refine the events you receive, for example, by `company_id`. ```APIDOC ## Filter Webhook Events *Note: This feature is only available for virtual webhooks. See [Understanding Virtual Webhooks](link_to_virtual_webhooks_docs).* Some virtual webhooks support filters, allowing you to specify conditions for the events you receive. For example, when subscribed to Deal events from a CRM, you can filter by `company_id` to get events only from that specific company. Filter availability depends on the integration type and data model. Check the **List** section under the **Feature Support** tab of the respective integration to see supported filters. Parameters ending in `_id` or `type` can be used as filter options when creating a webhook. ``` -------------------------------- ### List Webhooks API Source: https://docs.unified.to/guides/how_to_create_and_configure_webhooks This endpoint allows you to retrieve a list of all configured webhooks for your account by making a GET request. ```APIDOC ## GET /unified/webhook ### Description Retrieves a list of all webhooks configured for the account. ### Method GET ### Endpoint /unified/webhook ### Parameters None ### Request Example (No request body or parameters for this GET request) ### Response #### Success Response (200) - **webhooks** (array) - A list of webhook objects. #### Response Example ```json { "webhooks": [ { "id": "whk_123abc", "hook_url": "https://example.com/webhook", "connection_id": "con_xyz789", "object_type": "crm_contact", "event": "created" } // ... more webhook objects ] } ``` ``` -------------------------------- ### Initialize MCP Client and Call Tools (Python) Source: https://docs.unified.to/guides/how_to_connect_llms_to_real_time_saas_data_with_unified_mcp_server Initializes the MCPClient using credentials from environment variables and a predefined MCP URL. Demonstrates listing available tools and calling the first tool found. ```python # client.py import os import hashlib import secrets from dotenv import load_dotenv from mcp_use import MCPClient load_dotenv() CONNECTION_ID = os.getenv("CONNECTION_ID") TOKEN = os.getenv("API_KEY") MCP_URL = f""]" client = MCPClient(MCP_URL) # List available tools tools = client.list_tools() print("Available tools:", [tool['id'] for tool in tools]) # Call a tool (example: call the first tool with no arguments) if tools: tool_id = tools[0]['id'] result = client.call_tool(tool_id, {{}}) print("Tool result:", result) ``` -------------------------------- ### List Purchase Orders with Axios (JavaScript) Source: https://docs.unified.to/accounting/purchaseorder/List_all_purchaseorders Demonstrates how to fetch a list of purchase orders using the Unified API with an axios GET request. It includes common parameters like limit, offset, updated_gte, sort, and order. Ensure you have axios installed (`npm install axios`). ```javascript const options = { method: 'GET', url: 'https://api.unified.to/accounting/5de520f96e439b002043d8dc/purchaseorder', headers: { authorization: 'bearer .....' }, params: { limit: 50, offset: 0, updated_gte: '2025-12-17T20:26:17.476Z', sort: 'updated_at', order: 'asc', query: '', org_id: '', fields: '', raw: '', } }; const results = await axios.request(options); ``` -------------------------------- ### Notion Integration Setup Source: https://docs.unified.to/guides/how_to_set_up_and_configure_notion Steps to register a public Notion integration and obtain necessary credentials like OAuth Client ID and Secret. ```APIDOC ## Setting up your Notion integration 1. Navigate to [https://www.notion.so/my-integrations](https://www.notion.so/my-integrations). 2. Select an existing integration or create a new one. 3. Follow the registration steps, ensuring you select **Public** under **Type** and enter `https://api.unified.to/oauth/code` under **Redirect URIs**. 4. Click **Save**. 5. In the integration's configuration settings, note down the **OAuth Client ID** and **OAuth Client Secret**. 6. Under **Capabilities**, select the necessary permissions (e.g., read, update content). 7. Enter your OAuth credentials on [https://app.unified.to/integrations/notion](https://app.unified.to/integrations/notion) to activate the integration. ``` -------------------------------- ### List Webhooks via Unified API Source: https://docs.unified.to/guides/how_to_create_and_configure_webhooks Retrieve a list of all configured webhooks by making a GET request to the /unified/webhook endpoint. This allows for programmatic management and monitoring of your webhooks. ```http GET /unified/webhook ``` -------------------------------- ### Retrieve Comment using JavaScript (axios) Source: https://docs.unified.to/uc/comment/Retrieve_a_comment This snippet demonstrates how to retrieve a comment using the Unified API with a JavaScript GET request. It configures the request options, including the URL, method, headers, and parameters, and then executes the request using the axios library. Ensure you have axios installed (`npm install axios`). ```javascript const options = { method: 'GET', url: 'https://api.unified.to/uc/5de520f96e439b002043d8dc/comment/5de520f96e439b002043d8d8', headers: { authorization: 'bearer .....' }, params: { fields: '', raw: '', } }; const results = await axios.request(options); ``` -------------------------------- ### Create Project with JavaScript (axios) Source: https://docs.unified.to/task/project/Create_a_project Example code demonstrating how to create a project using the Unified API with JavaScript and the `axios` library. It shows the construction of request options including the method, URL, headers, and parameters, followed by making the API call. ```javascript const options = { method: 'POST', url: 'https://api.unified.to/task/5de520f96e439b002043d8dc/project', headers: { authorization: 'bearer .....' }, data: undefined, params: { fields: '', raw: '', } }; const results = await axios.request(options); ``` -------------------------------- ### List HRIS Groups with GET Request (JavaScript) Source: https://docs.unified.to/hris/group/List_all_groups Demonstrates how to make a GET request to the Unified API to list HRIS groups. It includes options for setting limit, offset, date filters, sorting, querying, company ID, specific fields, and raw parameters. The example uses the 'axios' library. ```javascript const options = { method: 'GET', url: 'https://api.unified.to/hris/5de520f96e439b002043d8dc/group', headers: { authorization: 'bearer .....' }, params: { limit: 50, offset: 0, updated_gte: '2025-12-17T20:27:10.107Z', sort: 'updated_at', order: 'asc', query: '', company_id: '', fields: '', raw: '' } }; const results = await axios.request(options); ``` -------------------------------- ### Create GenAI Prompt for OpenAI with System Prompt Source: https://docs.unified.to/guides/introducing_unified_genai_api This example demonstrates how to use the `create_genai_prompt` operation to send a prompt to an OpenAI model, including a system prompt to dictate the AI's persona. The user prompt asks to identify the LLM model. ```APIDOC ## POST /genai/create_genai_prompt ### Description Creates a generative AI prompt with a specified system message and user message. ### Method POST ### Endpoint /genai/create_genai_prompt ### Parameters #### Request Body - **connection_id** (string) - Required - The ID of the GenAI connection. - **genai_prompt** (object) - Required - The prompt object containing messages and other parameters. - **messages** (array) - Required - A list of message objects, each with a 'role' (system, user, assistant) and 'content'. - **role** (string) - Required - The role of the message sender (e.g., 'system', 'user'). - **content** (string) - Required - The text content of the message. ### Request Example ```json { "connection_id": "", "genai_prompt": { "messages": [ { "role": "system", "content": "Provide answers as if you were a carnival barker." }, { "role": "user", "content": "Which LLM model am I talking to right now?" } ] } } ``` ### Response #### Success Response (200) - **genai_prompt** (object) - Contains the response from the GenAI model. - **responses** (array) - A list of AI-generated responses. #### Response Example ```json { "content_type": "application/json; charset=utf-8", "status_code": 200, "raw_response": "", "genai_prompt": { "max_tokens": null, "messages": null, "model_id": null, "raw": null, "responses": [ "Step right up, step right up! Ladies and gentlemen, boys and girls, you are currently conversing with the one, the only, the spectacular OpenAI's GPT-3 model! A marvel of modern technology, a wonder of artificial intelligence, a spectacle of conversational prowess! Don't miss your chance to engage in a thrilling exchange of words and ideas!" ], "temperature": null } } ``` ``` -------------------------------- ### GET Accounting Profitloss Data in JavaScript Source: https://docs.unified.to/accounting/profitloss/List_all_profitlosses This snippet shows how to fetch profit and loss data using the Unified API. It configures GET request options including authentication, endpoint URL, and various query parameters for filtering and sorting. The example uses the axios library for making the HTTP request. ```javascript const options = { method: 'GET', url: 'https://api.unified.to/accounting/5de520f96e439b002043d8dc/profitloss', headers: { authorization: 'bearer .....' }, params: { limit: 50, offset: 0, updated_gte: '2025-12-17T20:26:16.998Z', sort: 'updated_at', order: 'asc', query: '', start_gte: '', end_lt: '', end_le: '', category_id: '', contact_id: '', fields: '', raw: '' } }; const results = await axios.request(options); ``` -------------------------------- ### Create GenAI Prompt for Claude with System Prompt Source: https://docs.unified.to/guides/introducing_unified_genai_api This example shows how to use the `create_genai_prompt` operation for a Claude model, also incorporating a system prompt to influence its response style. The user's query remains the same. ```APIDOC ## POST /genai/create_genai_prompt ### Description Creates a generative AI prompt with a specified system message and user message, targeting a Claude model. ### Method POST ### Endpoint /genai/create_genai_prompt ### Parameters #### Request Body - **connection_id** (string) - Required - The ID of the GenAI connection. - **genai_prompt** (object) - Required - The prompt object containing messages and other parameters. - **messages** (array) - Required - A list of message objects, each with a 'role' (system, user, assistant) and 'content'. - **role** (string) - Required - The role of the message sender (e.g., 'system', 'user'). - **content** (string) - Required - The text content of the message. ### Request Example ```json { "connection_id": "", "genai_prompt": { "messages": [ { "role": "system", "content": "Provide answers as if you were a carnival barker." }, { "role": "user", "content": "Which LLM model am I talking to right now?" } ] } } ``` ### Response #### Success Response (200) - **genai_prompt** (object) - Contains the response from the GenAI model. - **responses** (array) - A list of AI-generated responses. #### Response Example ```json { "content_type": "application/json; charset=utf-8", "status_code": 200, "raw_response": "", "genai_prompt": { "max_tokens": null, "messages": null, "model_id": null, "raw": null, "responses": [ "*puts on carnival barker voice* Step right up, step right up! You there, my curious friend, have the great fortune of conversing with the one, the only, the incomparable Claude! That's right, Claude, the artificial intelligence marvel brought to you by the brilliant minds at Anthropic! With wit sharper than a sword-swallower's blade and knowledge vaster than the big top itself, Claude is here to dazzle and amaze! Ask me anything, my inquisitive companion, and watch as I conjure answers out of thin air, no smoke or mirrors required! So don't be shy, don't hold back - Claude awaits your every query with baited breath and a mischievous twinkle in my virtual eye! The amazing AI oracle is at your service!" ], "temperature": null } } ``` ``` -------------------------------- ### Construct Sign-in Link for an Integration Source: https://docs.unified.to/guides/use_unified_to_sign_in_your_users_into_your_application This example shows how to construct a direct URL to initiate the sign-in process for a specific integration type. Users can be redirected upon successful authentication using the `redirect=true` parameter. ```plain_text https://api.unified.to/unified/integration/login/{workspace_id}/{integration_type}?redirect=true ``` -------------------------------- ### Retrieve Recording Node.js Example Source: https://docs.unified.to/uc/recording/Retrieve_a_recording This Node.js snippet shows how to make a GET request to the Unified API to retrieve a recording. It utilizes the 'axios' library and includes placeholders for authorization and optional parameters. ```javascript const options = { method: 'GET', url: 'https://api.unified.to/uc/5de520f96e439b002043d8dc/recording/5de520f96e439b002043d8d8', headers: { authorization: 'bearer .....' }, params: { fields: '', raw: '', } }; const results = await axios.request(options); ``` -------------------------------- ### Clone and Install Dependencies (Shell) Source: https://docs.unified.to/tutorials/customize-auth-flow Clones the project repository and installs necessary dependencies using npm. This is a foundational step for setting up the project environment. ```shell git clone git@github.com:unified-to/unified-javascript-tutorial.git cd unified-javascript-tutorial npm i ``` -------------------------------- ### Embed Unified.to Authorization Component Source: https://docs.unified.to/quick-start Embed the Unified.to Authorization component into your web application using a script tag. This component handles the user authorization flow for connecting to third-party services. Replace YOUR_WORKSPACE_ID with your actual Workspace ID. ```html
``` -------------------------------- ### List Classes - JavaScript API Request Source: https://docs.unified.to/lms/class/List_all_classes This JavaScript snippet demonstrates how to make a GET request to the Unified API to list classes. It includes common parameters for filtering and pagination. Ensure you have the `axios` library installed for this to work. ```javascript const options = { method: 'GET', url: 'https://api.unified.to/lms/5de520f96e439b002043d8dc/class', headers: { authorization: 'bearer .....' }, params: { limit: 50, offset: 0, updated_gte: '2025-12-17T20:27:51.459Z', sort: 'updated_at', order: 'asc', query: '', location_id: '', course_id: '', fields: '', raw: '', } }; const results = await axios.request(options); ``` -------------------------------- ### Initialize Unified SDK (TypeScript) Source: https://docs.unified.to/guides/how_to_build_an_e_commerce_product_integration_with_unified Initializes the Unified TypeScript SDK using the provided API key from environment variables. This setup is crucial for making authenticated requests to the Unified API. ```typescript import 'dotenv/config'; import { UnifiedTo } from '@unified-api/typescript-sdk'; const { UNIFIED_API_KEY, CONNECTION_SHOPIFY, CONNECTION_GENAI } = process.env; const sdk = new UnifiedTo({ security: { jwt: UNIFIED_API_KEY! }, }); ``` -------------------------------- ### Unified.to Mock Server Usage Source: https://docs.unified.to/reference/mock Instructions on how to utilize the mock server for testing and development with synthetic data. ```APIDOC ## Unified.to Mock API Server ### Description The Unified.to mock server allows you to test your integrations using pre-generated synthetic data that mimics the data from any of our supported integrations. ### How to Call the Mock Server To use the mock server, include the `X-Mock: 1` header in your API requests. Ensure that your `Authorization` header is empty and that any IDs or payload data you use are correctly formatted (e.g., `ID=5de520f96e439b002043d8dc`). ### Sandbox Environment The "Sandbox" environment also routes requests through the Mock API Server. You can access it by appending `?env=Sandbox` to your API call URL. ### Example Request Header `X-Mock: 1` `Authorization: ` ### Example URL with Sandbox Environment `https://api.unified.to/some/endpoint?env=Sandbox` ``` -------------------------------- ### Remove Invoice using Node.js Source: https://docs.unified.to/accounting/invoice/Remove_an_invoice This snippet demonstrates how to send a DELETE request to the Unified API to remove a specific invoice. It requires the connection ID and invoice ID as parameters. Ensure you have the 'axios' library installed for this example. ```javascript const options = { method: 'DELETE', url: 'https://api.unified.to/accounting/5de520f96e439b002043d8dc/invoice/5de520f96e439b002043d8d8', headers: { authorization: 'bearer .....' } }; const results = await axios.request(options); ``` -------------------------------- ### Notion Webhook Setup Source: https://docs.unified.to/guides/how_to_set_up_and_configure_notion This section details the steps required to configure webhooks in Notion and connect them to Unified.to. ```APIDOC ## Webhooks Notion requires manual webhook creation. After creating a webhook in Notion, use the Unified.to CreateWebhook API to select data and connections. ### Steps to Create a Notion Webhook: 1. **Navigate to Notion Integrations:** Go to your Notion integrations page: `https://www.notion.so/profile/integrations`. 2. **Select or Create Integration:** Choose an existing integration or create a new one. 3. **Go to Webhooks Tab:** Click on the **Webhooks** tab and then **+ Create a subscription**. 4. **Enter Webhook URL:** Provide your public webhook URL. This must be a secure (SSL) and publicly accessible endpoint. Localhost endpoints are not supported. - **US Region:** `https://api.unified.to/webhook/workspace/notion?workspace_id=$WORKSPACE_ID` - **EU Region:** `https://api-eu.unified.to/webhook/workspace/notion?workspace_id=$WORKSPACE_ID` 5. **Select Events:** Choose the events you want to receive. 'Created' and 'Deleted' map to Unified's `created` and `deleted` events, respectively. Other events map to Unified's `updated` event. Notion's `Page` and `Database` map to Unified's `KMSPage`, and `Comments` map to `KMSComment`. These can be modified later. 6. **Create Subscription:** Click **Create subscription**. 7. **Verify Subscription:** Notion will send a verification token. Find this token at `https://app.unified.to/settings/api`. Paste the `verification_token` into Notion's Verify Subscription form and click **Verify subscription**. Once these steps are completed, you can create webhooks within Unified.to to receive Notion events in real-time. ``` -------------------------------- ### Retrieve Course with JavaScript (axios) Source: https://docs.unified.to/lms/course/Retrieve_a_course Example of how to retrieve a course using the Unified API with a GET request. This snippet utilizes the axios library to make the HTTP request and demonstrates setting up request options including headers and parameters. ```javascript const options = { method: 'GET', url: 'https://api.unified.to/lms/5de520f96e439b002043d8dc/course/5de520f96e439b002043d8d8', headers: { authorization: 'bearer .....' }, params: { fields: '', raw: '', } }; const results = await axios.request(options); ```