### List Customers Request Example Source: https://dev.landbot.io/api-reference/platform/tag/customers/get/customers Example of how to make a GET request to the customers endpoint with various query parameters. ```Shell curl 'https://api.landbot.io/v1/customers/?channel_id=1&agent_id=1&search_by=name&search=&archived=true&opt_in=true&offset=0&limit=20' \ --header 'Authorization: YOUR_SECRET_TOKEN' ``` -------------------------------- ### List Channels Request Example Source: https://dev.landbot.io/api-reference/platform/tag/channels/get/channels Demonstrates how to make a GET request to the /channels/ endpoint to retrieve a list of channels, with parameters for type, active status, offset, and limit. ```Shell curl 'https://api.landbot.io/v1/channels/?type=facebook&active=true&offset=0&limit=20' \ --header 'Authorization: YOUR_SECRET_TOKEN' ``` -------------------------------- ### Project Setup for Landbot-Telegram Bridge Source: https://dev.landbot.io/guides/cookbook/bridge-a-channel Initializes a new Node.js project and installs the Express framework for building the bridge server. ```bash mkdir landbot-telegram-bridge && cd $_ npm init -y npm install express ``` -------------------------------- ### Configuration URL Examples Source: https://dev.landbot.io/guides/key-concepts These URLs are used to fetch the JSON representation of a bot for use with the Widgets and Core SDKs. Replace index.json with index.html to get the rendered hosted page. ```text https://chats.landbot.io/u/H-XXXXXX-YYYYYYY/index.json ``` ```text https://landbot.pro/v3/H-XXXXXX-YYYYYYY/index.json ``` -------------------------------- ### Authentication Example Source: https://dev.landbot.io/api-reference/apichat-api How to authenticate requests using a channel token. Replace `` with your actual token. ```text Token ``` -------------------------------- ### List Customers Response Example Source: https://dev.landbot.io/api-reference/platform/tag/customers/get/customers Example of a successful JSON response when listing customers, including total count and customer details. ```JSON { "success": true, "total": 2000, "customers": [ { "id": 42, "name": "Ataulfo", "channel_id": 1, "avatar": "https://octodex.github.com/images/dojocat.jpg", "last_message": 1493285931.828493, "unread": false, "archived": false, "agent_id": 1, "register_date": 1491480847.264482, "custom_fields": { "email": { "value": "api@helloumi.com", "type": "string", "extra": {}, "name": "email" }, "payment_date": { "value": 1491480957.264482, "type": "datetime", "extra": {}, "name": "payment_date" } }, "meta_data": {} } ] } ``` -------------------------------- ### Authentication Example Source: https://dev.landbot.io/api-reference/apichat-api/description/introduction Demonstrates how to authenticate with the APIchat channel using a channel token. ```shell curl -X GET https://chat.landbot.io/v1/chat \ -H "Authorization: Token " ``` -------------------------------- ### Install @landbot/core via npm Source: https://dev.landbot.io/sdks/core/install Install the @landbot/core package from npm. This is the standard method for projects using bundlers like Vite or webpack. ```bash npm install @landbot/core ``` -------------------------------- ### Fetch Workspace Channels (Python) Source: https://dev.landbot.io/guides/quickstart This Python example uses the requests library to fetch channels. Remember to substitute 'YOUR_AGENT_TOKEN' with your agent token. ```python import requests res = requests.get( 'https://api.landbot.io/v1/channels/', headers={ 'Authorization': 'Token YOUR_AGENT_TOKEN', 'Content-Type': 'application/json', }, ) print(res.json()) ``` -------------------------------- ### Shell Curl Example Source: https://dev.landbot.io/api-reference/apichat-api An example of how to interact with the API using Shell Curl. ```shell curl -X POST \ https://chat.landbot.io/v1/chat/message \ -H 'Authorization: Token ' \ -H 'Content-Type: application/json' \ -d '{ "message": "Ask a question to get started" }' ``` -------------------------------- ### Example JSON Response for Get Customer Field Source: https://dev.landbot.io/api-reference/platform/tag/customer-fields/get/customers/customer_id/fields/field_name This is an example of a successful JSON response when retrieving a customer's field value. It includes the field's name, type, and its associated value. ```json { "success": true, "field": { "name": "phone", "type": "integer", "extra": {}, "value": 630027430 } } ``` -------------------------------- ### Shell Curl Example Source: https://dev.landbot.io/api-reference/platform/description/introduction Example of how to make an API request using curl in a shell environment. ```shell Shell Curl ``` -------------------------------- ### List Channels Response Example Source: https://dev.landbot.io/api-reference/platform/tag/channels/get/channels Shows the structure of a successful JSON response when listing channels, including total count and channel details. ```JSON { "success": true, "total": 20, "channels": [ { "id": 32, "name": "Facebook Test", "type": "facebook", "active": true, "created_at": 1487261343.857799, "facebook_id": "508675412663271" } ] } ``` -------------------------------- ### Assign Customer to Bot Source: https://dev.landbot.io/api-reference/platform/tag/customers/put/customers/customer_id/assign_bot/bot_id Assigns the customer with `customer_id` to the bot with `bot_id`. By default, the bot starts immediately at its `start` node. ```APIDOC ## PUT /customers/{customer_id}/assign_bot/{bot_id}/ ### Description Assigns the customer with `customer_id` to the bot with `bot_id`. By default the bot starts immediately at its `start` node. ### Method PUT ### Endpoint /customers/{customer_id}/assign_bot/{bot_id}/ ### Parameters #### Path Parameters - **customer_id** (integer) - Required - Identifier of the customer. - **bot_id** (integer) - Required - Identifier of the bot to assign the customer to. #### Request Body - **launch** (boolean) - Optional - Default: true - If `true`, the bot starts immediately. If `false`, the bot waits until the customer sends a message. - **node** (string) - Optional - Node reference to start the bot from. Defaults to the `start` node. Right-click a node in the builder and choose **Copy reference** to obtain it. ### Request Example ```json { "launch": false, "node": "Nk879f44j" } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the operation succeeded. #### Response Example ```json { "success": true } ``` ``` -------------------------------- ### Get All Customers Source: https://dev.landbot.io/api-reference/platform/tag/customers Retrieves a list of all customers. ```APIDOC ## GET /customers/ ### Description Retrieves a list of all customers. ### Method GET ### Endpoint /customers/ ``` -------------------------------- ### Customer Update Response Example Source: https://dev.landbot.io/api-reference/apichat-api/tag/customers/put/customers/customer_token This is a sample JSON response indicating a successful customer update. It includes the updated customer object with its fields. ```json { "success": true, "customer": { "id": 42, "name": "Sam", "phone": null, "email": "sam@helloumi.com", "postal_code": "46021", "country": "GB", "token": "SDFRL4TOMFTEWERY262NF" } } ``` -------------------------------- ### Initialize Landbot.Core and Get Conversation History Source: https://dev.landbot.io/sdks/core/api/core Call init() to initialize the core instance and retrieve the conversation history. The returned Promise resolves with data.messages, which may be empty. Subscribe to pipelines before calling init() to ensure welcome messages are captured. ```javascript core.init().then(function (data) { console.log(data.messages); }); ``` -------------------------------- ### AI Agent Output with UI Widgets Source: https://dev.landbot.io/guides/cookbook/ai-agent-app An example of an AI agent's reply, containing prose and UI widget markers. The front-end parses these markers to render components. ```text Here's where things stand this month. [[ui:{"component":"stats","props":{"items":[{"label":"MRR","value":"$1.32M","dir":"up"}}]}}]] [[ui:{"component":"replies","props":{"options":[{"label":"By region","value":"Show revenue by region"}]}}]] ``` -------------------------------- ### Dynamic UI Marker with Field Interpolation Source: https://dev.landbot.io/guides/cookbook/conversational-app This example shows how to make the UI marker dynamic by interpolating a Landbot field. The `@{ui_signal}` is resolved server-side by Landbot, allowing the marker to be computed per user. This marker is also placed on an input block's prompt. ```text [[ui:@{ui_signal}]] … ``` -------------------------------- ### Assign Customer to Bot (Shell Curl) Source: https://dev.landbot.io/api-reference/platform/tag/customers/put/customers/customer_id/assign_bot/bot_id Use this cURL command to assign a customer to a bot. You can control whether the bot launches immediately and specify a starting node. ```shell curl https://api.landbot.io/v1/customers/1/assign_bot/1/ \ --request PUT \ --header 'Content-Type: application/json' \ --header 'Authorization: YOUR_SECRET_TOKEN' \ --data '{ "launch": false, "node": "Nk879f44j" }' ``` -------------------------------- ### Create Message Hook Request Example Source: https://dev.landbot.io/api-reference/platform/tag/message-hooks/post/channels/channel_id/message_hooks Use this cURL command to register a new message hook for a channel. Ensure you replace 'YOUR_SECRET_TOKEN' with your actual token and provide the correct channel ID. ```Shell curl https://api.landbot.io/v1/channels/1/message_hooks/ \ --request POST \ --header 'Content-Type: application/json' \ --header 'Authorization: YOUR_SECRET_TOKEN' \ --data '{ \ "url": "https://api.test.com/landbot/", \ "token": "1234567890qwerty", \ "name": "1234 Hook" \ }' ``` -------------------------------- ### Successful Response Example Source: https://dev.landbot.io/api-reference/apichat-api/tag/send/post/send/customer_token This JSON shows a successful response when a message is accepted and the customer is created or updated. It includes customer details and a success status. ```json { "success": true, "customer": { "id": 42, "name": "Samuel", "phone": "34697882898", "email": "sam@helloumi.com", "postal_code": "46021", "country": "GB", "token": "SDFRL4TOMFTEWERY262NF" } } ``` -------------------------------- ### Fetch Filtered and Paginated Customers Source: https://dev.landbot.io/guides/pagination Example using curl to fetch a specific subset of customers based on filters like channel ID and archived status, with a limit of 20. ```bash # Returns the count and first 20 archived customers in channel 8 curl 'https://api.landbot.io/v1/customers/?channel_id=8&archived=true&limit=20' \ -H 'Authorization: Token YOUR_AGENT_TOKEN' ``` -------------------------------- ### API Response for Listing Templates Source: https://dev.landbot.io/api-reference/platform/tag/whatsapp-templates/get/channels/whatsapp/templates This is an example of a successful JSON response when listing WhatsApp templates. It includes the template ID, the number of parameters it expects, and the template text. ```json { "success": true, "templates": [ { "id": 1, "params_number": 2, "text": "Hi {{1}}. Welcome to {{2}} on WhatsApp. Are you ready to begin?" } ] } ``` -------------------------------- ### Create Customer Field Request Example Source: https://dev.landbot.io/api-reference/platform/tag/customer-fields/post/customers/customer_id/fields/field_name Use this cURL command to send a POST request to create a new custom field for a customer. Ensure you replace `{field_name}` with the desired field name and `YOUR_SECRET_TOKEN` with your actual API token. The body specifies the field type, value, and optional extra metadata. ```Shell curl 'https://api.landbot.io/v1/customers/1/fields/{field_name}/' \ --request POST \ --header 'Content-Type: application/json' \ --header 'Authorization: YOUR_SECRET_TOKEN' \ --data '{ \ "type": "datetime", \ "extra": {}, \ "value": 1536155712.1234 \ }' ``` -------------------------------- ### Update Customer Request Example Source: https://dev.landbot.io/api-reference/apichat-api/tag/customers/put/customers/customer_token Use this cURL command to send a PUT request to update customer details. You can pass null to clear specific fields. Ensure you replace `{customer_token}` and `YOUR_SECRET_TOKEN` with your actual values. ```curl curl 'https://chat.landbot.io/v1/customers/{customer_token}/' \ --request PUT \ --header 'Content-Type: application/json' \ --header 'Authorization: YOUR_SECRET_TOKEN' \ --data '{ \ "postal_code": "46021", \ "phone": null, \ "country": "ES" \ }' ``` -------------------------------- ### setCustomData Method Source: https://dev.landbot.io/sdks/widgets/api/widget Sets custom data or variables for the widget. Consult the Setting Variables guide for an example. ```APIDOC ## setCustomData **setCustomData(data)** Parameters: - data: *Object* Set variables. Go to [Setting variables](/sdks/widgets/advanced/setting-variables) to see an example. ``` -------------------------------- ### Create LandbotCore instance with fetched config Source: https://dev.landbot.io/sdks/core/install Instantiate LandbotCore by fetching the bot configuration JSON from a URL and passing it to the constructor. This is suitable for Node.js or browser environments with a build step. ```javascript import LandbotCore from '@landbot/core'; fetch('https://chats.landbot.io/u/H-441480-B0Q96FP58V53BJ2J/index.json') .then((res) => res.json()) .then((config) => { const core = new LandbotCore(config); }); ``` -------------------------------- ### HTTP 429 Response Example Source: https://dev.landbot.io/guides/rate-limiting This is an example of a standard HTTP 429 Too Many Requests response. ```http HTTP/1.1 429 Too Many Requests Content-Type: application/json ``` -------------------------------- ### Load Landbot Core SDK and Initialize Chat Source: https://dev.landbot.io/guides/cookbook/build-a-custom-chat-ui This snippet shows how to load the Landbot Core SDK and initialize a new chat instance using a provided config URL. Ensure the config URL is correctly obtained from your bot's share/embed settings. ```html ``` -------------------------------- ### APIchat Error Response Example Source: https://dev.landbot.io/api-reference/apichat/introduction Example of an error response from APIchat, indicating a failure and providing an error message. ```json { "success": false, "error": "Invalid message type" } ``` -------------------------------- ### POST /customers/ Source: https://dev.landbot.io/api-reference/apichat-api/tag/customers/post/customers Creates a new customer. All fields are optional; a random `token` is generated when one isn't provided. ```APIDOC ## POST /customers/ ### Description Creates a new customer. All fields are optional; a random `token` is generated when one isn't provided. ### Method POST ### Endpoint /customers/ ### Parameters #### Request Body - **country** (string) - Optional - ISO 3166-1 alpha-2 country code. - **email** (string) - Optional - Email address. - **name** (string) - Optional - Customer name. - **phone** (string) - Optional - Customer phone number. - **postal_code** (string) - Optional - Postal code. - **token** (string) - Optional - Optional custom token. A random one is generated if omitted. ### Request Example ```json { "name": "Sam", "phone": "34697882898", "email": "sam@helloumi.com", "postal_code": "46021", "country": "GB", "token": "SDFRL4TOMFTEWERY262NF" } ``` ### Response #### Success Response (201) - **success** (boolean) - Indicates if the operation was successful. - **customer** (object) - The created customer object. - **id** (integer) - The unique identifier for the customer. - **name** (string) - The name of the customer. - **phone** (string) - The phone number of the customer. - **email** (string) - The email address of the customer. - **postal_code** (string) - The postal code of the customer. - **country** (string) - The country code of the customer. - **token** (string) - The custom token associated with the customer. #### Response Example (201) ```json { "success": true, "customer": { "id": 42, "name": "Sam", "phone": "34697882898", "email": "sam@helloumi.com", "postal_code": "46021", "country": "GB", "token": "SDFRL4TOMFTEWERY262NF" } } ``` #### Error Response (409) - **message** (string) - Description of the error, e.g., "A customer with the same identifying field already exists." ``` -------------------------------- ### Initialize Landbot Core SDK and Subscribe to Messages Source: https://dev.landbot.io/guides/cookbook/build-a-custom-chat-ui An asynchronous IIFE that fetches bot configuration, initializes the Landbot Core SDK, and subscribes to readable message sequences before calling the init() method. Includes error handling for configuration fetching and initialization. ```javascript (async () => { try { const config = await fetch(CONFIG_URL).then((r) => { if (!r.ok) throw new Error(`HTTP ${r.status} fetching bot config`); return r.json(); }); core = new Core(config); core.pipelines.$readableSequence.subscribe(onMessage); // SUBSCRIBE before init() await core.init(); } catch (err) { bubble(`Couldn't start the bot: ${err.message}`, "bot"); console.error(err); } })(); ``` -------------------------------- ### APIchat Webhook Payload Example Source: https://dev.landbot.io/api-reference/apichat-api/webhook/post/message This is an example of the JSON payload sent by APIchat when a bot emits a message. It includes details about the messages, customer, channel, and agent. ```json { "messages": [ { "type": "text", "timestamp": 1, "message": "" } ], "customer": { "id": 1, "token": "", "register_date": 1, "name": null, "phone": null, "email": null, "additionalProperty": "anything" }, "channel": { "id": 1, "name": "" }, "agent": { "id": 1, "type": "bot", "name": "", "email": "" } } ``` -------------------------------- ### Core Initialization and Subscription Source: https://dev.landbot.io/guides/cookbook/build-a-custom-chat-ui Initialize the Landbot Core and subscribe to messages before calling init(). This ensures you capture welcome messages and benefit from paced message delivery. ```javascript import { Core } from "landbot-core/+esm"; const config = await fetch("/config.json").then(res => res.json()); const core = new Core(config); core.subscribe(messages => { // Handle messages here }); await core.init(); ``` -------------------------------- ### Successful Response for Get Message Hook Source: https://dev.landbot.io/api-reference/platform/tag/message-hooks/get/channels/channel_id/message_hooks/hook_id This is the JSON structure returned upon a successful request to get a message hook. It includes details about the hook such as its ID, URL, token, name, and associated channel ID. ```JSON { "success": true, "hook": { "id": 23, "url": "https://api.test.com/landbot/", "token": "1234567890qwerty", "name": "1234 Hook", "channel_id": 37, "created_at": 1606743214.897625, "updated_at": 1606743896.563929 } } ``` -------------------------------- ### Listening for core initialization Source: https://dev.landbot.io/sdks/core/api/events The 'init' event is emitted when `core.init()` has completed and the instance is ready. Use this to ensure your code runs after the core is fully initialized. ```javascript core.events.on('init', function () { console.log('Landbot core initialized'); }); ``` -------------------------------- ### init Source: https://dev.landbot.io/sdks/core/api/core Initializes the core functionality of the Landbot SDK. Returns a Promise that resolves with the conversation history. ```APIDOC ## init() ### Description Core initialization. Returns a Promise that resolves with `data.messages` — the conversation history for this bot session (welcome bundle + any previous conversation if persistent storage is enabled). ### Returns - Promise - Resolves with `data.messages` containing the conversation history. ``` -------------------------------- ### Get Agent Source: https://dev.landbot.io/api-reference/apichat-api/tag/agents/get/agents/agent_id Returns the agent identified by `agent_id`. Authentication is required. ```APIDOC ## GET /agents/{agent_id}/ ### Description Returns the agent identified by `agent_id`. ### Method GET ### Endpoint /v1/agents/{agent_id}/ ### Parameters #### Path Parameters - **agent_id** (integer) - Required - Identifier of the agent. ### Request Example ``` curl https://chat.landbot.io/v1/agents/1/ \ --header 'Authorization: YOUR_SECRET_TOKEN' ``` ### Response #### Success Response (200) Agent data. ```json { "success": true, "agent": { "id": 42, "name": "Enemesio", "avatar": "https://octodex.github.com/images/dojocat.jpg" } } ``` ``` -------------------------------- ### Get Message Hook Source: https://dev.landbot.io/api-reference/platform/tag/message-hooks Retrieves details of a specific message hook by its ID. ```APIDOC ## GET /channels/{channel_id}/message_hooks/{hook_id}/ ### Description Retrieves details of a specific message hook by its ID. ### Method GET ### Endpoint /channels/{channel_id}/message_hooks/{hook_id}/ ### Parameters #### Path Parameters - **channel_id** (string) - Required - The ID of the channel associated with the message hook. - **hook_id** (string) - Required - The ID of the message hook to retrieve. ``` -------------------------------- ### Create Customer Source: https://dev.landbot.io/api-reference/apichat-api/tag/customers Creates a new customer. ```APIDOC ## POST /customers/ ### Description Creates a new customer. ### Method POST ### Endpoint /customers/ ### Parameters #### Request Body (No specific fields documented in source) ``` -------------------------------- ### Instantiate Landbot Popup Widget Source: https://dev.landbot.io/sdks/widgets/introduction Use this constructor for the Popup widget format, which displays a launcher bubble. Ensure the Landbot SDK is loaded. ```javascript new Landbot.Popup({ configUrl: '...', }); ``` -------------------------------- ### Get Customer Source: https://dev.landbot.io/api-reference/platform/tag/customers/get/customers/customer_id Fetches customer data for a given customer_id. Requires authentication. ```APIDOC ## GET /customers/{customer_id}/ ### Description Returns customer data for the specified `customer_id`. ### Method GET ### Endpoint /customers/{customer_id}/ ### Parameters #### Path Parameters - **customer_id** (integer) - Required - Identifier of the customer. ### Request Example ```bash curl https://api.landbot.io/v1/customers/1/ \ --header 'Authorization: YOUR_SECRET_TOKEN' ``` ### Response #### Success Response (200) Customer data. - **success** (boolean) - Indicates if the request was successful. - **customer** (object) - Contains the customer details. - **id** (integer) - The unique identifier of the customer. - **name** (string) - The name of the customer. - **channel_id** (integer) - The ID of the channel associated with the customer. - **avatar** (string) - URL of the customer's avatar. - **last_message** (number) - Timestamp of the last message. - **unread** (boolean) - Indicates if there are unread messages. - **archived** (boolean) - Indicates if the customer record is archived. - **agent_id** (integer) - The ID of the agent assigned to the customer. - **register_date** (number) - Timestamp of when the customer registered. - **custom_fields** (object) - Key-value pairs for custom customer fields. - **email** (object) - Details for the email custom field. - **value** (string) - The email address. - **type** (string) - The data type of the field (e.g., "string"). - **extra** (object) - Additional metadata for the field. - **name** (string) - The name of the custom field (e.g., "email"). - **payment_date** (object) - Details for the payment_date custom field. - **value** (number) - The payment date as a timestamp. - **type** (string) - The data type of the field (e.g., "datetime"). - **extra** (object) - Additional metadata for the field. - **name** (string) - The name of the custom field (e.g., "payment_date"). - **meta_data** (object) - Additional metadata for the customer. #### Response Example (200) ```json { "success": true, "customer": { "id": 42, "name": "Ataulfo", "channel_id": 1, "avatar": "https://octodex.github.com/images/dojocat.jpg", "last_message": 1493285931.828493, "unread": false, "archived": false, "agent_id": 1, "register_date": 1491480847.264482, "custom_fields": { "email": { "value": "api@helloumi.com", "type": "string", "extra": {}, "name": "email" }, "payment_date": { "value": 1491480957.264482, "type": "datetime", "extra": {}, "name": "payment_date" } }, "meta_data": {} } } ``` #### Error Response (403) You don't have access to this customer. ``` -------------------------------- ### Use LandbotCore from CDN Source: https://dev.landbot.io/sdks/core/install Load and use LandbotCore directly from a CDN in HTML for prototypes or static pages without a build step. Ensure to use the named export `Core`. ```html ``` -------------------------------- ### Get Channel by ID Source: https://dev.landbot.io/api-reference/platform/tag/channels Retrieves details for a specific channel using its ID. ```APIDOC ## GET /channels/{channel_id}/ ### Description Retrieves details for a specific channel using its ID. ### Method GET ### Endpoint /channels/{channel_id}/ ### Parameters #### Path Parameters - **channel_id** (string) - Required - The unique identifier of the channel. ``` -------------------------------- ### Get Channel Source: https://dev.landbot.io/api-reference/platform/tag/channels/get/channels/channel_id Retrieves the channel data for a given channel ID. Authentication is required. ```APIDOC ## GET /channels/{channel_id}/ ### Description Returns the channel data for `channel_id`. ### Method GET ### Endpoint /channels/{channel_id}/ ### Parameters #### Path Parameters - **channel_id** (integer) - Required - Identifier of the channel. ### Responses #### Success Response (200) Channel data. - **success** (boolean) - Indicates if the request was successful. - **channel** (object) - Contains the channel details. - **id** (integer) - The unique identifier of the channel. - **name** (string) - The name of the channel. - **type** (string) - The type of the channel (e.g., 'webchat'). - **active** (boolean) - Indicates if the channel is active. - **created_at** (number) - Timestamp when the channel was created. - **token** (string) - The channel's access token. - **image** (string) - URL for the channel's image. - **background_image** (string) - URL for the channel's background image (nullable). - **background_color** (string) - The background color of the channel. - **accent** (string) - The accent color of the channel. - **primary_text_color** (string) - The primary text color of the channel. #### Error Response (403) You don't have access to this channel. ### Request Example ```bash curl https://api.landbot.io/v1/channels/1/ \ --header 'Authorization: YOUR_SECRET_TOKEN' ``` ### Response Example (200) ```json { "success": true, "channel": { "id": 8, "name": "UmiChat", "type": "webchat", "active": true, "created_at": 1485789228.878516, "token": "H-8-GXQB4SYFQITIB9XZ", "image": "https://media.helloumi.com/channels/8", "background_image": null, "background_color": "#23c10c", "accent": "#e11515", "primary_text_color": "#1133dd" } } ``` ``` -------------------------------- ### Landbot.Core Constructor Source: https://dev.landbot.io/sdks/core/api/core Constructs a new Landbot.Core instance. Requires a configuration object to be passed. ```APIDOC ## Landbot.Core(config) ### Description Creates a Landbot.Core instance. ### Parameters #### Path Parameters - **config** (Object) - Required - The configuration object for the Landbot instance. ``` -------------------------------- ### Get Customer by ID Source: https://dev.landbot.io/api-reference/platform/tag/customers Retrieves a specific customer's details using their unique identifier. ```APIDOC ## GET /customers/{customer_id}/ ### Description Retrieves a specific customer's details using their unique identifier. ### Method GET ### Endpoint /customers/{customer_id}/ #### Path Parameters - **customer_id** (string) - Required - The unique identifier of the customer. ``` -------------------------------- ### Instantiate Landbot Fullpage Widget Source: https://dev.landbot.io/sdks/widgets/introduction Use this constructor for the Fullpage widget format. Ensure the Landbot SDK is loaded before instantiation. ```javascript new Landbot.Fullpage({ configUrl: '...', }); ``` -------------------------------- ### Create Customer using cURL Source: https://dev.landbot.io/api-reference/apichat-api/tag/customers/post/customers Use this cURL command to send a POST request to create a new customer. Include your secret token for authorization and provide customer details in the JSON body. All fields are optional. ```shell curl https://chat.landbot.io/v1/customers/ \ --request POST \ --header 'Content-Type: application/json' \ --header 'Authorization: YOUR_SECRET_TOKEN' \ --data '{ \ "name": "Sam", \ "phone": "34697882898", \ "email": "sam@helloumi.com", \ "postal_code": "46021", \ "country": "GB", \ "token": "SDFRL4TOMFTEWERY262NF" \ }' ``` -------------------------------- ### Get Agent by ID Source: https://dev.landbot.io/api-reference/apichat-api/tag/agents Retrieves a specific agent's profile using their unique identifier. ```APIDOC ## GET /agents/{agent_id}/ ### Description Retrieves a specific agent's profile using their unique identifier. ### Method GET ### Endpoint /agents/{agent_id}/ ### Parameters #### Path Parameters - **agent_id** (string) - Required - The unique identifier of the agent to retrieve. ``` -------------------------------- ### init event Source: https://dev.landbot.io/sdks/core/api/events Emitted when the core.init() method has completed, indicating that the Landbot Core instance is ready for use. ```APIDOC ## init ### Description Emitted when [`core.init()`](/sdks/core/api/core#init) has finished and the instance is ready. ### Method `core.events.on('init', listener)` ### Parameters #### Path Parameters - **event** (String) - Required - The name of the event, which is 'init'. - **listener** (Function) - Required - The callback function to execute when the 'init' event is emitted. ### Request Example ```javascript core.events.on('init', function () { console.log('Landbot core initialized'); }); ``` ### Response This event does not have a specific response payload. ``` -------------------------------- ### JSON 429 Error Response Body Source: https://dev.landbot.io/guides/rate-limiting This is an example of the JSON payload returned with a 429 Too Many Requests response. ```json { "errors": { "rate": ["Too many requests"] } } ``` -------------------------------- ### Get Agent (APIchat) Source: https://dev.landbot.io/guides/for-ai-agents Retrieve information about a specific agent using APIchat. Requires the agent's ID. ```http GET /v1/agents/{agent_id}/ ``` -------------------------------- ### Instantiate Landbot ContainerPopup Widget Source: https://dev.landbot.io/sdks/widgets/introduction Use this constructor for the ContainerPopup widget format. Ensure the Landbot SDK is loaded before instantiation. ```javascript new Landbot.ContainerPopup({ configUrl: '...', }); ``` -------------------------------- ### Get Customer Field Value Source: https://dev.landbot.io/api-reference/platform/tag/customer-fields/get/customers/customer_id/fields/field_name Retrieves the value of a specified custom field for a customer identified by their ID. Authentication is required. ```APIDOC ## GET /customers/{customer_id}/fields/{field_name}/ ### Description Returns the value of `field_name` for the customer with `customer_id`. ### Method GET ### Endpoint /customers/{customer_id}/fields/{field_name}/ ### Parameters #### Path Parameters - **customer_id** (integer) - Required - Identifier of the customer. - **field_name** (string) - Required - Name of the custom field. Only lowercase Latin letters, numbers, and `_` are allowed. Pattern: `^[a-z0-9_]+$` ### Responses #### Success Response (200) - **field** (object) - Field value. - **name** (string) - The name of the field. - **type** (string) - The type of the field. - **extra** (object) - Additional field information. - **value** (any) - The value of the field. #### Error Response (403) - Description: You don't have permission to read fields from this customer. ### Request Example ```curl curl 'https://api.landbot.io/v1/customers/1/fields/{field_name}/' \ --header 'Authorization: YOUR_SECRET_TOKEN' ``` ### Response Example (200) ```json { "success": true, "field": { "name": "phone", "type": "integer", "extra": {}, "value": 630027430 } } ``` ``` -------------------------------- ### Landbot.Popup Constructor Source: https://dev.landbot.io/sdks/widgets/api/popup Initializes a Landbot Popup widget with a given configuration object. ```APIDOC ## Landbot.Popup Constructor ### Description Creates a Landbot Popup widget with the provided configuration. ### Parameters #### Parameters - **config** (Object) - Required - Configuration object for the popup widget. ``` -------------------------------- ### Get Message Hook by ID Source: https://dev.landbot.io/api-reference/platform/tag/message-hooks/get/channels/channel_id/message_hooks/hook_id Fetches a specific message hook using its channel ID and hook ID. Authentication is required. ```APIDOC ## GET /channels/{channel_id}/message_hooks/{hook_id}/ ### Description Returns a single message hook by ID. ### Method GET ### Endpoint /channels/{channel_id}/message_hooks/{hook_id}/ ### Parameters #### Path Parameters - **channel_id** (integer) - Required - Identifier of the channel. - **hook_id** (integer) - Required - Identifier of the message hook. ### Request Example ```shell curl https://api.landbot.io/v1/channels/1/message_hooks/1/ \ --header 'Authorization: YOUR_SECRET_TOKEN' ``` ### Response #### Success Response (200) Hook data. - **success** (boolean) - Indicates if the request was successful. - **hook** (object) - Contains the details of the message hook. - **id** (integer) - The unique identifier of the hook. - **url** (string) - The URL associated with the hook. - **token** (string) - The token for the hook. - **name** (string) - The name of the hook. - **channel_id** (integer) - The ID of the channel the hook belongs to. - **created_at** (number) - Timestamp when the hook was created. - **updated_at** (number) - Timestamp when the hook was last updated. #### Response Example ```json { "success": true, "hook": { "id": 23, "url": "https://api.test.com/landbot/", "token": "1234567890qwerty", "name": "1234 Hook", "channel_id": 37, "created_at": 1606743214.897625, "updated_at": 1606743896.563929 } } ``` ``` -------------------------------- ### Embed Landbot SDK and Instantiate Fullpage Widget Source: https://dev.landbot.io/sdks/widgets/introduction This snippet loads the Landbot SDK as an ES module and instantiates a Fullpage widget. It includes a 500ms timeout for safe module evaluation across different browsers. Drop this at the end of your `` tag. ```html ``` -------------------------------- ### open Source: https://dev.landbot.io/sdks/widgets/api/popup Opens the Landbot Popup widget, making it visible to the user. ```APIDOC ## open ### Description Opens the popup widget. ### Method open() ### Endpoint N/A (SDK method) ``` -------------------------------- ### Instantiate Landbot Container Widget Source: https://dev.landbot.io/sdks/widgets/api/container Create a new Landbot Container instance, specifying the configuration URL and the CSS selector for the container element where the widget will be rendered. The 'container' property is mandatory. ```plaintext var myLandbot = new Landbot.Container({ configUrl: '...', container: '#landbot-container', }) ``` -------------------------------- ### Get Channel by ID (cURL) Source: https://dev.landbot.io/api-reference/platform/tag/channels/get/channels/channel_id Use this cURL command to retrieve channel data by specifying the channel ID and your secret token for authorization. ```Shell curl https://api.landbot.io/v1/channels/1/ \ --header 'Authorization: YOUR_SECRET_TOKEN' ``` -------------------------------- ### Response Shape Example Source: https://dev.landbot.io/guides/pagination Illustrates the JSON structure returned by paginated API endpoints, including the total count and the list of items for the current page. ```json { "success": true, "total": 2000, "customers": [ { "id": 42, "name": "Ataulfo", "...": "..." } ] } ```