How to get number from input message?

Hi guys,

I have a question about user input.

How can I get the number from user input message?

For instance;

user: “I want to buy 25 tickets for tonight”

I wanna get the 25 to user.numberOfTickets = 25 .

Can anyone help me…Thanks a lot…

Hi,

To accomplish this task, you will have to create a Slot.

First go: understanding > intents (in the left pannel)

Then add an intent. You can call it “tickets”

Then add at least 3 utterances for the intent. For example:

I want to buy 5 tickets for tonight!
I want to buy 15 tickets for tonight!
I want to buy 25 tickets for tonight!

Then add a slot of type @system.number that you will call “numberOfTickets”

The result should look like this:

Finally, in the flow, you can acces the extracted slot like this:

Yes, here are: {{event.nlu.slots.numberOfTickets.value}} tickets!

Now if you right

“I want to buy 49 tickets for tonight!”

The bot will answer:

“yes, here are: 49 tickets!”

1 Like

Thanks for replying man!
I am thankful to you :hugs:

You’re welcome! :slight_smile: