PrefilledVariables

I start the typebot via api through a POST request via axios in my TypeScript project. Everything is working correctly except passing profilledVariables. I'm passing it as an object in the axios request, but TypeBot doesn't "capture" the values of these variables. My typebot is self-hosted via docker. Has anyone managed to use PrefilledVariables in a self-hosted environment?
15 Replies
tecmusti
tecmusti4mo ago
I did
Julio Albuquerque
Can you tell me how you did it?
PabloDocarmo
PabloDocarmo4mo ago
I believe that what he is trying to do is not what this part of the documentation shows. It intends to use the API (https://docs.typebot.io/api-reference/chat/start-chat) I also tried to use it and was unsuccessful.
tecmusti
tecmusti4mo ago
No description
No description
Julio Albuquerque
Exactly what I'm doing, but the variable is not populated at all! Returns like this: { "type": "p", "children": [ { "text": "Nome: " }, { "type": "inline-variable", "children": [] } ] }, I'm making the request like this: const reqData = { isStreamEnabled: true, isOnlyRegistering: false, prefilledVariables: { numberContact: data.key.remoteJid.split('@')[0] data.from.split('@')[0], nameContact: data.verifiedBizName data.pushName || 'Anônimo' } }; const config = { headers: { 'Content-Type': 'application/json', Accept: 'application/json' }, maxBodyLength: Infinity }; const request = await axios.post(${url}/typebots/${typebotName}/startChat, reqData, config); Yes! I'm doing exactly what the documentation says, but I can't pass variables in startChat. I'm using version 2.22.2.
Julio Albuquerque
I'm using it and it's working, I just can't pass variables in startChat: https://docs.typebot.io/editor/variables#prefilled-variables
PabloDocarmo
PabloDocarmo4mo ago
what version are you using?
Julio Albuquerque
2.22.2
PabloDocarmo
PabloDocarmo4mo ago
I'm also using version 2.22.2 I'm having the same problem as you.
Julio Albuquerque
I'll try to downgrade and test which version it will work on... I'll see in git if there is any case about this.
tecmusti
tecmusti4mo ago
Is it working when you test on dashboard? If it is, then the problem is at your code part. console.log("reqData",reqData) before sending the request and take the screenshot and post here please. I am also using same version, and it is working.
Julio Albuquerque
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.
tecmusti
tecmusti4mo ago
No problem, we all miss something.
imoclub
imoclub4mo ago
nice insight, btw anyone have integrate typebot to telegram via api? just curious how it can handle the button and upload file