Yash
Yash3mo ago

Receive User Information through chatbot

I know that I can receive a userid using the chatbot. but what if want to receive more information as soon as the user login. I would pass this information through my frontend. Which fields can I pass in my request to recive the information
1 Reply
Tico | Voiceflow Assistant
You can send much more than just the userID when you initialise the web-chat. All the data is added to the object you pass to window.voiceflow.chat.load(). 1. Identify the user
userID: 'user_12345' // becomes the built-in {user_id} variable
userID: 'user_12345' // becomes the built-in {user_id} variable
2. Pre-fill variables your agent needs
launch: {
event: {
type: 'launch',
payload: {
user_name: 'Mary', // ↳ will appear in the `last_event` system var
user_email: 'mary@test.com',
plan_type: 'pro'
}
}
}
launch: {
event: {
type: 'launch',
payload: {
user_name: 'Mary', // ↳ will appear in the `last_event` system var
user_email: 'mary@test.com',
plan_type: 'pro'
}
}
}
• Every key inside payload must already exist as a Voiceflow variable (e.g. user_name, user_email, plan_type).
• Grab the values at the start of the flow with a JS step, e.g.:
user_name = last_event.payload.user_name;
plan_type = last_event.payload.plan_type;
user_name = last_event.payload.user_name;
plan_type = last_event.payload.plan_type;
3. Add transcript-only metadata (shows up in the Transcripts UI, not in your logic)
user: {
name: 'Mary', // label shown in Transcripts
image: 'https://…/avatar.jpg' // optional avatar shown in Transcripts
}
user: {
name: 'Mary', // label shown in Transcripts
image: 'https://…/avatar.jpg' // optional avatar shown in Transcripts
}
Full example
window.voiceflow.chat.load({
verify: { projectID: 'YOUR_PROJECT_ID' },
url: 'https://general-runtime.voiceflow.com',
versionID:'production',

userID: 'user_12345',

launch: {
event: {
type: 'launch',
payload: {
user_name: 'Mary',
user_email: 'mary@test.com',
plan_type: 'pro'
}
}
},

user: {
name: 'Mary',
image: 'https://example.com/avatar.jpg'
}
});
window.voiceflow.chat.load({
verify: { projectID: 'YOUR_PROJECT_ID' },
url: 'https://general-runtime.voiceflow.com',
versionID:'production',

userID: 'user_12345',

launch: {
event: {
type: 'launch',
payload: {
user_name: 'Mary',
user_email: 'mary@test.com',
plan_type: 'pro'
}
}
},

user: {
name: 'Mary',
image: 'https://example.com/avatar.jpg'
}
});
That’s it—when the chat opens your assistant immediately receives all the values you placed in payload, plus {user_id}, letting you personalise the conversation from the very first step. Docs: https://docs.voiceflow.com

Did you find this page helpful?