Collect input
A Collect input block can be used to get information from the user. When the user gives information, the bot will first check if the info corresponds to an already known variable.
Add a Collect input block by dragging and dropping it to your flow.

A Collect input gets info from the user, checks it, and saves it as a variable.

A Collect input will typically do 3 things:
defining which input type you're looking at
Add a question step
A Collect input should clearly ask to the user for some input.

Capture user response as
The Collect input first checks if the input is matching an input type.

For voicebots, make sure you use the voiceMessage input type.
If so, the Collect input saves that input under a destination variable.

Input types
Collect input blocks have 3 types of input recognition:
General input types to check if the input follows a desired format.
System input types to check if the input follows a certain Chatlayer built-in entity.
Chatlayer extracts data from user inputs. For instance, if an input plugin has a type of date and the input is 'I need to be in Paris in two days,' the parser will identify 'in two days' as the date. It converts this into the DD-MM-YYYY format and stores the result in the user session.
Please note that the number of system entities that you can use inside a Collect input block is limited. The system entities that you can use inside those blocks are: sys.email, sys.phone_number, sys.url, sys.number, and sys.time.
General input
The General input type checks if the input follows a desired format.
Any
The Any input type will accept all string values as an input.
It is important to know that intents and entities are processed before parsers. This can be useful for automatically extracting certain pieces of a sentence as an answer to a question. We've provided a great example of this in our tutorial.
Date
The Date input parser type will parse the response as a date. Sentences like 'next week Monday' are automatically converted to a DD-MM-YYYY date object. Supported formats (also in other supported NLP languages) are:
22-04-2018
22-04
22 apr
22 april 18
twenty two April 2018
yesterday
today
now
last night
tomorrow, tmr
in two weeks
in 3 days
next Monday
next week Friday
last/past Monday
last/past week
within/in 5/five days
Friday/Fri
Image
The Image format type allows you to check if a user has uploaded an image or other file (such as pdf).
The image will be saved as an array. If you chose {img} as variable, this means that you should use {img[0]} to retrieve the URL for the first saved image.
For the chat widget (web channel), we recommend using the file upload step.
To save a user's attachment at any point in the flow, use the defaultOnFileUpload variable. This variable will store the URL of the attachment uploaded by the user, regardless of where they are in the conversation.
Location
The Location parser sendsthe user's input to a Google Geocoding API service. When a correct address or location is recognized, the Chatlayer platform will automatically create an object that contains all relevant geo-data.

Look at the block above. When the user answers the question "Where do you work?" with a valid location, this information will be stored as a userLocationInformed variable (you can rename this variable if needed).
Below is an example that shows how the userLocationInformed variable would be stored when the user responds with 'Chatlayer.ai':
To show the address as a full address (street, street number, zip code and city) you need to add some extra information to the variable: .fullAddress
So in the example above, the bot can display the entire location by using the following variable:{userLocationInformed.fullAddress}
A bot message containing the following info:
Thank you, shall I send your package to {userLocationInformed.fullAddress}?
Will display the following message to the user:
Thank you, shall I send your package to Oudeleeuwenrui 39, 2000 Antwerpen, Belgium?
Language
This input type will parse and validate NLP supported languages.
English: (en-us): 'engels', 'English', 'en', 'anglais'
Dutch (nl-nl): 'nederlands', 'Dutch', 'ned', 'nl', 'vlaams', 'hollands', 'be', 'ned', 'néerlandais', 'belgisch'
French (fr-fr): 'French', 'français', 'frans', 'fr', 'francais'
Chinese (zh-cn): 'Chinese', 'cn', 'zh', 'chinees'
Spanish (es-es): 'Spanish', 'español', 'es', 'spaans'
Italian (it-it): 'Italian', 'italiaans', 'italiano', 'it
German (de-de): 'German', 'duits', 'de', 'deutsch
Japanese (ja-jp): 'Japanese', 'japans', 'jp', '日本の
Brazil Portugese (pt-br): 'Brazil Portugese', 'Portugese', 'portugees', 'braziliaans portugees', 'português'
voiceMessage
Use the voiceMessage input type to save voice channel messages as text. Configure the maximum duration and completion time for these messages.

System entity input
The Collect input parser can check if the given input is consistent with the format for one of the following system entities. Whenever a system entity is chosen in the 'Check if response matches' dropdown, you can give the variable a name that works for you.

🆕 LLM-based system entity recognition
Your bot is now capable of recognizing system entities depending on the context of the conversation, using LLM technology.
For now, this feature is only available for system entities.
For example:
Go to your bot Settings.
Under Generative AI, click the toggle next to Turn on generative AI features.
Toggle on LLM-based entity recognition.

Click Save.
Go back to your Flows.
Create a Collect input that checks the number of passengers and check if it matches a @sys.number input.

Display that variable in the next block.
Test the bot: the bot now recognizes more complex sentences as the right number of people!

Entity input
After you created an entity, you can check that the user input matches it.
Learn more about which entity type suits your use case.
Check if the input matches
A Collect input block checks whether the user response matches an already-known variable:
If the variable does not have a value yet, the bot will ask the question written in the Collect input block. At this point, either:
The value matches, and the variable is filled.
The value doesn't match, and the fallback questions are asked.
The user doesn't answer, and you decide to detect this silence.
If the variable has a value already, the bot will automatically skip the Collect input block.
When the user response matches
If the response is matched at the time where the Collect input gets triggered, it will be saved correctly under the specified variable name in the debugger.
If the Collect input block is skipped, that is because the variable is already known. Variables can be known already for various reasons:
The user has answered this question before.
A previous entity was detected with the same variable name.
The user is authenticated and the variable was automatically set.
🆕 When the user response doesn't match
When the user provides an invalid response the bot should inform the user that their answer was invalid.
Retries
Set up how many times you want the bot to ask the question again. Typically, this would just ask to reformulate.

Fallback
Set up a fallback message to where to redirect the user when the user used all their retries already. Typically, this would lead to help from customer support, for instance.

No response
You can configure the bot to detect when a user remains silent for a specified period. It triggers a specific block when no response is received within the set timeframe or by a predetermined time.
You can set how long it takes for the new block to trigger in the duration field (in minutes or at a specific time). The duration of silence can be from 1 minute up to 1440 minutes (24 hours).

Capture user response as
The bottom of your Collect input block can be configured so that you're sure to detect the answer that you're looking for.

Disable NLP
Users are able to leave the Collect input if an intent is recognized. For bots with a very small NLP model, this might trigger a false positive. The 'disable NLP' checkbox allows you to disable the NLP model while in the Collect input, which makes sure that whatever the user says gets saved as input.
For date variable: Always past - always future
When you decide to check a date variable, Chatlayer parses the user expression to match a default date format. If the date you ask should always be in the present or future, you can use these options. A user saying “Thursday” for example will be either mapped to last or next Thursday.
Last updated
Was this helpful?