POST
/
v1
/
typebots
/
{publicId}
/
startChat
curl --request POST \
  --url https://typebot.io/api/v1/typebots/{publicId}/startChat \
  --header 'Content-Type: application/json' \
  --data '{
  "isOnlyRegistering": true,
  "isStreamEnabled": true,
  "message": "<string>",
  "prefilledVariables": {
    "Email": "[email protected]",
    "First name": "John"
  },
  "resultId": "<string>"
}'
{
  "clientSideActions": [
    {
      "expectsDedicatedReply": true,
      "lastBubbleBlockId": "<string>",
      "scriptToExecute": {
        "args": [
          {
            "id": "<string>",
            "value": "<string>"
          }
        ],
        "content": "<string>"
      },
      "type": "scriptToExecute"
    }
  ],
  "dynamicTheme": {
    "guestAvatarUrl": "<string>",
    "hostAvatarUrl": "<string>"
  },
  "input": {
    "id": "<string>",
    "options": {
      "isLong": true,
      "labels": {
        "button": "<string>",
        "placeholder": "<string>"
      },
      "variableId": "<string>"
    },
    "outgoingEdgeId": "<string>",
    "type": "text input",
    "prefilledValue": "<string>",
    "runtimeOptions": {
      "amountLabel": "<string>",
      "paymentIntentSecret": "<string>",
      "publicKey": "<string>"
    }
  },
  "lastMessageNewFormat": "<string>",
  "logs": [
    {
      "description": "<string>",
      "details": "<any>",
      "status": "<string>"
    }
  ],
  "messages": [
    {
      "id": "<string>",
      "content": {
        "html": "<string>",
        "plainText": "<string>",
        "richText": [
          "<any>"
        ]
      },
      "type": "text"
    }
  ],
  "resultId": "<string>",
  "sessionId": "<string>",
  "typebot": {
    "id": "<string>",
    "settings": {
      "general": {
        "isBrandingEnabled": true,
        "isHideQueryParamsEnabled": true,
        "isInputPrefillEnabled": true,
        "isNewResultOnRefreshEnabled": true,
        "isTypingEmulationEnabled": true,
        "rememberUser": {
          "isEnabled": true,
          "storage": "session"
        }
      },
      "metadata": {
        "customHeadCode": "<string>",
        "description": "<string>",
        "favIconUrl": "<string>",
        "googleTagManagerId": "<string>",
        "imageUrl": "<string>",
        "title": "<string>"
      },
      "publicShare": {
        "isEnabled": true
      },
      "security": {
        "allowedOrigins": [
          "<string>"
        ]
      },
      "typingEmulation": {
        "delayBetweenBubbles": 4,
        "enabled": true,
        "isDisabledOnFirstMessage": true,
        "maxDelay": 123,
        "speed": 123
      },
      "whatsApp": {
        "isEnabled": true,
        "sessionExpiryTimeout": 47,
        "startCondition": {
          "comparisons": [
            {
              "comparisonOperator": "Equal to",
              "id": "<string>",
              "value": "<string>"
            }
          ],
          "logicalOperator": "OR"
        }
      }
    },
    "theme": {
      "chat": {
        "buttons": {
          "backgroundColor": "<string>",
          "color": "<string>"
        },
        "guestAvatar": {
          "isEnabled": true,
          "url": "<string>"
        },
        "guestBubbles": {
          "backgroundColor": "<string>",
          "color": "<string>"
        },
        "hostAvatar": {
          "isEnabled": true,
          "url": "<string>"
        },
        "hostBubbles": {
          "backgroundColor": "<string>",
          "color": "<string>"
        },
        "inputs": {
          "backgroundColor": "<string>",
          "color": "<string>",
          "placeholderColor": "<string>"
        },
        "roundness": "none"
      },
      "customCss": "<string>",
      "general": {
        "background": {
          "content": "<string>",
          "type": "Color"
        },
        "font": "<string>"
      }
    }
  }
}

Path Parameters

publicId
string
required

Body

application/json
isOnlyRegistering
boolean
default: false

If set to true, it will only register the session and not start the bot. This is used for 3rd party chat platforms as it can require a session to be registered before sending the first message.

isStreamEnabled
boolean
default: false

If enabled, you will be required to stream OpenAI completions on a client and send the generated response back to the API.

message
string

Only provide it if your flow starts with an input block and you'd like to directly provide an answer to it.

prefilledVariables
object
resultId
string

Provide it if you'd like to overwrite an existing result.

Response

200 - application/json
clientSideActions
object[]

Actions to execute on the client side

  • Script to execute

  • Redirect

  • Chatwoot

  • Google Analytics

  • Wait

  • Set variable

  • Stream OpenAI

  • Execute webhook

  • Inject start props

  • Init Pixel

  • Exec stream

  • Execute code

dynamicTheme
object

If the typebot contains dynamic avatars, dynamicTheme returns the new avatar URLs whenever their variables are updated.

input
object
  • Text

  • Buttons

  • Email

  • Number

  • URL

  • Phone number

  • Date

  • Payment

  • Rating

  • File

  • Picture choice

  • Buttons v5

  • File input v5

  • Picture choice v5

lastMessageNewFormat
string

The sent message is validated and formatted on the backend. For example, if for a date input you replied something like tomorrow, the backend will convert it to a date string. This field returns the formatted message.

logs
object[]

Logs that were saved during the last execution

messages
object[]
required
  • Text

  • Image

  • Video

  • Audio

  • Embed

  • Custom embed

resultId
string
sessionId
string
required

To save and use for /continueChat requests.

typebot
object
required