Unltd AI logo

Getting started


Create Custom Bot Input

POST https://api.unltd.ai/v1/organizations/:organizationId/bots/:botSlug/inputs/

This endpoint creates a new BotInput entity for a specific bot within an organization based on the provided information in the request body.

Request Body

accept

string

File types accepted by the input. This attribute is only used for file type inputs.

defaultValue

number or string

The default value for this bot input.

inputGroup

number

The index of the input group this input belongs to.

inputType

string

The type of the input, should be one of the supported UI input types.

label

string

The label for the bot input.

max

number

The maximum value for the bot input (if applicable).

min

number

The minimum value for the bot input (if applicable).

multiple

boolean

Specifies if multiple values can be selected (if applicable).

name

string

The name of the bot input.

options

array

An array of Bot Input Option objects for the bot input.

placeholder

string

A placeholder text for the bot input.

required

boolean

Specifies if the bot input is required.

rows

number

Number of rows for the bot input (if applicable).

step

number

Step interval for the bot input (if applicable).

value

number or string

The value of the bot input.

Permissions

This request requires an authenticated user who is an admin of the organization or an organization token.

API Example

const fetchApiData = async () => {
  const response = await fetch("https://api.unltd.ai/v1/organizations/example_org_id/bots/example_bot_slug/inputs/", {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer ',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      defaultValue: 'option1',
      inputGroup: '0',
      inputType: 'select',
      label: 'Choose an option',
      multiple: 'false',
      name: 'Example Select',
      options: '[object Object],[object Object]',
      placeholder: 'Select an option...',
      required: 'true'
    })
  });

  const data = await response.json();
  console.log(data);
};

fetchApiData();

Response Object

201 success

The response object will be returned as a BotInput.
{
  "defaultValue": "option1",
  "inputGroup": 0,
  "inputType": "select",
  "label": "Choose an option",
  "multiple": false,
  "name": "Example Select",
  "options": [
    {
      "text": "Option 1",
      "value": "option1"
    },
    {
      "text": "Option 2",
      "value": "option2"
    }
  ],
  "placeholder": "Select an option...",
  "required": true
}