How to Store User Input in a Variable

The chat bot can take user inputs and store them in variables as well. One can use these data and perform actions such as

  1. Record these user inputs in an excel sheet

  2. Update the data to a third party application such as CRM

  3. Perform data transfer through API and fetch real time data based on user interests

Follow below steps to store the user inputs in custom variables:


  1. Drag a message card to the canvas. Select the type as text.

  2. Type the message : тАЬWhat is your name?тАЭ

  3. Check mark Input Expected from user

  4. MSG91 provides 4 pre-defined variables for one to use, customer_mobile, customer_name, customer_email and Catalog.

    Screenshot 2025-06-09 5.42.47 PM.png
  5. Select customer_name and click on save.

    Screenshot 2025-06-09 5.44.20 PM.pngScreenshot 2025-06-09 5.44.28 PM.png

  1. In order to create a custom a variable, follow below steps:

  2. Enter the question in the text card, such as 'тАЬ Which country do you live in?тАЭ

  3. Check the Input Expected from User check mark.

  4. Type тАЬuser_countryтАЭ or the variable name in the store response tab

  5. Click on the тАЬCreate user_countryтАЭ option pop-up.

    Screenshot 2025-06-09 5.51.43 PM.png
  6. Choose the variable type as custom or global

    Custom Variable : Variables created in one flow are isolated and couldnтАЩt be accessed in other flows.

    Global Variable : Variables can now be defined globally and can be referenced with their values in any part of the bot.


  7. Click on save.

  8. One can also read the user inputs saved in the variables or use them for the data transfer using APIs.

  9. Drag a message card, and type the message as : тАЬDo you confirm you live in {{user_country}}? тАЬ. Click on Save.

  10. This will display/ read the user inputs provided by the user and will let you save it in a variable as well.