startChat prefilledVariables
Hi,
I'm trying to use the TypeBot API to start the image.
I need to use the values of the variables from prefilledVariables (/v1/typebots/{public Id}/startChat) in the bot flow.
body:
{
"isOnlyRegistering": false,
"message":"oi",
"prefilledVariables": {
"name": "john",
"email": "[email protected]"
}
}
Response:
{
"sessionId": "clstswkr9006baes42ue3l6uo",
"typebot": {
"id": "clssyfxgc0011dour5pthdngn",
"theme": {},
"settings": {
"general": {
"isInputPrefillEnabled": true,
"isHideQueryParamsEnabled": true,
"rememberUser": {
"isEnabled": false
}
}
}
},
"messages": [
{
"id": "s3tdlo432udonb2eh31bsk7s",
"type": "text",
"content": {
"richText": [
{
"type": "p",
"children": [
{
"text": "Teste "
},
{
"type": "inline-variable",
"children": []
}
]
}
]
}
}
]
}
I can't display the values of the variables.
Where am I going wrong?
Another question: Is it possible to create a variable with the sessionId value within the flow?

9 Replies
Is the variable declared? By the looks of it, you just wrote "{{name}}" without actually declaring the variable
It's declared but it doesn't work

Hmm, is it correctly published?
is published correctly. The entire flow works but does not display the variables. I tested it on my own instance and directly through my account at https://typebot.io
Typebot - Open-source conversational apps builder
Powerful blocks to create unique chat experiences. Embed them anywhere on your apps and start collecting results like magic.
In fact, what you send as a response body does not match your flow screenshot
So we can't guess what's not working here.
I just tried this:

Returns correctly:
What version are you using?
I was using typebotId when I should have been using publicId. now it's working. thanks
I'm using publicId and the error persists.
I'm using version 2.22.2
Sorry!
I misunderstood how "profilledVariables" worked, I thought there was no need to create them within the flow, I was just using them by typing {{name_of_variable}}.
Now everything is working 100%!
Once again, sorry for the intrusion.