Using Placeholders
Written By revealai
Last updated 18 days ago
RevealAI offers two different types of placeholders which you can use to create personalized interview flows:
Previous Response placeholders - insert content from a response to a previous question
Custom attribute placeholders - insert custom data into any question
We'll cover how to set up each below:
Previous Response Placeholder
Create at least one question to start
Edit the question ID to something meaningful (optional, but helpful)
Create a new question
Click the Add Placeholder button (button highlighted in red in image below) from the toolbar. This will display the placeholder modal.
Select the question you’d like to refer to
Click “Insert”

That’s it. Now the chatbot will refer back to the previous questions answer to create a more seamless experience.
If you wish to edit or delete the placeholder, simply click on the pencil or trash can icon on the chip, respectively.

Custom Attribute Placeholder
Custom Attribute Placeholders are set up in a similar fashion to the Previous Response Placeholders. The main difference is how the data is supplied. While Previous Response Placeholders pull in data from previous questions, Custom Attribute Placeholders are fed externally via url parameters. These are used for information about the participant that is known prior to taking the interview. Think things like, first name or job title or location. Let’s take a look at how to take advantage of this amazing feature starting with attribute creation in the interview.
Create a new question.
Click the Add Custom Attribute Placeholder button (button highlighted in red in image below) from the toolbar. This will display a dropdown menu.
If you don’t have established attributes, “New Placeholder Attribute” will be the only option. Click that option to get started. Once you have created attributes, the will be displayed here to reuse quickly.
You should now see the Create Custom Attribute Placeholder. Give your attribute a meaningful name. Please not that no spaces are allowed — dashes or camel case are advised. You may also leave additional instructions for the chatbot at this point.
Click Insert. The placeholder will now appear inline as part of your question.

Now that you have a custom attribute created and inserted into a question, let's learn how to get some custom data in there.
There are a couple ways to match data up with the inline custom attributes. The first is to simply tack the attribute on the end of the interview URL using the attribute-nameOfAttribute=value format. This can be added to either a standard url that links directly to an interview provided by our system or an interview that has been iFramed.
Example// Simple Example
var url = "https://chat.getreveal.ai/i/6877cb3d6f0cc6a09862d275?attribute-jobTitle=manager"
// value is longer so the javascript encodeURIComponent function is used to
var url = `https://chat.getreveal.ai/i/6877cb3d6f0cc6a09862d275?attribute-age-range=${encodeURIComponent('16-24: Young')}`There’s another way to pipe these values in. You can use a format similar to the one above, but instead of referring to a single value, you’ll pass in an object of all the attributes as key:value pairs. This object needs then needs to be turned to a string and base64 encoded and added to the url under the attributes (notice the ‘s’ making it plural) query
Exampleconst attributesObject = {firstName: "John", jobTitle: "Operations Manager"}
const asString = JSON.stringify(attributesObject)
const attributesAsEncodedString = btoa(asString)
const src="https://chat.getreveal.ai/i/688d00486f0cc6a098634da6?iframe=true” + “?attributes=” + attributesAsEncodedString
<iframe src=src />With this format, you can pass in as many values as you want