Share feedback, ideas and get community help

Updated 6 months ago

Import flow - API

At a glance

A community member is trying to import a flow via the API, but is receiving an error message indicating that the request is invalid. The community members suggest that the issue is related to the format of the request body, which should include the actual typebot object instead of just the typebot ID. After several attempts, the community member finally provides the correct request body, which includes the full typebot object, and this resolves the issue.

Useful resources
Hello everything is fine?

I'm trying to import a flow via api.

I'm passing it on the body

{
"workspaceId": "<Workspace ID>",
"typebot": "<Typebot ID>"
}


as well as in the documentation.

But I'm getting the following error:

----

Status code 400
{"message":"Input validation failed","code":"BAD_REQUEST","issues":[{"code":"invalid_type","expected":"string","received":"undefined"," path":["typebot","name"],"message":"Required"},{"code":"invalid_type","expected":"array","received":"undefined","path" :["typebot","variables"],"message":"Required"},{"code":"invalid_type","expected":"object","received":"undefined","path":[ "typebot","theme"],"message":"Required"},{"code":"invalid_type","expected":"object","received":"undefined","path":["typebot ","settings"],"message":"Required"},{"code":"invalid_type","expected":"string","received":"undefined","path":["typebot", "icon"],"message":"Required"},{"code":"invalid_type","expected":"string","received":"undefined","path":["typebot","folderId "],"message":"Required"}]}

-----

Does anyone know why?

Thank you very much
B
N
9 comments
You need to provide the actual typebot object, not the ID
If you'd like to duplicate a bot, I suggest you first get it (https://docs.typebot.io/api/get-a-typebot), then pass it to the import request (https://docs.typebot.io/api/import-a-typebot)
sorry for the ignorance....

I got type bot and this was the answer:

{
"typebot": {
"version": "6",
"id": "clpvdm3410011ni1qot0mifnz",
"name": "Bot 8",
"events": [
{
"id": "nfmk97dt2pm8ikbv5slpy11y",
"graphCoordinates": {
"x": 0,
"y": 0
},
"type": "start"
}
],
"groups": [],
"edges": [],
"variables": [],
"theme": {},
"selectedThemeTemplateId": "null",
"settings": {},
"createdAt": "2023-12-07T15:52:01.345Z",
"updatedAt": "2023-12-07T17:15:59.498Z",
"icon": "https://i.pinimg.com/280x280_RS/54/57/23/5457232228f551ca700f654d3574a973.jpg",
"folderId": null,
"publicId": "bot-8-t0mifnz",
"customDomain": null,
"workspaceId": "clnhz27f10001qw2lznyc4t26",
"resultsTablePreferences": null,
"isArchived": false,
"isClosed": false,
"whatsAppCredentialsId": null
},
"isReadOnly": false
}


So far ok!

However, when I try to import by providing the available IDs, including publicID, I get the same error return.
Show us your import request, how does it look like?
I get the same return


Status code 400
{"message":"Input validation failed","code":"BAD_REQUEST","issues":[{"code":"invalid_type","expected":"string","received":"undefined"," path":["typebot","name"],"message":"Required"},{"code":"invalid_type","expected":"array","received":"undefined","path" :["typebot","variables"],"message":"Required"},{"code":"invalid_type","expected":"object","received":"undefined","path":[ "typebot","theme"],"message":"Required"},{"code":"invalid_type","expected":"object","received":"undefined","path":["typebot ","settings"],"message":"Required"},{"code":"invalid_type","expected":"string","received":"undefined","path":["typebot", "icon"],"message":"Required"},{"code":"invalid_type","expected":"string","received":"undefined","path":["typebot","folderId "],"message":"Required"}]}
Show us the request, not the response
{
"workspaceId": "<clnhz27f10001qw2lznyc4t26>",
"typebot": "<clpvdm3410011ni1qot0mifnz>"
}

I also tried with

{
"workspaceId": "<clnhz27f10001qw2lznyc4t26>",
"typebot": "<nfmk97dt2pm8ikbv5slpy11y>"
}

and

{
"workspaceId": "<clnhz27f10001qw2lznyc4t26>",
"typebot": "<bot-8-t0mifnz>"
}
Well, here you provide a typebot id. And my first message said "You need to provide the actual typebot object, not the ID" 😅
Perfect, I understood what you meant.

I passed this bodysuit

{
"workspaceId": "<Workspace ID>",
"typebot": {
"version": "6",
"id": "clpvdm3410011ni1qot0mifnz",
"name": "Bot 8",
"events": [
{
"id": "nfmk97dt2pm8ikbv5slpy11y",
"graphCoordinates": {
"x": 0,
"y": 0
},
"type": "start"
}
],
"groups": [],
"edges": [],
"variables": [],
"theme": {},
"selectedThemeTemplateId": null,
"settings": {},
"createdAt": "2023-12-07T15:52:01.345Z",
"updatedAt": "2023-12-07T17:15:59.498Z",
"icon": "https://i.pinimg.com/280x280_RS/54/57/23/5457232228f551ca700f654d3574a973.jpg",
"folderId": null,
"publicId": "bot-8-t0mifnz",
"customDomain": null,
"workspaceId": "clnhz27f10001qw2lznyc4t26",
"resultsTablePreferences": null,
"isArchived": false,
"isClosed": false,
"whatsAppCredentialsId": null
},
"isReadOnly": false
}


And it worked perfectly.

Thank you very much master.
Add a reply
Sign up and join the conversation on Discord