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.

Collect input tab.

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

What a Collect input block looks like on the canvas.

A Collect input will typically do 3 things:

Add a question step

A Collect input should clearly ask to the user for some input.

Ask a question to the user.

Capture user response as

The Collect input first checks if the input is matching an input type.

Check if the user input matches.

For voicebots, make sure you use the voiceMessage input type.

If so, the Collect input saves that input under a destination variable.

Save the match input into a 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.

  • Entity input types to check the user input with a bot entity.

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.

Check the user location.

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':

{
    fullAddress: "Oudeleeuwenrui 39, 2000 Antwerpen, Belgium",
    latitude: 51.227317,
    longitude: 4.409155999999999,
    streetNumber: "39",
    streetName: "Oudeleeuwenrui",
    city: "Antwerpen",
    country: "Belgium",
    zipcode: "2000",
}

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.

Hours

This input type will parse and validate timestamps.

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.

Rename the variable that matches the system entity parser.

🆕 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:

  1. Go to your bot Settings.

  2. Under Generative AI, click the toggle next to Turn on generative AI features.

  3. Toggle on LLM-based entity recognition.

  1. Click Save.

  2. Go back to your Flows.

  3. Create a Collect input that checks the number of passengers and check if it matches a @sys.number input.

  1. Display that variable in the next block.

  2. 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:

  • 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.

🆕 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.

Set up Retries inside Collect input blocks.

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.

Set up a fallback after X retries.

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).

You can select between 'wait for' or 'wait until' for user response before triggering a block

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?