From 38c39d4a3130de6b775ae0b48156337c0c0a30a9 Mon Sep 17 00:00:00 2001 From: Baptiste Arnaud Date: Mon, 28 Mar 2022 17:35:07 +0200 Subject: [PATCH] =?UTF-8?q?docs:=20=F0=9F=93=9D=20Add=20`hiddenVariables`?= =?UTF-8?q?=20JS=20instructions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/docs/docs/editor/variables.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/apps/docs/docs/editor/variables.md b/apps/docs/docs/editor/variables.md index 968c804ac..269f0ea9d 100644 --- a/apps/docs/docs/editor/variables.md +++ b/apps/docs/docs/editor/variables.md @@ -23,6 +23,19 @@ Let's say I have a variable named "Email" somewhere in my bot. If I'm launching Then if an input step is saving the answer into this variable, it will be first prefilled with this initial value. It can greatly improve the user experience if you already have data about him. +Prefilling variables using the embed library is even easier. You need to add an object named `hiddenVariables` that contains a dictionary of your values. For example: + +```js +Typebot.initBubble({ + url: `https://viewer.typebot.io/typebot-support`, + hiddenVariables: { + 'User ID': '123', + 'First name': 'John', + Email: 'test@test.com', + }, +}) +``` + ### Hidden variables These are simply variables that are declared in the bot flow but aren't displayed to the user anywhere. This allows you to add some context to a session for example a User ID, a `utm_source` parameter (in the case of a marketing campaign), or anything else.