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": "john@gmail.com" } } 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?
No description
9 Replies
gk
gk4mo ago
Is the variable declared? By the looks of it, you just wrote "{{name}}" without actually declaring the variable
PabloDocarmo
PabloDocarmo4mo ago
It's declared but it doesn't work
No description
Baptiste
Baptiste4mo ago
Hmm, is it correctly published?
PabloDocarmo
PabloDocarmo4mo ago
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.
Baptiste
Baptiste4mo ago
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:
Baptiste
Baptiste4mo ago
No description
Baptiste
Baptiste4mo ago
curl --request POST \
--url https://typebot.io/api/v1/typebots/my-typebot-9lkozk3/startChat \
--header 'Content-Type: application/json' \
--data '{
"prefilledVariables": {
"name": "Baptiste"
}
}'
curl --request POST \
--url https://typebot.io/api/v1/typebots/my-typebot-9lkozk3/startChat \
--header 'Content-Type: application/json' \
--data '{
"prefilledVariables": {
"name": "Baptiste"
}
}'
Returns correctly:
{"sessionId":"clsx1twis00du102pk6ajnkxw","typebot":{"id":"clsx1rtpk0003ojy599lkozk3","theme":{},"settings":{}},"messages":[{"id":"g3xj6y00srayikf3ogewqvop","type":"text","content":{"richText":[{"type":"p","children":[{"text":"Welcome "},{"type":"inline-variable","children":[{"type":"p","children":[{"text":"Baptiste"}]}]},{"text":" !!!"}]}]}}]}
{"sessionId":"clsx1twis00du102pk6ajnkxw","typebot":{"id":"clsx1rtpk0003ojy599lkozk3","theme":{},"settings":{}},"messages":[{"id":"g3xj6y00srayikf3ogewqvop","type":"text","content":{"richText":[{"type":"p","children":[{"text":"Welcome "},{"type":"inline-variable","children":[{"type":"p","children":[{"text":"Baptiste"}]}]},{"text":" !!!"}]}]}}]}
PabloDocarmo
PabloDocarmo4mo ago
What version are you using? I was using typebotId when I should have been using publicId. now it's working. thanks
Julio Albuquerque
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.