Share feedback, ideas and get community help

Updated last year

Prefilled variable on startChat

At a glance

The community member is asking if they can set a value for a variable when starting a chat via the API using the startChat method. A community member suggests that the prefilled variables need to be sent in the JSON body, and provides an example of how to do this. Another community member confirms that this solution works perfectly.

Useful resources
Hey, everyone!

I know there is a way to set a value for a variable when starting a chat (as explained here: https://docs.typebot.io/editor/variables#prefilled-variables), but can I do the same when I'm starting the chat via API (using the startChat method)?

Using it this way, the URL would look like this: https://bot.mydomain.com.br/api/v1/typebots/myBot/startChat?ContactName=test&PhoneNumber=123
m
g
3 comments
I think you need send in json body
{
"prefilledVariables": {
"name": "John"
}
}
Thank you, @Michaelvips. It works perfectly! πŸ‘πŸ»
Add a reply
Sign up and join the conversation on Discord