curl --request POST \
--url https://typebot.io/api/v1/typebots/{typebotId}/preview/startChat \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"typebot": {
"id": "<string>",
"groups": [
{
"id": "<string>",
"title": "<string>",
"graphCoordinates": {
"x": 123,
"y": 123
},
"blocks": [
{
"id": "<string>",
"type": "<unknown>",
"label": "<string>",
"outgoingEdgeId": "<string>"
}
]
}
],
"events": [],
"edges": [
{
"id": "<string>",
"from": {
"blockId": "<string>",
"itemId": "<string>",
"pathId": "<string>"
},
"to": {
"groupId": "<string>",
"blockId": "<string>"
}
}
],
"variables": [
{
"id": "<string>",
"name": "<string>",
"isSessionVariable": true,
"value": "<string>"
}
],
"settings": {
"general": {
"isBrandingEnabled": true,
"isTypingEmulationEnabled": true,
"isInputPrefillEnabled": true,
"isHideQueryParamsEnabled": true,
"isNewResultOnRefreshEnabled": true,
"rememberUser": {
"isEnabled": true
},
"systemMessages": {
"invalidMessage": "<string>",
"botClosed": "<string>",
"networkErrorTitle": "<string>",
"networkErrorMessage": "<string>",
"popupBlockedTitle": "<string>",
"popupBlockedDescription": "<string>",
"popupBlockedButtonLabel": "<string>",
"fileUploadError": "<string>",
"fileUploadSizeError": "<string>",
"whatsAppPictureChoiceSelectLabel": "<string>"
}
},
"typingEmulation": {
"enabled": true,
"speed": 123,
"maxDelay": 123,
"delayBetweenBubbles": 2.5,
"isDisabledOnFirstMessage": true
},
"metadata": {
"title": "<string>",
"description": "<string>",
"imageUrl": "<string>",
"favIconUrl": "<string>",
"customHeadCode": "<string>",
"googleTagManagerId": "<string>",
"allowIndexing": true
},
"whatsApp": {
"isEnabled": true,
"sessionExpiryTimeout": 24.005,
"errorAndMarketingStatusWebhookForwardUrl": "<string>",
"isWebhookForwardingEnabled": true,
"webhookForwardingEventTypes": []
},
"publicShare": {
"isEnabled": true
},
"security": {
"allowedOrigins": [
"<string>"
]
}
},
"theme": {
"general": {
"font": "<string>",
"background": {
"content": "<string>"
},
"progressBar": {
"isEnabled": true,
"color": "<string>",
"backgroundColor": "<string>",
"thickness": 123
}
},
"chat": {
"container": {
"maxWidth": "<string>",
"maxHeight": "<string>",
"backgroundColor": "<string>",
"color": "<string>",
"blur": 123,
"opacity": 0.5,
"border": {
"thickness": 123,
"color": "<string>",
"customRoundeness": 123,
"opacity": 0.5
}
},
"hostAvatar": {
"isEnabled": true,
"url": "<string>"
},
"guestAvatar": {
"isEnabled": true,
"url": "<string>"
},
"hostBubbles": {
"backgroundColor": "<string>",
"color": "<string>",
"blur": 123,
"opacity": 0.5,
"border": {
"thickness": 123,
"color": "<string>",
"customRoundeness": 123,
"opacity": 0.5
}
},
"guestBubbles": {
"backgroundColor": "<string>",
"color": "<string>",
"blur": 123,
"opacity": 0.5,
"border": {
"thickness": 123,
"color": "<string>",
"customRoundeness": 123,
"opacity": 0.5
}
},
"buttons": {
"backgroundColor": "<string>",
"color": "<string>",
"blur": 123,
"opacity": 0.5,
"border": {
"thickness": 123,
"color": "<string>",
"customRoundeness": 123,
"opacity": 0.5
}
},
"inputs": {
"backgroundColor": "<string>",
"color": "<string>",
"blur": 123,
"opacity": 0.5,
"border": {
"thickness": 123,
"color": "<string>",
"customRoundeness": 123,
"opacity": 0.5
},
"placeholderColor": "<string>"
},
"buttonsInput": {}
},
"customCss": "<string>"
},
"updatedAt": "2023-11-07T05:31:56Z",
"workspaceId": "<string>",
"publicTypebotId": "<string>"
},
"sessionId": "<string>",
"startFrom": {
"type": "<unknown>",
"groupId": "<string>"
},
"message": {
"type": "<unknown>",
"text": "<string>",
"metadata": {
"replyId": "<string>"
},
"attachedFileUrls": [
"<string>"
]
},
"isStreamEnabled": false,
"isOnlyRegistering": false,
"prefilledVariables": {},
"textBubbleContentFormat": "richText"
}
'import requests
url = "https://typebot.io/api/v1/typebots/{typebotId}/preview/startChat"
payload = {
"typebot": {
"id": "<string>",
"groups": [
{
"id": "<string>",
"title": "<string>",
"graphCoordinates": {
"x": 123,
"y": 123
},
"blocks": [
{
"id": "<string>",
"type": "<unknown>",
"label": "<string>",
"outgoingEdgeId": "<string>"
}
]
}
],
"events": [],
"edges": [
{
"id": "<string>",
"from": {
"blockId": "<string>",
"itemId": "<string>",
"pathId": "<string>"
},
"to": {
"groupId": "<string>",
"blockId": "<string>"
}
}
],
"variables": [
{
"id": "<string>",
"name": "<string>",
"isSessionVariable": True,
"value": "<string>"
}
],
"settings": {
"general": {
"isBrandingEnabled": True,
"isTypingEmulationEnabled": True,
"isInputPrefillEnabled": True,
"isHideQueryParamsEnabled": True,
"isNewResultOnRefreshEnabled": True,
"rememberUser": { "isEnabled": True },
"systemMessages": {
"invalidMessage": "<string>",
"botClosed": "<string>",
"networkErrorTitle": "<string>",
"networkErrorMessage": "<string>",
"popupBlockedTitle": "<string>",
"popupBlockedDescription": "<string>",
"popupBlockedButtonLabel": "<string>",
"fileUploadError": "<string>",
"fileUploadSizeError": "<string>",
"whatsAppPictureChoiceSelectLabel": "<string>"
}
},
"typingEmulation": {
"enabled": True,
"speed": 123,
"maxDelay": 123,
"delayBetweenBubbles": 2.5,
"isDisabledOnFirstMessage": True
},
"metadata": {
"title": "<string>",
"description": "<string>",
"imageUrl": "<string>",
"favIconUrl": "<string>",
"customHeadCode": "<string>",
"googleTagManagerId": "<string>",
"allowIndexing": True
},
"whatsApp": {
"isEnabled": True,
"sessionExpiryTimeout": 24.005,
"errorAndMarketingStatusWebhookForwardUrl": "<string>",
"isWebhookForwardingEnabled": True,
"webhookForwardingEventTypes": []
},
"publicShare": { "isEnabled": True },
"security": { "allowedOrigins": ["<string>"] }
},
"theme": {
"general": {
"font": "<string>",
"background": { "content": "<string>" },
"progressBar": {
"isEnabled": True,
"color": "<string>",
"backgroundColor": "<string>",
"thickness": 123
}
},
"chat": {
"container": {
"maxWidth": "<string>",
"maxHeight": "<string>",
"backgroundColor": "<string>",
"color": "<string>",
"blur": 123,
"opacity": 0.5,
"border": {
"thickness": 123,
"color": "<string>",
"customRoundeness": 123,
"opacity": 0.5
}
},
"hostAvatar": {
"isEnabled": True,
"url": "<string>"
},
"guestAvatar": {
"isEnabled": True,
"url": "<string>"
},
"hostBubbles": {
"backgroundColor": "<string>",
"color": "<string>",
"blur": 123,
"opacity": 0.5,
"border": {
"thickness": 123,
"color": "<string>",
"customRoundeness": 123,
"opacity": 0.5
}
},
"guestBubbles": {
"backgroundColor": "<string>",
"color": "<string>",
"blur": 123,
"opacity": 0.5,
"border": {
"thickness": 123,
"color": "<string>",
"customRoundeness": 123,
"opacity": 0.5
}
},
"buttons": {
"backgroundColor": "<string>",
"color": "<string>",
"blur": 123,
"opacity": 0.5,
"border": {
"thickness": 123,
"color": "<string>",
"customRoundeness": 123,
"opacity": 0.5
}
},
"inputs": {
"backgroundColor": "<string>",
"color": "<string>",
"blur": 123,
"opacity": 0.5,
"border": {
"thickness": 123,
"color": "<string>",
"customRoundeness": 123,
"opacity": 0.5
},
"placeholderColor": "<string>"
},
"buttonsInput": {}
},
"customCss": "<string>"
},
"updatedAt": "2023-11-07T05:31:56Z",
"workspaceId": "<string>",
"publicTypebotId": "<string>"
},
"sessionId": "<string>",
"startFrom": {
"type": "<unknown>",
"groupId": "<string>"
},
"message": {
"type": "<unknown>",
"text": "<string>",
"metadata": { "replyId": "<string>" },
"attachedFileUrls": ["<string>"]
},
"isStreamEnabled": False,
"isOnlyRegistering": False,
"prefilledVariables": {},
"textBubbleContentFormat": "richText"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
typebot: {
id: '<string>',
groups: [
{
id: '<string>',
title: '<string>',
graphCoordinates: {x: 123, y: 123},
blocks: [
{
id: '<string>',
type: '<unknown>',
label: '<string>',
outgoingEdgeId: '<string>'
}
]
}
],
events: [],
edges: [
{
id: '<string>',
from: {blockId: '<string>', itemId: '<string>', pathId: '<string>'},
to: {groupId: '<string>', blockId: '<string>'}
}
],
variables: [{id: '<string>', name: '<string>', isSessionVariable: true, value: '<string>'}],
settings: {
general: {
isBrandingEnabled: true,
isTypingEmulationEnabled: true,
isInputPrefillEnabled: true,
isHideQueryParamsEnabled: true,
isNewResultOnRefreshEnabled: true,
rememberUser: {isEnabled: true},
systemMessages: {
invalidMessage: '<string>',
botClosed: '<string>',
networkErrorTitle: '<string>',
networkErrorMessage: '<string>',
popupBlockedTitle: '<string>',
popupBlockedDescription: '<string>',
popupBlockedButtonLabel: '<string>',
fileUploadError: '<string>',
fileUploadSizeError: '<string>',
whatsAppPictureChoiceSelectLabel: '<string>'
}
},
typingEmulation: {
enabled: true,
speed: 123,
maxDelay: 123,
delayBetweenBubbles: 2.5,
isDisabledOnFirstMessage: true
},
metadata: {
title: '<string>',
description: '<string>',
imageUrl: '<string>',
favIconUrl: '<string>',
customHeadCode: '<string>',
googleTagManagerId: '<string>',
allowIndexing: true
},
whatsApp: {
isEnabled: true,
sessionExpiryTimeout: 24.005,
errorAndMarketingStatusWebhookForwardUrl: '<string>',
isWebhookForwardingEnabled: true,
webhookForwardingEventTypes: []
},
publicShare: {isEnabled: true},
security: {allowedOrigins: ['<string>']}
},
theme: {
general: {
font: '<string>',
background: {content: '<string>'},
progressBar: {
isEnabled: true,
color: '<string>',
backgroundColor: '<string>',
thickness: 123
}
},
chat: {
container: {
maxWidth: '<string>',
maxHeight: '<string>',
backgroundColor: '<string>',
color: '<string>',
blur: 123,
opacity: 0.5,
border: {thickness: 123, color: '<string>', customRoundeness: 123, opacity: 0.5}
},
hostAvatar: {isEnabled: true, url: '<string>'},
guestAvatar: {isEnabled: true, url: '<string>'},
hostBubbles: {
backgroundColor: '<string>',
color: '<string>',
blur: 123,
opacity: 0.5,
border: {thickness: 123, color: '<string>', customRoundeness: 123, opacity: 0.5}
},
guestBubbles: {
backgroundColor: '<string>',
color: '<string>',
blur: 123,
opacity: 0.5,
border: {thickness: 123, color: '<string>', customRoundeness: 123, opacity: 0.5}
},
buttons: {
backgroundColor: '<string>',
color: '<string>',
blur: 123,
opacity: 0.5,
border: {thickness: 123, color: '<string>', customRoundeness: 123, opacity: 0.5}
},
inputs: {
backgroundColor: '<string>',
color: '<string>',
blur: 123,
opacity: 0.5,
border: {thickness: 123, color: '<string>', customRoundeness: 123, opacity: 0.5},
placeholderColor: '<string>'
},
buttonsInput: {}
},
customCss: '<string>'
},
updatedAt: '2023-11-07T05:31:56Z',
workspaceId: '<string>',
publicTypebotId: '<string>'
},
sessionId: '<string>',
startFrom: {type: '<unknown>', groupId: '<string>'},
message: {
type: '<unknown>',
text: '<string>',
metadata: {replyId: '<string>'},
attachedFileUrls: ['<string>']
},
isStreamEnabled: false,
isOnlyRegistering: false,
prefilledVariables: {},
textBubbleContentFormat: 'richText'
})
};
fetch('https://typebot.io/api/v1/typebots/{typebotId}/preview/startChat', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://typebot.io/api/v1/typebots/{typebotId}/preview/startChat",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'typebot' => [
'id' => '<string>',
'groups' => [
[
'id' => '<string>',
'title' => '<string>',
'graphCoordinates' => [
'x' => 123,
'y' => 123
],
'blocks' => [
[
'id' => '<string>',
'type' => '<unknown>',
'label' => '<string>',
'outgoingEdgeId' => '<string>'
]
]
]
],
'events' => [
],
'edges' => [
[
'id' => '<string>',
'from' => [
'blockId' => '<string>',
'itemId' => '<string>',
'pathId' => '<string>'
],
'to' => [
'groupId' => '<string>',
'blockId' => '<string>'
]
]
],
'variables' => [
[
'id' => '<string>',
'name' => '<string>',
'isSessionVariable' => true,
'value' => '<string>'
]
],
'settings' => [
'general' => [
'isBrandingEnabled' => true,
'isTypingEmulationEnabled' => true,
'isInputPrefillEnabled' => true,
'isHideQueryParamsEnabled' => true,
'isNewResultOnRefreshEnabled' => true,
'rememberUser' => [
'isEnabled' => true
],
'systemMessages' => [
'invalidMessage' => '<string>',
'botClosed' => '<string>',
'networkErrorTitle' => '<string>',
'networkErrorMessage' => '<string>',
'popupBlockedTitle' => '<string>',
'popupBlockedDescription' => '<string>',
'popupBlockedButtonLabel' => '<string>',
'fileUploadError' => '<string>',
'fileUploadSizeError' => '<string>',
'whatsAppPictureChoiceSelectLabel' => '<string>'
]
],
'typingEmulation' => [
'enabled' => true,
'speed' => 123,
'maxDelay' => 123,
'delayBetweenBubbles' => 2.5,
'isDisabledOnFirstMessage' => true
],
'metadata' => [
'title' => '<string>',
'description' => '<string>',
'imageUrl' => '<string>',
'favIconUrl' => '<string>',
'customHeadCode' => '<string>',
'googleTagManagerId' => '<string>',
'allowIndexing' => true
],
'whatsApp' => [
'isEnabled' => true,
'sessionExpiryTimeout' => 24.005,
'errorAndMarketingStatusWebhookForwardUrl' => '<string>',
'isWebhookForwardingEnabled' => true,
'webhookForwardingEventTypes' => [
]
],
'publicShare' => [
'isEnabled' => true
],
'security' => [
'allowedOrigins' => [
'<string>'
]
]
],
'theme' => [
'general' => [
'font' => '<string>',
'background' => [
'content' => '<string>'
],
'progressBar' => [
'isEnabled' => true,
'color' => '<string>',
'backgroundColor' => '<string>',
'thickness' => 123
]
],
'chat' => [
'container' => [
'maxWidth' => '<string>',
'maxHeight' => '<string>',
'backgroundColor' => '<string>',
'color' => '<string>',
'blur' => 123,
'opacity' => 0.5,
'border' => [
'thickness' => 123,
'color' => '<string>',
'customRoundeness' => 123,
'opacity' => 0.5
]
],
'hostAvatar' => [
'isEnabled' => true,
'url' => '<string>'
],
'guestAvatar' => [
'isEnabled' => true,
'url' => '<string>'
],
'hostBubbles' => [
'backgroundColor' => '<string>',
'color' => '<string>',
'blur' => 123,
'opacity' => 0.5,
'border' => [
'thickness' => 123,
'color' => '<string>',
'customRoundeness' => 123,
'opacity' => 0.5
]
],
'guestBubbles' => [
'backgroundColor' => '<string>',
'color' => '<string>',
'blur' => 123,
'opacity' => 0.5,
'border' => [
'thickness' => 123,
'color' => '<string>',
'customRoundeness' => 123,
'opacity' => 0.5
]
],
'buttons' => [
'backgroundColor' => '<string>',
'color' => '<string>',
'blur' => 123,
'opacity' => 0.5,
'border' => [
'thickness' => 123,
'color' => '<string>',
'customRoundeness' => 123,
'opacity' => 0.5
]
],
'inputs' => [
'backgroundColor' => '<string>',
'color' => '<string>',
'blur' => 123,
'opacity' => 0.5,
'border' => [
'thickness' => 123,
'color' => '<string>',
'customRoundeness' => 123,
'opacity' => 0.5
],
'placeholderColor' => '<string>'
],
'buttonsInput' => [
]
],
'customCss' => '<string>'
],
'updatedAt' => '2023-11-07T05:31:56Z',
'workspaceId' => '<string>',
'publicTypebotId' => '<string>'
],
'sessionId' => '<string>',
'startFrom' => [
'type' => '<unknown>',
'groupId' => '<string>'
],
'message' => [
'type' => '<unknown>',
'text' => '<string>',
'metadata' => [
'replyId' => '<string>'
],
'attachedFileUrls' => [
'<string>'
]
],
'isStreamEnabled' => false,
'isOnlyRegistering' => false,
'prefilledVariables' => [
],
'textBubbleContentFormat' => 'richText'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://typebot.io/api/v1/typebots/{typebotId}/preview/startChat"
payload := strings.NewReader("{\n \"typebot\": {\n \"id\": \"<string>\",\n \"groups\": [\n {\n \"id\": \"<string>\",\n \"title\": \"<string>\",\n \"graphCoordinates\": {\n \"x\": 123,\n \"y\": 123\n },\n \"blocks\": [\n {\n \"id\": \"<string>\",\n \"type\": \"<unknown>\",\n \"label\": \"<string>\",\n \"outgoingEdgeId\": \"<string>\"\n }\n ]\n }\n ],\n \"events\": [],\n \"edges\": [\n {\n \"id\": \"<string>\",\n \"from\": {\n \"blockId\": \"<string>\",\n \"itemId\": \"<string>\",\n \"pathId\": \"<string>\"\n },\n \"to\": {\n \"groupId\": \"<string>\",\n \"blockId\": \"<string>\"\n }\n }\n ],\n \"variables\": [\n {\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"isSessionVariable\": true,\n \"value\": \"<string>\"\n }\n ],\n \"settings\": {\n \"general\": {\n \"isBrandingEnabled\": true,\n \"isTypingEmulationEnabled\": true,\n \"isInputPrefillEnabled\": true,\n \"isHideQueryParamsEnabled\": true,\n \"isNewResultOnRefreshEnabled\": true,\n \"rememberUser\": {\n \"isEnabled\": true\n },\n \"systemMessages\": {\n \"invalidMessage\": \"<string>\",\n \"botClosed\": \"<string>\",\n \"networkErrorTitle\": \"<string>\",\n \"networkErrorMessage\": \"<string>\",\n \"popupBlockedTitle\": \"<string>\",\n \"popupBlockedDescription\": \"<string>\",\n \"popupBlockedButtonLabel\": \"<string>\",\n \"fileUploadError\": \"<string>\",\n \"fileUploadSizeError\": \"<string>\",\n \"whatsAppPictureChoiceSelectLabel\": \"<string>\"\n }\n },\n \"typingEmulation\": {\n \"enabled\": true,\n \"speed\": 123,\n \"maxDelay\": 123,\n \"delayBetweenBubbles\": 2.5,\n \"isDisabledOnFirstMessage\": true\n },\n \"metadata\": {\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"imageUrl\": \"<string>\",\n \"favIconUrl\": \"<string>\",\n \"customHeadCode\": \"<string>\",\n \"googleTagManagerId\": \"<string>\",\n \"allowIndexing\": true\n },\n \"whatsApp\": {\n \"isEnabled\": true,\n \"sessionExpiryTimeout\": 24.005,\n \"errorAndMarketingStatusWebhookForwardUrl\": \"<string>\",\n \"isWebhookForwardingEnabled\": true,\n \"webhookForwardingEventTypes\": []\n },\n \"publicShare\": {\n \"isEnabled\": true\n },\n \"security\": {\n \"allowedOrigins\": [\n \"<string>\"\n ]\n }\n },\n \"theme\": {\n \"general\": {\n \"font\": \"<string>\",\n \"background\": {\n \"content\": \"<string>\"\n },\n \"progressBar\": {\n \"isEnabled\": true,\n \"color\": \"<string>\",\n \"backgroundColor\": \"<string>\",\n \"thickness\": 123\n }\n },\n \"chat\": {\n \"container\": {\n \"maxWidth\": \"<string>\",\n \"maxHeight\": \"<string>\",\n \"backgroundColor\": \"<string>\",\n \"color\": \"<string>\",\n \"blur\": 123,\n \"opacity\": 0.5,\n \"border\": {\n \"thickness\": 123,\n \"color\": \"<string>\",\n \"customRoundeness\": 123,\n \"opacity\": 0.5\n }\n },\n \"hostAvatar\": {\n \"isEnabled\": true,\n \"url\": \"<string>\"\n },\n \"guestAvatar\": {\n \"isEnabled\": true,\n \"url\": \"<string>\"\n },\n \"hostBubbles\": {\n \"backgroundColor\": \"<string>\",\n \"color\": \"<string>\",\n \"blur\": 123,\n \"opacity\": 0.5,\n \"border\": {\n \"thickness\": 123,\n \"color\": \"<string>\",\n \"customRoundeness\": 123,\n \"opacity\": 0.5\n }\n },\n \"guestBubbles\": {\n \"backgroundColor\": \"<string>\",\n \"color\": \"<string>\",\n \"blur\": 123,\n \"opacity\": 0.5,\n \"border\": {\n \"thickness\": 123,\n \"color\": \"<string>\",\n \"customRoundeness\": 123,\n \"opacity\": 0.5\n }\n },\n \"buttons\": {\n \"backgroundColor\": \"<string>\",\n \"color\": \"<string>\",\n \"blur\": 123,\n \"opacity\": 0.5,\n \"border\": {\n \"thickness\": 123,\n \"color\": \"<string>\",\n \"customRoundeness\": 123,\n \"opacity\": 0.5\n }\n },\n \"inputs\": {\n \"backgroundColor\": \"<string>\",\n \"color\": \"<string>\",\n \"blur\": 123,\n \"opacity\": 0.5,\n \"border\": {\n \"thickness\": 123,\n \"color\": \"<string>\",\n \"customRoundeness\": 123,\n \"opacity\": 0.5\n },\n \"placeholderColor\": \"<string>\"\n },\n \"buttonsInput\": {}\n },\n \"customCss\": \"<string>\"\n },\n \"updatedAt\": \"2023-11-07T05:31:56Z\",\n \"workspaceId\": \"<string>\",\n \"publicTypebotId\": \"<string>\"\n },\n \"sessionId\": \"<string>\",\n \"startFrom\": {\n \"type\": \"<unknown>\",\n \"groupId\": \"<string>\"\n },\n \"message\": {\n \"type\": \"<unknown>\",\n \"text\": \"<string>\",\n \"metadata\": {\n \"replyId\": \"<string>\"\n },\n \"attachedFileUrls\": [\n \"<string>\"\n ]\n },\n \"isStreamEnabled\": false,\n \"isOnlyRegistering\": false,\n \"prefilledVariables\": {},\n \"textBubbleContentFormat\": \"richText\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://typebot.io/api/v1/typebots/{typebotId}/preview/startChat")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"typebot\": {\n \"id\": \"<string>\",\n \"groups\": [\n {\n \"id\": \"<string>\",\n \"title\": \"<string>\",\n \"graphCoordinates\": {\n \"x\": 123,\n \"y\": 123\n },\n \"blocks\": [\n {\n \"id\": \"<string>\",\n \"type\": \"<unknown>\",\n \"label\": \"<string>\",\n \"outgoingEdgeId\": \"<string>\"\n }\n ]\n }\n ],\n \"events\": [],\n \"edges\": [\n {\n \"id\": \"<string>\",\n \"from\": {\n \"blockId\": \"<string>\",\n \"itemId\": \"<string>\",\n \"pathId\": \"<string>\"\n },\n \"to\": {\n \"groupId\": \"<string>\",\n \"blockId\": \"<string>\"\n }\n }\n ],\n \"variables\": [\n {\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"isSessionVariable\": true,\n \"value\": \"<string>\"\n }\n ],\n \"settings\": {\n \"general\": {\n \"isBrandingEnabled\": true,\n \"isTypingEmulationEnabled\": true,\n \"isInputPrefillEnabled\": true,\n \"isHideQueryParamsEnabled\": true,\n \"isNewResultOnRefreshEnabled\": true,\n \"rememberUser\": {\n \"isEnabled\": true\n },\n \"systemMessages\": {\n \"invalidMessage\": \"<string>\",\n \"botClosed\": \"<string>\",\n \"networkErrorTitle\": \"<string>\",\n \"networkErrorMessage\": \"<string>\",\n \"popupBlockedTitle\": \"<string>\",\n \"popupBlockedDescription\": \"<string>\",\n \"popupBlockedButtonLabel\": \"<string>\",\n \"fileUploadError\": \"<string>\",\n \"fileUploadSizeError\": \"<string>\",\n \"whatsAppPictureChoiceSelectLabel\": \"<string>\"\n }\n },\n \"typingEmulation\": {\n \"enabled\": true,\n \"speed\": 123,\n \"maxDelay\": 123,\n \"delayBetweenBubbles\": 2.5,\n \"isDisabledOnFirstMessage\": true\n },\n \"metadata\": {\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"imageUrl\": \"<string>\",\n \"favIconUrl\": \"<string>\",\n \"customHeadCode\": \"<string>\",\n \"googleTagManagerId\": \"<string>\",\n \"allowIndexing\": true\n },\n \"whatsApp\": {\n \"isEnabled\": true,\n \"sessionExpiryTimeout\": 24.005,\n \"errorAndMarketingStatusWebhookForwardUrl\": \"<string>\",\n \"isWebhookForwardingEnabled\": true,\n \"webhookForwardingEventTypes\": []\n },\n \"publicShare\": {\n \"isEnabled\": true\n },\n \"security\": {\n \"allowedOrigins\": [\n \"<string>\"\n ]\n }\n },\n \"theme\": {\n \"general\": {\n \"font\": \"<string>\",\n \"background\": {\n \"content\": \"<string>\"\n },\n \"progressBar\": {\n \"isEnabled\": true,\n \"color\": \"<string>\",\n \"backgroundColor\": \"<string>\",\n \"thickness\": 123\n }\n },\n \"chat\": {\n \"container\": {\n \"maxWidth\": \"<string>\",\n \"maxHeight\": \"<string>\",\n \"backgroundColor\": \"<string>\",\n \"color\": \"<string>\",\n \"blur\": 123,\n \"opacity\": 0.5,\n \"border\": {\n \"thickness\": 123,\n \"color\": \"<string>\",\n \"customRoundeness\": 123,\n \"opacity\": 0.5\n }\n },\n \"hostAvatar\": {\n \"isEnabled\": true,\n \"url\": \"<string>\"\n },\n \"guestAvatar\": {\n \"isEnabled\": true,\n \"url\": \"<string>\"\n },\n \"hostBubbles\": {\n \"backgroundColor\": \"<string>\",\n \"color\": \"<string>\",\n \"blur\": 123,\n \"opacity\": 0.5,\n \"border\": {\n \"thickness\": 123,\n \"color\": \"<string>\",\n \"customRoundeness\": 123,\n \"opacity\": 0.5\n }\n },\n \"guestBubbles\": {\n \"backgroundColor\": \"<string>\",\n \"color\": \"<string>\",\n \"blur\": 123,\n \"opacity\": 0.5,\n \"border\": {\n \"thickness\": 123,\n \"color\": \"<string>\",\n \"customRoundeness\": 123,\n \"opacity\": 0.5\n }\n },\n \"buttons\": {\n \"backgroundColor\": \"<string>\",\n \"color\": \"<string>\",\n \"blur\": 123,\n \"opacity\": 0.5,\n \"border\": {\n \"thickness\": 123,\n \"color\": \"<string>\",\n \"customRoundeness\": 123,\n \"opacity\": 0.5\n }\n },\n \"inputs\": {\n \"backgroundColor\": \"<string>\",\n \"color\": \"<string>\",\n \"blur\": 123,\n \"opacity\": 0.5,\n \"border\": {\n \"thickness\": 123,\n \"color\": \"<string>\",\n \"customRoundeness\": 123,\n \"opacity\": 0.5\n },\n \"placeholderColor\": \"<string>\"\n },\n \"buttonsInput\": {}\n },\n \"customCss\": \"<string>\"\n },\n \"updatedAt\": \"2023-11-07T05:31:56Z\",\n \"workspaceId\": \"<string>\",\n \"publicTypebotId\": \"<string>\"\n },\n \"sessionId\": \"<string>\",\n \"startFrom\": {\n \"type\": \"<unknown>\",\n \"groupId\": \"<string>\"\n },\n \"message\": {\n \"type\": \"<unknown>\",\n \"text\": \"<string>\",\n \"metadata\": {\n \"replyId\": \"<string>\"\n },\n \"attachedFileUrls\": [\n \"<string>\"\n ]\n },\n \"isStreamEnabled\": false,\n \"isOnlyRegistering\": false,\n \"prefilledVariables\": {},\n \"textBubbleContentFormat\": \"richText\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://typebot.io/api/v1/typebots/{typebotId}/preview/startChat")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"typebot\": {\n \"id\": \"<string>\",\n \"groups\": [\n {\n \"id\": \"<string>\",\n \"title\": \"<string>\",\n \"graphCoordinates\": {\n \"x\": 123,\n \"y\": 123\n },\n \"blocks\": [\n {\n \"id\": \"<string>\",\n \"type\": \"<unknown>\",\n \"label\": \"<string>\",\n \"outgoingEdgeId\": \"<string>\"\n }\n ]\n }\n ],\n \"events\": [],\n \"edges\": [\n {\n \"id\": \"<string>\",\n \"from\": {\n \"blockId\": \"<string>\",\n \"itemId\": \"<string>\",\n \"pathId\": \"<string>\"\n },\n \"to\": {\n \"groupId\": \"<string>\",\n \"blockId\": \"<string>\"\n }\n }\n ],\n \"variables\": [\n {\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"isSessionVariable\": true,\n \"value\": \"<string>\"\n }\n ],\n \"settings\": {\n \"general\": {\n \"isBrandingEnabled\": true,\n \"isTypingEmulationEnabled\": true,\n \"isInputPrefillEnabled\": true,\n \"isHideQueryParamsEnabled\": true,\n \"isNewResultOnRefreshEnabled\": true,\n \"rememberUser\": {\n \"isEnabled\": true\n },\n \"systemMessages\": {\n \"invalidMessage\": \"<string>\",\n \"botClosed\": \"<string>\",\n \"networkErrorTitle\": \"<string>\",\n \"networkErrorMessage\": \"<string>\",\n \"popupBlockedTitle\": \"<string>\",\n \"popupBlockedDescription\": \"<string>\",\n \"popupBlockedButtonLabel\": \"<string>\",\n \"fileUploadError\": \"<string>\",\n \"fileUploadSizeError\": \"<string>\",\n \"whatsAppPictureChoiceSelectLabel\": \"<string>\"\n }\n },\n \"typingEmulation\": {\n \"enabled\": true,\n \"speed\": 123,\n \"maxDelay\": 123,\n \"delayBetweenBubbles\": 2.5,\n \"isDisabledOnFirstMessage\": true\n },\n \"metadata\": {\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"imageUrl\": \"<string>\",\n \"favIconUrl\": \"<string>\",\n \"customHeadCode\": \"<string>\",\n \"googleTagManagerId\": \"<string>\",\n \"allowIndexing\": true\n },\n \"whatsApp\": {\n \"isEnabled\": true,\n \"sessionExpiryTimeout\": 24.005,\n \"errorAndMarketingStatusWebhookForwardUrl\": \"<string>\",\n \"isWebhookForwardingEnabled\": true,\n \"webhookForwardingEventTypes\": []\n },\n \"publicShare\": {\n \"isEnabled\": true\n },\n \"security\": {\n \"allowedOrigins\": [\n \"<string>\"\n ]\n }\n },\n \"theme\": {\n \"general\": {\n \"font\": \"<string>\",\n \"background\": {\n \"content\": \"<string>\"\n },\n \"progressBar\": {\n \"isEnabled\": true,\n \"color\": \"<string>\",\n \"backgroundColor\": \"<string>\",\n \"thickness\": 123\n }\n },\n \"chat\": {\n \"container\": {\n \"maxWidth\": \"<string>\",\n \"maxHeight\": \"<string>\",\n \"backgroundColor\": \"<string>\",\n \"color\": \"<string>\",\n \"blur\": 123,\n \"opacity\": 0.5,\n \"border\": {\n \"thickness\": 123,\n \"color\": \"<string>\",\n \"customRoundeness\": 123,\n \"opacity\": 0.5\n }\n },\n \"hostAvatar\": {\n \"isEnabled\": true,\n \"url\": \"<string>\"\n },\n \"guestAvatar\": {\n \"isEnabled\": true,\n \"url\": \"<string>\"\n },\n \"hostBubbles\": {\n \"backgroundColor\": \"<string>\",\n \"color\": \"<string>\",\n \"blur\": 123,\n \"opacity\": 0.5,\n \"border\": {\n \"thickness\": 123,\n \"color\": \"<string>\",\n \"customRoundeness\": 123,\n \"opacity\": 0.5\n }\n },\n \"guestBubbles\": {\n \"backgroundColor\": \"<string>\",\n \"color\": \"<string>\",\n \"blur\": 123,\n \"opacity\": 0.5,\n \"border\": {\n \"thickness\": 123,\n \"color\": \"<string>\",\n \"customRoundeness\": 123,\n \"opacity\": 0.5\n }\n },\n \"buttons\": {\n \"backgroundColor\": \"<string>\",\n \"color\": \"<string>\",\n \"blur\": 123,\n \"opacity\": 0.5,\n \"border\": {\n \"thickness\": 123,\n \"color\": \"<string>\",\n \"customRoundeness\": 123,\n \"opacity\": 0.5\n }\n },\n \"inputs\": {\n \"backgroundColor\": \"<string>\",\n \"color\": \"<string>\",\n \"blur\": 123,\n \"opacity\": 0.5,\n \"border\": {\n \"thickness\": 123,\n \"color\": \"<string>\",\n \"customRoundeness\": 123,\n \"opacity\": 0.5\n },\n \"placeholderColor\": \"<string>\"\n },\n \"buttonsInput\": {}\n },\n \"customCss\": \"<string>\"\n },\n \"updatedAt\": \"2023-11-07T05:31:56Z\",\n \"workspaceId\": \"<string>\",\n \"publicTypebotId\": \"<string>\"\n },\n \"sessionId\": \"<string>\",\n \"startFrom\": {\n \"type\": \"<unknown>\",\n \"groupId\": \"<string>\"\n },\n \"message\": {\n \"type\": \"<unknown>\",\n \"text\": \"<string>\",\n \"metadata\": {\n \"replyId\": \"<string>\"\n },\n \"attachedFileUrls\": [\n \"<string>\"\n ]\n },\n \"isStreamEnabled\": false,\n \"isOnlyRegistering\": false,\n \"prefilledVariables\": {},\n \"textBubbleContentFormat\": \"richText\"\n}"
response = http.request(request)
puts response.read_body{
"sessionId": "<string>",
"typebot": {
"id": "<string>",
"theme": {
"general": {
"font": "<string>",
"background": {
"content": "<string>"
},
"progressBar": {
"isEnabled": true,
"color": "<string>",
"backgroundColor": "<string>",
"thickness": 123
}
},
"chat": {
"container": {
"maxWidth": "<string>",
"maxHeight": "<string>",
"backgroundColor": "<string>",
"color": "<string>",
"blur": 123,
"opacity": 0.5,
"border": {
"thickness": 123,
"color": "<string>",
"customRoundeness": 123,
"opacity": 0.5
}
},
"hostAvatar": {
"isEnabled": true,
"url": "<string>"
},
"guestAvatar": {
"isEnabled": true,
"url": "<string>"
},
"hostBubbles": {
"backgroundColor": "<string>",
"color": "<string>",
"blur": 123,
"opacity": 0.5,
"border": {
"thickness": 123,
"color": "<string>",
"customRoundeness": 123,
"opacity": 0.5
}
},
"guestBubbles": {
"backgroundColor": "<string>",
"color": "<string>",
"blur": 123,
"opacity": 0.5,
"border": {
"thickness": 123,
"color": "<string>",
"customRoundeness": 123,
"opacity": 0.5
}
},
"buttons": {
"backgroundColor": "<string>",
"color": "<string>",
"blur": 123,
"opacity": 0.5,
"border": {
"thickness": 123,
"color": "<string>",
"customRoundeness": 123,
"opacity": 0.5
}
},
"inputs": {
"backgroundColor": "<string>",
"color": "<string>",
"blur": 123,
"opacity": 0.5,
"border": {
"thickness": 123,
"color": "<string>",
"customRoundeness": 123,
"opacity": 0.5
},
"placeholderColor": "<string>"
},
"buttonsInput": {}
},
"customCss": "<string>"
},
"settings": {
"general": {
"isBrandingEnabled": true,
"isTypingEmulationEnabled": true,
"isInputPrefillEnabled": true,
"isHideQueryParamsEnabled": true,
"isNewResultOnRefreshEnabled": true,
"rememberUser": {
"isEnabled": true
},
"systemMessages": {
"invalidMessage": "<string>",
"botClosed": "<string>",
"networkErrorTitle": "<string>",
"networkErrorMessage": "<string>",
"popupBlockedTitle": "<string>",
"popupBlockedDescription": "<string>",
"popupBlockedButtonLabel": "<string>",
"fileUploadError": "<string>",
"fileUploadSizeError": "<string>",
"whatsAppPictureChoiceSelectLabel": "<string>"
}
},
"typingEmulation": {
"enabled": true,
"speed": 123,
"maxDelay": 123,
"delayBetweenBubbles": 2.5,
"isDisabledOnFirstMessage": true
}
},
"publishedAt": "2023-11-07T05:31:56Z"
},
"messages": [
{
"id": "<string>",
"type": "<unknown>",
"content": {
"type": "<unknown>",
"richText": "<unknown>"
}
}
],
"lastMessageNewFormat": "<string>",
"input": {
"id": "<string>",
"type": "text input",
"outgoingEdgeId": "<string>",
"options": {
"labels": {
"placeholder": "<string>",
"button": "<string>"
},
"variableId": "<string>",
"isLong": true,
"audioClip": {
"isEnabled": true,
"saveVariableId": "<string>"
},
"attachments": {
"isEnabled": true,
"saveVariableId": "<string>"
}
},
"prefilledValue": "<string>",
"runtimeOptions": {
"paymentIntentSecret": "<string>",
"amountLabel": "<string>",
"publicKey": "<string>"
}
},
"clientSideActions": [
{
"type": "<unknown>",
"scriptToExecute": {
"content": "<string>",
"args": [
{
"id": "<string>",
"value": "<string>"
}
],
"isUnsafe": true,
"isCode": true
},
"lastBubbleBlockId": "<string>",
"expectsDedicatedReply": true
}
],
"logs": [
{
"description": "<string>",
"status": "<string>",
"details": "<string>",
"context": "<string>"
}
],
"dynamicTheme": {
"hostAvatarUrl": "<string>",
"guestAvatarUrl": "<string>",
"backgroundUrl": "<string>"
},
"progress": 123
}{
"defined": "<unknown>",
"code": "<unknown>",
"status": "<unknown>",
"message": "Bad Request",
"data": "<unknown>"
}{
"defined": "<unknown>",
"code": "<unknown>",
"status": "<unknown>",
"message": "Unauthorized",
"data": "<unknown>"
}{
"defined": "<unknown>",
"code": "<unknown>",
"status": "<unknown>",
"message": "Forbidden",
"data": "<unknown>"
}{
"defined": "<unknown>",
"code": "<unknown>",
"status": "<unknown>",
"message": "Not Found",
"data": "<unknown>"
}{
"defined": "<unknown>",
"code": "<unknown>",
"status": "<unknown>",
"message": "Internal Server Error",
"data": "<unknown>"
}Start preview chat
Use this endpoint to test your bot. The answers will not be saved. And some blocks like “Send email” will be skipped.
curl --request POST \
--url https://typebot.io/api/v1/typebots/{typebotId}/preview/startChat \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"typebot": {
"id": "<string>",
"groups": [
{
"id": "<string>",
"title": "<string>",
"graphCoordinates": {
"x": 123,
"y": 123
},
"blocks": [
{
"id": "<string>",
"type": "<unknown>",
"label": "<string>",
"outgoingEdgeId": "<string>"
}
]
}
],
"events": [],
"edges": [
{
"id": "<string>",
"from": {
"blockId": "<string>",
"itemId": "<string>",
"pathId": "<string>"
},
"to": {
"groupId": "<string>",
"blockId": "<string>"
}
}
],
"variables": [
{
"id": "<string>",
"name": "<string>",
"isSessionVariable": true,
"value": "<string>"
}
],
"settings": {
"general": {
"isBrandingEnabled": true,
"isTypingEmulationEnabled": true,
"isInputPrefillEnabled": true,
"isHideQueryParamsEnabled": true,
"isNewResultOnRefreshEnabled": true,
"rememberUser": {
"isEnabled": true
},
"systemMessages": {
"invalidMessage": "<string>",
"botClosed": "<string>",
"networkErrorTitle": "<string>",
"networkErrorMessage": "<string>",
"popupBlockedTitle": "<string>",
"popupBlockedDescription": "<string>",
"popupBlockedButtonLabel": "<string>",
"fileUploadError": "<string>",
"fileUploadSizeError": "<string>",
"whatsAppPictureChoiceSelectLabel": "<string>"
}
},
"typingEmulation": {
"enabled": true,
"speed": 123,
"maxDelay": 123,
"delayBetweenBubbles": 2.5,
"isDisabledOnFirstMessage": true
},
"metadata": {
"title": "<string>",
"description": "<string>",
"imageUrl": "<string>",
"favIconUrl": "<string>",
"customHeadCode": "<string>",
"googleTagManagerId": "<string>",
"allowIndexing": true
},
"whatsApp": {
"isEnabled": true,
"sessionExpiryTimeout": 24.005,
"errorAndMarketingStatusWebhookForwardUrl": "<string>",
"isWebhookForwardingEnabled": true,
"webhookForwardingEventTypes": []
},
"publicShare": {
"isEnabled": true
},
"security": {
"allowedOrigins": [
"<string>"
]
}
},
"theme": {
"general": {
"font": "<string>",
"background": {
"content": "<string>"
},
"progressBar": {
"isEnabled": true,
"color": "<string>",
"backgroundColor": "<string>",
"thickness": 123
}
},
"chat": {
"container": {
"maxWidth": "<string>",
"maxHeight": "<string>",
"backgroundColor": "<string>",
"color": "<string>",
"blur": 123,
"opacity": 0.5,
"border": {
"thickness": 123,
"color": "<string>",
"customRoundeness": 123,
"opacity": 0.5
}
},
"hostAvatar": {
"isEnabled": true,
"url": "<string>"
},
"guestAvatar": {
"isEnabled": true,
"url": "<string>"
},
"hostBubbles": {
"backgroundColor": "<string>",
"color": "<string>",
"blur": 123,
"opacity": 0.5,
"border": {
"thickness": 123,
"color": "<string>",
"customRoundeness": 123,
"opacity": 0.5
}
},
"guestBubbles": {
"backgroundColor": "<string>",
"color": "<string>",
"blur": 123,
"opacity": 0.5,
"border": {
"thickness": 123,
"color": "<string>",
"customRoundeness": 123,
"opacity": 0.5
}
},
"buttons": {
"backgroundColor": "<string>",
"color": "<string>",
"blur": 123,
"opacity": 0.5,
"border": {
"thickness": 123,
"color": "<string>",
"customRoundeness": 123,
"opacity": 0.5
}
},
"inputs": {
"backgroundColor": "<string>",
"color": "<string>",
"blur": 123,
"opacity": 0.5,
"border": {
"thickness": 123,
"color": "<string>",
"customRoundeness": 123,
"opacity": 0.5
},
"placeholderColor": "<string>"
},
"buttonsInput": {}
},
"customCss": "<string>"
},
"updatedAt": "2023-11-07T05:31:56Z",
"workspaceId": "<string>",
"publicTypebotId": "<string>"
},
"sessionId": "<string>",
"startFrom": {
"type": "<unknown>",
"groupId": "<string>"
},
"message": {
"type": "<unknown>",
"text": "<string>",
"metadata": {
"replyId": "<string>"
},
"attachedFileUrls": [
"<string>"
]
},
"isStreamEnabled": false,
"isOnlyRegistering": false,
"prefilledVariables": {},
"textBubbleContentFormat": "richText"
}
'import requests
url = "https://typebot.io/api/v1/typebots/{typebotId}/preview/startChat"
payload = {
"typebot": {
"id": "<string>",
"groups": [
{
"id": "<string>",
"title": "<string>",
"graphCoordinates": {
"x": 123,
"y": 123
},
"blocks": [
{
"id": "<string>",
"type": "<unknown>",
"label": "<string>",
"outgoingEdgeId": "<string>"
}
]
}
],
"events": [],
"edges": [
{
"id": "<string>",
"from": {
"blockId": "<string>",
"itemId": "<string>",
"pathId": "<string>"
},
"to": {
"groupId": "<string>",
"blockId": "<string>"
}
}
],
"variables": [
{
"id": "<string>",
"name": "<string>",
"isSessionVariable": True,
"value": "<string>"
}
],
"settings": {
"general": {
"isBrandingEnabled": True,
"isTypingEmulationEnabled": True,
"isInputPrefillEnabled": True,
"isHideQueryParamsEnabled": True,
"isNewResultOnRefreshEnabled": True,
"rememberUser": { "isEnabled": True },
"systemMessages": {
"invalidMessage": "<string>",
"botClosed": "<string>",
"networkErrorTitle": "<string>",
"networkErrorMessage": "<string>",
"popupBlockedTitle": "<string>",
"popupBlockedDescription": "<string>",
"popupBlockedButtonLabel": "<string>",
"fileUploadError": "<string>",
"fileUploadSizeError": "<string>",
"whatsAppPictureChoiceSelectLabel": "<string>"
}
},
"typingEmulation": {
"enabled": True,
"speed": 123,
"maxDelay": 123,
"delayBetweenBubbles": 2.5,
"isDisabledOnFirstMessage": True
},
"metadata": {
"title": "<string>",
"description": "<string>",
"imageUrl": "<string>",
"favIconUrl": "<string>",
"customHeadCode": "<string>",
"googleTagManagerId": "<string>",
"allowIndexing": True
},
"whatsApp": {
"isEnabled": True,
"sessionExpiryTimeout": 24.005,
"errorAndMarketingStatusWebhookForwardUrl": "<string>",
"isWebhookForwardingEnabled": True,
"webhookForwardingEventTypes": []
},
"publicShare": { "isEnabled": True },
"security": { "allowedOrigins": ["<string>"] }
},
"theme": {
"general": {
"font": "<string>",
"background": { "content": "<string>" },
"progressBar": {
"isEnabled": True,
"color": "<string>",
"backgroundColor": "<string>",
"thickness": 123
}
},
"chat": {
"container": {
"maxWidth": "<string>",
"maxHeight": "<string>",
"backgroundColor": "<string>",
"color": "<string>",
"blur": 123,
"opacity": 0.5,
"border": {
"thickness": 123,
"color": "<string>",
"customRoundeness": 123,
"opacity": 0.5
}
},
"hostAvatar": {
"isEnabled": True,
"url": "<string>"
},
"guestAvatar": {
"isEnabled": True,
"url": "<string>"
},
"hostBubbles": {
"backgroundColor": "<string>",
"color": "<string>",
"blur": 123,
"opacity": 0.5,
"border": {
"thickness": 123,
"color": "<string>",
"customRoundeness": 123,
"opacity": 0.5
}
},
"guestBubbles": {
"backgroundColor": "<string>",
"color": "<string>",
"blur": 123,
"opacity": 0.5,
"border": {
"thickness": 123,
"color": "<string>",
"customRoundeness": 123,
"opacity": 0.5
}
},
"buttons": {
"backgroundColor": "<string>",
"color": "<string>",
"blur": 123,
"opacity": 0.5,
"border": {
"thickness": 123,
"color": "<string>",
"customRoundeness": 123,
"opacity": 0.5
}
},
"inputs": {
"backgroundColor": "<string>",
"color": "<string>",
"blur": 123,
"opacity": 0.5,
"border": {
"thickness": 123,
"color": "<string>",
"customRoundeness": 123,
"opacity": 0.5
},
"placeholderColor": "<string>"
},
"buttonsInput": {}
},
"customCss": "<string>"
},
"updatedAt": "2023-11-07T05:31:56Z",
"workspaceId": "<string>",
"publicTypebotId": "<string>"
},
"sessionId": "<string>",
"startFrom": {
"type": "<unknown>",
"groupId": "<string>"
},
"message": {
"type": "<unknown>",
"text": "<string>",
"metadata": { "replyId": "<string>" },
"attachedFileUrls": ["<string>"]
},
"isStreamEnabled": False,
"isOnlyRegistering": False,
"prefilledVariables": {},
"textBubbleContentFormat": "richText"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
typebot: {
id: '<string>',
groups: [
{
id: '<string>',
title: '<string>',
graphCoordinates: {x: 123, y: 123},
blocks: [
{
id: '<string>',
type: '<unknown>',
label: '<string>',
outgoingEdgeId: '<string>'
}
]
}
],
events: [],
edges: [
{
id: '<string>',
from: {blockId: '<string>', itemId: '<string>', pathId: '<string>'},
to: {groupId: '<string>', blockId: '<string>'}
}
],
variables: [{id: '<string>', name: '<string>', isSessionVariable: true, value: '<string>'}],
settings: {
general: {
isBrandingEnabled: true,
isTypingEmulationEnabled: true,
isInputPrefillEnabled: true,
isHideQueryParamsEnabled: true,
isNewResultOnRefreshEnabled: true,
rememberUser: {isEnabled: true},
systemMessages: {
invalidMessage: '<string>',
botClosed: '<string>',
networkErrorTitle: '<string>',
networkErrorMessage: '<string>',
popupBlockedTitle: '<string>',
popupBlockedDescription: '<string>',
popupBlockedButtonLabel: '<string>',
fileUploadError: '<string>',
fileUploadSizeError: '<string>',
whatsAppPictureChoiceSelectLabel: '<string>'
}
},
typingEmulation: {
enabled: true,
speed: 123,
maxDelay: 123,
delayBetweenBubbles: 2.5,
isDisabledOnFirstMessage: true
},
metadata: {
title: '<string>',
description: '<string>',
imageUrl: '<string>',
favIconUrl: '<string>',
customHeadCode: '<string>',
googleTagManagerId: '<string>',
allowIndexing: true
},
whatsApp: {
isEnabled: true,
sessionExpiryTimeout: 24.005,
errorAndMarketingStatusWebhookForwardUrl: '<string>',
isWebhookForwardingEnabled: true,
webhookForwardingEventTypes: []
},
publicShare: {isEnabled: true},
security: {allowedOrigins: ['<string>']}
},
theme: {
general: {
font: '<string>',
background: {content: '<string>'},
progressBar: {
isEnabled: true,
color: '<string>',
backgroundColor: '<string>',
thickness: 123
}
},
chat: {
container: {
maxWidth: '<string>',
maxHeight: '<string>',
backgroundColor: '<string>',
color: '<string>',
blur: 123,
opacity: 0.5,
border: {thickness: 123, color: '<string>', customRoundeness: 123, opacity: 0.5}
},
hostAvatar: {isEnabled: true, url: '<string>'},
guestAvatar: {isEnabled: true, url: '<string>'},
hostBubbles: {
backgroundColor: '<string>',
color: '<string>',
blur: 123,
opacity: 0.5,
border: {thickness: 123, color: '<string>', customRoundeness: 123, opacity: 0.5}
},
guestBubbles: {
backgroundColor: '<string>',
color: '<string>',
blur: 123,
opacity: 0.5,
border: {thickness: 123, color: '<string>', customRoundeness: 123, opacity: 0.5}
},
buttons: {
backgroundColor: '<string>',
color: '<string>',
blur: 123,
opacity: 0.5,
border: {thickness: 123, color: '<string>', customRoundeness: 123, opacity: 0.5}
},
inputs: {
backgroundColor: '<string>',
color: '<string>',
blur: 123,
opacity: 0.5,
border: {thickness: 123, color: '<string>', customRoundeness: 123, opacity: 0.5},
placeholderColor: '<string>'
},
buttonsInput: {}
},
customCss: '<string>'
},
updatedAt: '2023-11-07T05:31:56Z',
workspaceId: '<string>',
publicTypebotId: '<string>'
},
sessionId: '<string>',
startFrom: {type: '<unknown>', groupId: '<string>'},
message: {
type: '<unknown>',
text: '<string>',
metadata: {replyId: '<string>'},
attachedFileUrls: ['<string>']
},
isStreamEnabled: false,
isOnlyRegistering: false,
prefilledVariables: {},
textBubbleContentFormat: 'richText'
})
};
fetch('https://typebot.io/api/v1/typebots/{typebotId}/preview/startChat', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://typebot.io/api/v1/typebots/{typebotId}/preview/startChat",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'typebot' => [
'id' => '<string>',
'groups' => [
[
'id' => '<string>',
'title' => '<string>',
'graphCoordinates' => [
'x' => 123,
'y' => 123
],
'blocks' => [
[
'id' => '<string>',
'type' => '<unknown>',
'label' => '<string>',
'outgoingEdgeId' => '<string>'
]
]
]
],
'events' => [
],
'edges' => [
[
'id' => '<string>',
'from' => [
'blockId' => '<string>',
'itemId' => '<string>',
'pathId' => '<string>'
],
'to' => [
'groupId' => '<string>',
'blockId' => '<string>'
]
]
],
'variables' => [
[
'id' => '<string>',
'name' => '<string>',
'isSessionVariable' => true,
'value' => '<string>'
]
],
'settings' => [
'general' => [
'isBrandingEnabled' => true,
'isTypingEmulationEnabled' => true,
'isInputPrefillEnabled' => true,
'isHideQueryParamsEnabled' => true,
'isNewResultOnRefreshEnabled' => true,
'rememberUser' => [
'isEnabled' => true
],
'systemMessages' => [
'invalidMessage' => '<string>',
'botClosed' => '<string>',
'networkErrorTitle' => '<string>',
'networkErrorMessage' => '<string>',
'popupBlockedTitle' => '<string>',
'popupBlockedDescription' => '<string>',
'popupBlockedButtonLabel' => '<string>',
'fileUploadError' => '<string>',
'fileUploadSizeError' => '<string>',
'whatsAppPictureChoiceSelectLabel' => '<string>'
]
],
'typingEmulation' => [
'enabled' => true,
'speed' => 123,
'maxDelay' => 123,
'delayBetweenBubbles' => 2.5,
'isDisabledOnFirstMessage' => true
],
'metadata' => [
'title' => '<string>',
'description' => '<string>',
'imageUrl' => '<string>',
'favIconUrl' => '<string>',
'customHeadCode' => '<string>',
'googleTagManagerId' => '<string>',
'allowIndexing' => true
],
'whatsApp' => [
'isEnabled' => true,
'sessionExpiryTimeout' => 24.005,
'errorAndMarketingStatusWebhookForwardUrl' => '<string>',
'isWebhookForwardingEnabled' => true,
'webhookForwardingEventTypes' => [
]
],
'publicShare' => [
'isEnabled' => true
],
'security' => [
'allowedOrigins' => [
'<string>'
]
]
],
'theme' => [
'general' => [
'font' => '<string>',
'background' => [
'content' => '<string>'
],
'progressBar' => [
'isEnabled' => true,
'color' => '<string>',
'backgroundColor' => '<string>',
'thickness' => 123
]
],
'chat' => [
'container' => [
'maxWidth' => '<string>',
'maxHeight' => '<string>',
'backgroundColor' => '<string>',
'color' => '<string>',
'blur' => 123,
'opacity' => 0.5,
'border' => [
'thickness' => 123,
'color' => '<string>',
'customRoundeness' => 123,
'opacity' => 0.5
]
],
'hostAvatar' => [
'isEnabled' => true,
'url' => '<string>'
],
'guestAvatar' => [
'isEnabled' => true,
'url' => '<string>'
],
'hostBubbles' => [
'backgroundColor' => '<string>',
'color' => '<string>',
'blur' => 123,
'opacity' => 0.5,
'border' => [
'thickness' => 123,
'color' => '<string>',
'customRoundeness' => 123,
'opacity' => 0.5
]
],
'guestBubbles' => [
'backgroundColor' => '<string>',
'color' => '<string>',
'blur' => 123,
'opacity' => 0.5,
'border' => [
'thickness' => 123,
'color' => '<string>',
'customRoundeness' => 123,
'opacity' => 0.5
]
],
'buttons' => [
'backgroundColor' => '<string>',
'color' => '<string>',
'blur' => 123,
'opacity' => 0.5,
'border' => [
'thickness' => 123,
'color' => '<string>',
'customRoundeness' => 123,
'opacity' => 0.5
]
],
'inputs' => [
'backgroundColor' => '<string>',
'color' => '<string>',
'blur' => 123,
'opacity' => 0.5,
'border' => [
'thickness' => 123,
'color' => '<string>',
'customRoundeness' => 123,
'opacity' => 0.5
],
'placeholderColor' => '<string>'
],
'buttonsInput' => [
]
],
'customCss' => '<string>'
],
'updatedAt' => '2023-11-07T05:31:56Z',
'workspaceId' => '<string>',
'publicTypebotId' => '<string>'
],
'sessionId' => '<string>',
'startFrom' => [
'type' => '<unknown>',
'groupId' => '<string>'
],
'message' => [
'type' => '<unknown>',
'text' => '<string>',
'metadata' => [
'replyId' => '<string>'
],
'attachedFileUrls' => [
'<string>'
]
],
'isStreamEnabled' => false,
'isOnlyRegistering' => false,
'prefilledVariables' => [
],
'textBubbleContentFormat' => 'richText'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://typebot.io/api/v1/typebots/{typebotId}/preview/startChat"
payload := strings.NewReader("{\n \"typebot\": {\n \"id\": \"<string>\",\n \"groups\": [\n {\n \"id\": \"<string>\",\n \"title\": \"<string>\",\n \"graphCoordinates\": {\n \"x\": 123,\n \"y\": 123\n },\n \"blocks\": [\n {\n \"id\": \"<string>\",\n \"type\": \"<unknown>\",\n \"label\": \"<string>\",\n \"outgoingEdgeId\": \"<string>\"\n }\n ]\n }\n ],\n \"events\": [],\n \"edges\": [\n {\n \"id\": \"<string>\",\n \"from\": {\n \"blockId\": \"<string>\",\n \"itemId\": \"<string>\",\n \"pathId\": \"<string>\"\n },\n \"to\": {\n \"groupId\": \"<string>\",\n \"blockId\": \"<string>\"\n }\n }\n ],\n \"variables\": [\n {\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"isSessionVariable\": true,\n \"value\": \"<string>\"\n }\n ],\n \"settings\": {\n \"general\": {\n \"isBrandingEnabled\": true,\n \"isTypingEmulationEnabled\": true,\n \"isInputPrefillEnabled\": true,\n \"isHideQueryParamsEnabled\": true,\n \"isNewResultOnRefreshEnabled\": true,\n \"rememberUser\": {\n \"isEnabled\": true\n },\n \"systemMessages\": {\n \"invalidMessage\": \"<string>\",\n \"botClosed\": \"<string>\",\n \"networkErrorTitle\": \"<string>\",\n \"networkErrorMessage\": \"<string>\",\n \"popupBlockedTitle\": \"<string>\",\n \"popupBlockedDescription\": \"<string>\",\n \"popupBlockedButtonLabel\": \"<string>\",\n \"fileUploadError\": \"<string>\",\n \"fileUploadSizeError\": \"<string>\",\n \"whatsAppPictureChoiceSelectLabel\": \"<string>\"\n }\n },\n \"typingEmulation\": {\n \"enabled\": true,\n \"speed\": 123,\n \"maxDelay\": 123,\n \"delayBetweenBubbles\": 2.5,\n \"isDisabledOnFirstMessage\": true\n },\n \"metadata\": {\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"imageUrl\": \"<string>\",\n \"favIconUrl\": \"<string>\",\n \"customHeadCode\": \"<string>\",\n \"googleTagManagerId\": \"<string>\",\n \"allowIndexing\": true\n },\n \"whatsApp\": {\n \"isEnabled\": true,\n \"sessionExpiryTimeout\": 24.005,\n \"errorAndMarketingStatusWebhookForwardUrl\": \"<string>\",\n \"isWebhookForwardingEnabled\": true,\n \"webhookForwardingEventTypes\": []\n },\n \"publicShare\": {\n \"isEnabled\": true\n },\n \"security\": {\n \"allowedOrigins\": [\n \"<string>\"\n ]\n }\n },\n \"theme\": {\n \"general\": {\n \"font\": \"<string>\",\n \"background\": {\n \"content\": \"<string>\"\n },\n \"progressBar\": {\n \"isEnabled\": true,\n \"color\": \"<string>\",\n \"backgroundColor\": \"<string>\",\n \"thickness\": 123\n }\n },\n \"chat\": {\n \"container\": {\n \"maxWidth\": \"<string>\",\n \"maxHeight\": \"<string>\",\n \"backgroundColor\": \"<string>\",\n \"color\": \"<string>\",\n \"blur\": 123,\n \"opacity\": 0.5,\n \"border\": {\n \"thickness\": 123,\n \"color\": \"<string>\",\n \"customRoundeness\": 123,\n \"opacity\": 0.5\n }\n },\n \"hostAvatar\": {\n \"isEnabled\": true,\n \"url\": \"<string>\"\n },\n \"guestAvatar\": {\n \"isEnabled\": true,\n \"url\": \"<string>\"\n },\n \"hostBubbles\": {\n \"backgroundColor\": \"<string>\",\n \"color\": \"<string>\",\n \"blur\": 123,\n \"opacity\": 0.5,\n \"border\": {\n \"thickness\": 123,\n \"color\": \"<string>\",\n \"customRoundeness\": 123,\n \"opacity\": 0.5\n }\n },\n \"guestBubbles\": {\n \"backgroundColor\": \"<string>\",\n \"color\": \"<string>\",\n \"blur\": 123,\n \"opacity\": 0.5,\n \"border\": {\n \"thickness\": 123,\n \"color\": \"<string>\",\n \"customRoundeness\": 123,\n \"opacity\": 0.5\n }\n },\n \"buttons\": {\n \"backgroundColor\": \"<string>\",\n \"color\": \"<string>\",\n \"blur\": 123,\n \"opacity\": 0.5,\n \"border\": {\n \"thickness\": 123,\n \"color\": \"<string>\",\n \"customRoundeness\": 123,\n \"opacity\": 0.5\n }\n },\n \"inputs\": {\n \"backgroundColor\": \"<string>\",\n \"color\": \"<string>\",\n \"blur\": 123,\n \"opacity\": 0.5,\n \"border\": {\n \"thickness\": 123,\n \"color\": \"<string>\",\n \"customRoundeness\": 123,\n \"opacity\": 0.5\n },\n \"placeholderColor\": \"<string>\"\n },\n \"buttonsInput\": {}\n },\n \"customCss\": \"<string>\"\n },\n \"updatedAt\": \"2023-11-07T05:31:56Z\",\n \"workspaceId\": \"<string>\",\n \"publicTypebotId\": \"<string>\"\n },\n \"sessionId\": \"<string>\",\n \"startFrom\": {\n \"type\": \"<unknown>\",\n \"groupId\": \"<string>\"\n },\n \"message\": {\n \"type\": \"<unknown>\",\n \"text\": \"<string>\",\n \"metadata\": {\n \"replyId\": \"<string>\"\n },\n \"attachedFileUrls\": [\n \"<string>\"\n ]\n },\n \"isStreamEnabled\": false,\n \"isOnlyRegistering\": false,\n \"prefilledVariables\": {},\n \"textBubbleContentFormat\": \"richText\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://typebot.io/api/v1/typebots/{typebotId}/preview/startChat")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"typebot\": {\n \"id\": \"<string>\",\n \"groups\": [\n {\n \"id\": \"<string>\",\n \"title\": \"<string>\",\n \"graphCoordinates\": {\n \"x\": 123,\n \"y\": 123\n },\n \"blocks\": [\n {\n \"id\": \"<string>\",\n \"type\": \"<unknown>\",\n \"label\": \"<string>\",\n \"outgoingEdgeId\": \"<string>\"\n }\n ]\n }\n ],\n \"events\": [],\n \"edges\": [\n {\n \"id\": \"<string>\",\n \"from\": {\n \"blockId\": \"<string>\",\n \"itemId\": \"<string>\",\n \"pathId\": \"<string>\"\n },\n \"to\": {\n \"groupId\": \"<string>\",\n \"blockId\": \"<string>\"\n }\n }\n ],\n \"variables\": [\n {\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"isSessionVariable\": true,\n \"value\": \"<string>\"\n }\n ],\n \"settings\": {\n \"general\": {\n \"isBrandingEnabled\": true,\n \"isTypingEmulationEnabled\": true,\n \"isInputPrefillEnabled\": true,\n \"isHideQueryParamsEnabled\": true,\n \"isNewResultOnRefreshEnabled\": true,\n \"rememberUser\": {\n \"isEnabled\": true\n },\n \"systemMessages\": {\n \"invalidMessage\": \"<string>\",\n \"botClosed\": \"<string>\",\n \"networkErrorTitle\": \"<string>\",\n \"networkErrorMessage\": \"<string>\",\n \"popupBlockedTitle\": \"<string>\",\n \"popupBlockedDescription\": \"<string>\",\n \"popupBlockedButtonLabel\": \"<string>\",\n \"fileUploadError\": \"<string>\",\n \"fileUploadSizeError\": \"<string>\",\n \"whatsAppPictureChoiceSelectLabel\": \"<string>\"\n }\n },\n \"typingEmulation\": {\n \"enabled\": true,\n \"speed\": 123,\n \"maxDelay\": 123,\n \"delayBetweenBubbles\": 2.5,\n \"isDisabledOnFirstMessage\": true\n },\n \"metadata\": {\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"imageUrl\": \"<string>\",\n \"favIconUrl\": \"<string>\",\n \"customHeadCode\": \"<string>\",\n \"googleTagManagerId\": \"<string>\",\n \"allowIndexing\": true\n },\n \"whatsApp\": {\n \"isEnabled\": true,\n \"sessionExpiryTimeout\": 24.005,\n \"errorAndMarketingStatusWebhookForwardUrl\": \"<string>\",\n \"isWebhookForwardingEnabled\": true,\n \"webhookForwardingEventTypes\": []\n },\n \"publicShare\": {\n \"isEnabled\": true\n },\n \"security\": {\n \"allowedOrigins\": [\n \"<string>\"\n ]\n }\n },\n \"theme\": {\n \"general\": {\n \"font\": \"<string>\",\n \"background\": {\n \"content\": \"<string>\"\n },\n \"progressBar\": {\n \"isEnabled\": true,\n \"color\": \"<string>\",\n \"backgroundColor\": \"<string>\",\n \"thickness\": 123\n }\n },\n \"chat\": {\n \"container\": {\n \"maxWidth\": \"<string>\",\n \"maxHeight\": \"<string>\",\n \"backgroundColor\": \"<string>\",\n \"color\": \"<string>\",\n \"blur\": 123,\n \"opacity\": 0.5,\n \"border\": {\n \"thickness\": 123,\n \"color\": \"<string>\",\n \"customRoundeness\": 123,\n \"opacity\": 0.5\n }\n },\n \"hostAvatar\": {\n \"isEnabled\": true,\n \"url\": \"<string>\"\n },\n \"guestAvatar\": {\n \"isEnabled\": true,\n \"url\": \"<string>\"\n },\n \"hostBubbles\": {\n \"backgroundColor\": \"<string>\",\n \"color\": \"<string>\",\n \"blur\": 123,\n \"opacity\": 0.5,\n \"border\": {\n \"thickness\": 123,\n \"color\": \"<string>\",\n \"customRoundeness\": 123,\n \"opacity\": 0.5\n }\n },\n \"guestBubbles\": {\n \"backgroundColor\": \"<string>\",\n \"color\": \"<string>\",\n \"blur\": 123,\n \"opacity\": 0.5,\n \"border\": {\n \"thickness\": 123,\n \"color\": \"<string>\",\n \"customRoundeness\": 123,\n \"opacity\": 0.5\n }\n },\n \"buttons\": {\n \"backgroundColor\": \"<string>\",\n \"color\": \"<string>\",\n \"blur\": 123,\n \"opacity\": 0.5,\n \"border\": {\n \"thickness\": 123,\n \"color\": \"<string>\",\n \"customRoundeness\": 123,\n \"opacity\": 0.5\n }\n },\n \"inputs\": {\n \"backgroundColor\": \"<string>\",\n \"color\": \"<string>\",\n \"blur\": 123,\n \"opacity\": 0.5,\n \"border\": {\n \"thickness\": 123,\n \"color\": \"<string>\",\n \"customRoundeness\": 123,\n \"opacity\": 0.5\n },\n \"placeholderColor\": \"<string>\"\n },\n \"buttonsInput\": {}\n },\n \"customCss\": \"<string>\"\n },\n \"updatedAt\": \"2023-11-07T05:31:56Z\",\n \"workspaceId\": \"<string>\",\n \"publicTypebotId\": \"<string>\"\n },\n \"sessionId\": \"<string>\",\n \"startFrom\": {\n \"type\": \"<unknown>\",\n \"groupId\": \"<string>\"\n },\n \"message\": {\n \"type\": \"<unknown>\",\n \"text\": \"<string>\",\n \"metadata\": {\n \"replyId\": \"<string>\"\n },\n \"attachedFileUrls\": [\n \"<string>\"\n ]\n },\n \"isStreamEnabled\": false,\n \"isOnlyRegistering\": false,\n \"prefilledVariables\": {},\n \"textBubbleContentFormat\": \"richText\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://typebot.io/api/v1/typebots/{typebotId}/preview/startChat")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"typebot\": {\n \"id\": \"<string>\",\n \"groups\": [\n {\n \"id\": \"<string>\",\n \"title\": \"<string>\",\n \"graphCoordinates\": {\n \"x\": 123,\n \"y\": 123\n },\n \"blocks\": [\n {\n \"id\": \"<string>\",\n \"type\": \"<unknown>\",\n \"label\": \"<string>\",\n \"outgoingEdgeId\": \"<string>\"\n }\n ]\n }\n ],\n \"events\": [],\n \"edges\": [\n {\n \"id\": \"<string>\",\n \"from\": {\n \"blockId\": \"<string>\",\n \"itemId\": \"<string>\",\n \"pathId\": \"<string>\"\n },\n \"to\": {\n \"groupId\": \"<string>\",\n \"blockId\": \"<string>\"\n }\n }\n ],\n \"variables\": [\n {\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"isSessionVariable\": true,\n \"value\": \"<string>\"\n }\n ],\n \"settings\": {\n \"general\": {\n \"isBrandingEnabled\": true,\n \"isTypingEmulationEnabled\": true,\n \"isInputPrefillEnabled\": true,\n \"isHideQueryParamsEnabled\": true,\n \"isNewResultOnRefreshEnabled\": true,\n \"rememberUser\": {\n \"isEnabled\": true\n },\n \"systemMessages\": {\n \"invalidMessage\": \"<string>\",\n \"botClosed\": \"<string>\",\n \"networkErrorTitle\": \"<string>\",\n \"networkErrorMessage\": \"<string>\",\n \"popupBlockedTitle\": \"<string>\",\n \"popupBlockedDescription\": \"<string>\",\n \"popupBlockedButtonLabel\": \"<string>\",\n \"fileUploadError\": \"<string>\",\n \"fileUploadSizeError\": \"<string>\",\n \"whatsAppPictureChoiceSelectLabel\": \"<string>\"\n }\n },\n \"typingEmulation\": {\n \"enabled\": true,\n \"speed\": 123,\n \"maxDelay\": 123,\n \"delayBetweenBubbles\": 2.5,\n \"isDisabledOnFirstMessage\": true\n },\n \"metadata\": {\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"imageUrl\": \"<string>\",\n \"favIconUrl\": \"<string>\",\n \"customHeadCode\": \"<string>\",\n \"googleTagManagerId\": \"<string>\",\n \"allowIndexing\": true\n },\n \"whatsApp\": {\n \"isEnabled\": true,\n \"sessionExpiryTimeout\": 24.005,\n \"errorAndMarketingStatusWebhookForwardUrl\": \"<string>\",\n \"isWebhookForwardingEnabled\": true,\n \"webhookForwardingEventTypes\": []\n },\n \"publicShare\": {\n \"isEnabled\": true\n },\n \"security\": {\n \"allowedOrigins\": [\n \"<string>\"\n ]\n }\n },\n \"theme\": {\n \"general\": {\n \"font\": \"<string>\",\n \"background\": {\n \"content\": \"<string>\"\n },\n \"progressBar\": {\n \"isEnabled\": true,\n \"color\": \"<string>\",\n \"backgroundColor\": \"<string>\",\n \"thickness\": 123\n }\n },\n \"chat\": {\n \"container\": {\n \"maxWidth\": \"<string>\",\n \"maxHeight\": \"<string>\",\n \"backgroundColor\": \"<string>\",\n \"color\": \"<string>\",\n \"blur\": 123,\n \"opacity\": 0.5,\n \"border\": {\n \"thickness\": 123,\n \"color\": \"<string>\",\n \"customRoundeness\": 123,\n \"opacity\": 0.5\n }\n },\n \"hostAvatar\": {\n \"isEnabled\": true,\n \"url\": \"<string>\"\n },\n \"guestAvatar\": {\n \"isEnabled\": true,\n \"url\": \"<string>\"\n },\n \"hostBubbles\": {\n \"backgroundColor\": \"<string>\",\n \"color\": \"<string>\",\n \"blur\": 123,\n \"opacity\": 0.5,\n \"border\": {\n \"thickness\": 123,\n \"color\": \"<string>\",\n \"customRoundeness\": 123,\n \"opacity\": 0.5\n }\n },\n \"guestBubbles\": {\n \"backgroundColor\": \"<string>\",\n \"color\": \"<string>\",\n \"blur\": 123,\n \"opacity\": 0.5,\n \"border\": {\n \"thickness\": 123,\n \"color\": \"<string>\",\n \"customRoundeness\": 123,\n \"opacity\": 0.5\n }\n },\n \"buttons\": {\n \"backgroundColor\": \"<string>\",\n \"color\": \"<string>\",\n \"blur\": 123,\n \"opacity\": 0.5,\n \"border\": {\n \"thickness\": 123,\n \"color\": \"<string>\",\n \"customRoundeness\": 123,\n \"opacity\": 0.5\n }\n },\n \"inputs\": {\n \"backgroundColor\": \"<string>\",\n \"color\": \"<string>\",\n \"blur\": 123,\n \"opacity\": 0.5,\n \"border\": {\n \"thickness\": 123,\n \"color\": \"<string>\",\n \"customRoundeness\": 123,\n \"opacity\": 0.5\n },\n \"placeholderColor\": \"<string>\"\n },\n \"buttonsInput\": {}\n },\n \"customCss\": \"<string>\"\n },\n \"updatedAt\": \"2023-11-07T05:31:56Z\",\n \"workspaceId\": \"<string>\",\n \"publicTypebotId\": \"<string>\"\n },\n \"sessionId\": \"<string>\",\n \"startFrom\": {\n \"type\": \"<unknown>\",\n \"groupId\": \"<string>\"\n },\n \"message\": {\n \"type\": \"<unknown>\",\n \"text\": \"<string>\",\n \"metadata\": {\n \"replyId\": \"<string>\"\n },\n \"attachedFileUrls\": [\n \"<string>\"\n ]\n },\n \"isStreamEnabled\": false,\n \"isOnlyRegistering\": false,\n \"prefilledVariables\": {},\n \"textBubbleContentFormat\": \"richText\"\n}"
response = http.request(request)
puts response.read_body{
"sessionId": "<string>",
"typebot": {
"id": "<string>",
"theme": {
"general": {
"font": "<string>",
"background": {
"content": "<string>"
},
"progressBar": {
"isEnabled": true,
"color": "<string>",
"backgroundColor": "<string>",
"thickness": 123
}
},
"chat": {
"container": {
"maxWidth": "<string>",
"maxHeight": "<string>",
"backgroundColor": "<string>",
"color": "<string>",
"blur": 123,
"opacity": 0.5,
"border": {
"thickness": 123,
"color": "<string>",
"customRoundeness": 123,
"opacity": 0.5
}
},
"hostAvatar": {
"isEnabled": true,
"url": "<string>"
},
"guestAvatar": {
"isEnabled": true,
"url": "<string>"
},
"hostBubbles": {
"backgroundColor": "<string>",
"color": "<string>",
"blur": 123,
"opacity": 0.5,
"border": {
"thickness": 123,
"color": "<string>",
"customRoundeness": 123,
"opacity": 0.5
}
},
"guestBubbles": {
"backgroundColor": "<string>",
"color": "<string>",
"blur": 123,
"opacity": 0.5,
"border": {
"thickness": 123,
"color": "<string>",
"customRoundeness": 123,
"opacity": 0.5
}
},
"buttons": {
"backgroundColor": "<string>",
"color": "<string>",
"blur": 123,
"opacity": 0.5,
"border": {
"thickness": 123,
"color": "<string>",
"customRoundeness": 123,
"opacity": 0.5
}
},
"inputs": {
"backgroundColor": "<string>",
"color": "<string>",
"blur": 123,
"opacity": 0.5,
"border": {
"thickness": 123,
"color": "<string>",
"customRoundeness": 123,
"opacity": 0.5
},
"placeholderColor": "<string>"
},
"buttonsInput": {}
},
"customCss": "<string>"
},
"settings": {
"general": {
"isBrandingEnabled": true,
"isTypingEmulationEnabled": true,
"isInputPrefillEnabled": true,
"isHideQueryParamsEnabled": true,
"isNewResultOnRefreshEnabled": true,
"rememberUser": {
"isEnabled": true
},
"systemMessages": {
"invalidMessage": "<string>",
"botClosed": "<string>",
"networkErrorTitle": "<string>",
"networkErrorMessage": "<string>",
"popupBlockedTitle": "<string>",
"popupBlockedDescription": "<string>",
"popupBlockedButtonLabel": "<string>",
"fileUploadError": "<string>",
"fileUploadSizeError": "<string>",
"whatsAppPictureChoiceSelectLabel": "<string>"
}
},
"typingEmulation": {
"enabled": true,
"speed": 123,
"maxDelay": 123,
"delayBetweenBubbles": 2.5,
"isDisabledOnFirstMessage": true
}
},
"publishedAt": "2023-11-07T05:31:56Z"
},
"messages": [
{
"id": "<string>",
"type": "<unknown>",
"content": {
"type": "<unknown>",
"richText": "<unknown>"
}
}
],
"lastMessageNewFormat": "<string>",
"input": {
"id": "<string>",
"type": "text input",
"outgoingEdgeId": "<string>",
"options": {
"labels": {
"placeholder": "<string>",
"button": "<string>"
},
"variableId": "<string>",
"isLong": true,
"audioClip": {
"isEnabled": true,
"saveVariableId": "<string>"
},
"attachments": {
"isEnabled": true,
"saveVariableId": "<string>"
}
},
"prefilledValue": "<string>",
"runtimeOptions": {
"paymentIntentSecret": "<string>",
"amountLabel": "<string>",
"publicKey": "<string>"
}
},
"clientSideActions": [
{
"type": "<unknown>",
"scriptToExecute": {
"content": "<string>",
"args": [
{
"id": "<string>",
"value": "<string>"
}
],
"isUnsafe": true,
"isCode": true
},
"lastBubbleBlockId": "<string>",
"expectsDedicatedReply": true
}
],
"logs": [
{
"description": "<string>",
"status": "<string>",
"details": "<string>",
"context": "<string>"
}
],
"dynamicTheme": {
"hostAvatarUrl": "<string>",
"guestAvatarUrl": "<string>",
"backgroundUrl": "<string>"
},
"progress": 123
}{
"defined": "<unknown>",
"code": "<unknown>",
"status": "<unknown>",
"message": "Bad Request",
"data": "<unknown>"
}{
"defined": "<unknown>",
"code": "<unknown>",
"status": "<unknown>",
"message": "Unauthorized",
"data": "<unknown>"
}{
"defined": "<unknown>",
"code": "<unknown>",
"status": "<unknown>",
"message": "Forbidden",
"data": "<unknown>"
}{
"defined": "<unknown>",
"code": "<unknown>",
"status": "<unknown>",
"message": "Not Found",
"data": "<unknown>"
}{
"defined": "<unknown>",
"code": "<unknown>",
"status": "<unknown>",
"message": "Internal Server Error",
"data": "<unknown>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Body
If set, it will override the typebot that is used to start the chat.
- Option 1
- Option 2
Show child attributes
Show child attributes
If provided, will be used as the session ID and will overwrite any existing session with the same ID.
- Option 1
- Option 2
Show child attributes
Show child attributes
Only provide it if your flow starts with an input block and you'd like to directly provide an answer to it.
- Option 1
- Option 2
- Option 3
Show child attributes
Show child attributes
If enabled, you will be required to stream OpenAI completions on a client and send the generated response back to the API.
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.
Show child attributes
Show child attributes
richText, markdown Response
OK
To save and use for /continueChat requests.
Show child attributes
Show child attributes
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
Show child attributes
Show child attributes
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.
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
- Option 7
- Option 8
- Option 9
- Option 10
- Option 11
- Option 12
- Option 13
- Option 14
- Option 15
- Option 16
Show child attributes
Show child attributes
Actions to execute on the client side
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
- Option 7
- Option 8
- Option 9
- Option 10
- Option 11
- Option 12
- Option 13
Show child attributes
Show child attributes
Logs that were saved during the last execution
Show child attributes
Show child attributes
If the typebot contains dynamic avatars, dynamicTheme returns the new avatar URLs whenever their variables are updated.
Show child attributes
Show child attributes
If progress bar is enabled, this field will return a number between 0 and 100 indicating the current progress based on the longest remaining path of the flow.