Genesys Cloud - Developer Community!

 View Only

Sign Up

  • 1.  How can I make the bot's slot capture only spoken numbers?

    Posted 4 days ago
    Edited by Camila Meneghini 4 days ago

    Hello, when creating a bot to receive information by voice, we use an existing slot with builtin:number and a prompt asking the user to give a rating from 0 to 10.


    When the information is received, if the response contains words or interjections, the slot still captures that input.

    Is there a way to make the bot's slot register only spoken numbers, without capturing letters or words?


    #Architect 

    ------------------------------
    Camila Meneghini
    ------------------------------



  • 2.  RE: How can I make the bot's slot capture only spoken numbers?

    Posted 3 days ago

    Not in a position to try it at the moment - but could you make the slot a custom list only containing the number -  I believe it would then be forced to return one of the valid options



    ------------------------------
    Richard Robinson
    Senior Technical Account Manager
    ------------------------------



  • 3.  RE: How can I make the bot's slot capture only spoken numbers?

    Posted 3 days ago

    Hi Camila,

    You can try using regex slot type to capture only number.

    Test these regex and see results

    Option 1) \b(10|ten|[0-9]|zero|one|two|three|four|five|six|seven|eight|nine)\b 

    Option 2)  \b[0-9]{4,17}\b. This regex will capture the number 0-9 from length 4 to 17. You can adjust length based on your requirement.



    ------------------------------
    Thanks!

    Ganesh S
    ------------------------------



  • 4.  RE: How can I make the bot's slot capture only spoken numbers?

    Posted 3 days ago

    Hi Camila,

    One approach you could try is using a slot with type any instead of builtin:number and then validating the value using a regular expression.

    With the any slot, the bot will capture the full user input, and after that you can apply a regex validation to ensure the value is strictly a number within the expected range (for example 0–10). If the input contains words, interjections, or any other characters, the validation will fail and you can reprompt the user.

    For example, you could validate the captured value with a regex like:

    ^(10|[0-9])$

    This ensures that only numbers from 0 to 10 are accepted.

    This approach gives you more control over validation compared to relying only on builtin:number, especially in voice scenarios where speech recognition may capture additional words along with the number.



    ------------------------------
    Mateus Nunes
    Tech Leader Of CX at Solve4ME
    Brazil
    ------------------------------