Genesys Cloud - Developer Community!

 View Only

Sign Up

Expand all | Collapse all

Validate 8-digit Date of Birth slot length in Genesys Cloud Voice Bot

  • 1.  Validate 8-digit Date of Birth slot length in Genesys Cloud Voice Bot

    Posted 4 days ago

    We have a Genesys Cloud voice bot that asks the customer to provide their date of birth as 8 digits (for example, DDMMYYYY).

    Sometimes the customer does not say or enter all 8 digits. Is there a way to validate the slot/entity value so that the bot only accepts it when the length is exactly 8 digits?

    If the value contains fewer or more than 8 digits, we would like the bot to prompt the customer again.

    What is the recommended way to implement this in Genesys Cloud Bot Flow / Architect?

    Regards,

    Adnan


    #Architect

    ------------------------------
    Adnan Hassan
    Senior Solution Consultant
    ------------------------------


  • 2.  RE: Validate 8-digit Date of Birth slot length in Genesys Cloud Voice Bot

    Posted 4 days ago
    Edited by Marcello Jabur 4 days ago

    Hi Adnan,

    Sure, there should be at least 2 ways of doing this, probably more.

    For the slot that you are trying to collect, you can create it as a "Regular Expression" Type Slot, and just define a regular expression on it that validates 8 digits (For example: ^\d{8}$ ).

    If the information provided by the customer doesn't match the Regex, then it will be treated as "No Match" (which you can then set the Bot Flow to repeat X times on No Match, etc.)

    Also, another way of doing this, is using the "Custom Validation" property on the "Ask for Slot" component. In there you can set any expression to validate as a boolean (true or false), after the collection is done. So for instance, you could just use the "Length()" expression to check if your slot variable has 8 digits of length.



    ------------------------------
    Marcello Jabur
    ------------------------------



  • 3.  RE: Validate 8-digit Date of Birth slot length in Genesys Cloud Voice Bot

    Posted 3 days ago

    Hi Marcello,

    Thank you for your reply.

    In our bot, customers can provide their date of birth either by speaking or entering it manually.

    If a customer enters their date of birth, for example in DDMMYYYY format, we can validate whether the input contains all 8 digits. However, if the customer provides their date of birth verbally, for example, "13 January," how can we validate whether they have provided the complete date of birth, including the year?

    Is there a way to check that the customer has spoken their full date of birth?

    Regareds,

    Adnan



    ------------------------------
    Adnan Hassan
    Senior Solution Consultant
    ------------------------------



  • 4.  RE: Validate 8-digit Date of Birth slot length in Genesys Cloud Voice Bot

    Posted 2 days ago

    If you can afford spending 1/2 a token, you should consider a virtual agent slot with a description like "Caller will provide their date of birth and it must be in the past and include month, day, and year.  Output the date as YYYY-MM-DD. "  It will work perfect every time.  

    If using REGEX, I like this for MM/DD/YYYY /[01-12]{2}\/[01-31]{2}\/[1-2][0-9]{3}/g



    ------------------------------
    Robert Wakefield-Carl
    Senior AI Partner Architect
    ------------------------------



  • 5.  RE: Validate 8-digit Date of Birth slot length in Genesys Cloud Voice Bot

    Posted 2 days ago
    Edited by Francis Guo 2 days ago

    You can create a Slot : DataOfBirth with Slot Type: buildin: date
    When you collect this slot, it will automatically check if the slot is a valid date. 



    ------------------------------
    Francis Guo
    NA
    ------------------------------



  • 6.  RE: Validate 8-digit Date of Birth slot length in Genesys Cloud Voice Bot

    Posted 6 hours ago

    Hi Francis,

    I am using the slot with slot buildin: date but unfortunately when i enter or speak like this 13011/13 feb slot automatically convert the date correct format.

    I am attching the snapshot.

    Is there any thing i missed in Slot?

    Regards,

    Adnan



    ------------------------------
    Adnan Hassan
    Senior Solution Consultant
    ------------------------------



  • 7.  RE: Validate 8-digit Date of Birth slot length in Genesys Cloud Voice Bot

    Posted 5 hours ago
    Edited by Phaneendra Avatapalli 5 hours ago

    Hi Adnan,

    From my understanding, I think the behaviour you're seeing is because you're using the built-in Date slot.

    The built-in Date slot is designed to interpret the customer's input as a date and normalise the result, rather than validate that exactly 8 digits were entered. So if Genesys can interpret an incomplete numeric input as a date, the slot may still be populated instead of re-prompting based on length.

    Since your requirement is specifically to collect exactly 8 digits in DDMMYYYY format, I think capturing it as a numeric sequence/string would be a better fit than using the built-in Date slot.

    If you have Virtual Agent enabled, one option is an AI-powered Numeric Sequence slot, which allows you to configure an exact character length of 8. Alternatively, for a standard Bot Flow, a custom RegEx slot such as:

    ^\d{8}$

    could be tested to accept exactly 8 digits and re-prompt when the input doesn't match.

    Once the 8 digits are captured, you could then separately validate that they represent a valid date.

    So I think the Date slot is behaving as a date parser here; it just may not be the right slot type when the requirement is strict 8-digit DOB collection.



    ------------------------------
    Phaneendra
    Technical Solutions Consultant
    ------------------------------



  • 8.  RE: Validate 8-digit Date of Birth slot length in Genesys Cloud Voice Bot

    Posted 5 hours ago

    Hi @Adnan Hassan ,

    Hope you're doing well.

    If you're currently using Genesys Virtual Agent in your Bot Flow, you may be able to use the AI-Powered Slot Type for this requirement. It provides a more flexible way to define the expected input and the rules that the slot should follow, which can make it easier to handle date-of-birth inputs provided through voice.

    For your use case, you can configure the date slot with instructions such as requiring the day, month, and year and preventing the bot from assuming a missing year.

    I've also attached an example showing how the AI-Powered date slot can be configured for this use case.

    If you'd like, I can provide a step-by-step guide for configuring this in Architect, including the slot configuration, example utterances, and how to handle incomplete inputs such as "13 January".

    Please confirm whether you're currently using Virtual Agent in your Bot Flow, and I'll be happy to share the detailed implementation steps.



    ------------------------------
    Arjun Das T P
    Engineer
    Feebak Suite of products - Genesys Cloud
    https://feebak.com/

    ------------------------------



  • 9.  RE: Validate 8-digit Date of Birth slot length in Genesys Cloud Voice Bot

    Posted 3 hours ago

    Hi Arun,

    Unfortunatley we are not using virtual agent in our bot flow.

    Regards,

    Adnan



    ------------------------------
    Adnan Hassan
    Senior Solution Consultant
    ------------------------------



  • 10.  RE: Validate 8-digit Date of Birth slot length in Genesys Cloud Voice Bot

    Posted 3 hours ago

    Hi @Adnan Hassan

    Then, I think approach suggested by @Francis Guo works for you. Can use regex validation along with stronger prompt.



    ------------------------------
    Arjun Das T P
    Engineer
    Feebak Suite of products - Genesys Cloud
    https://feebak.com/
    [EmailAddress]
    ------------------------------



  • 11.  RE: Validate 8-digit Date of Birth slot length in Genesys Cloud Voice Bot

    Posted 3 hours ago

    Thank you Arjun, and our production is using the method I recommended and never had any problem.

    Thanks,



    ------------------------------
    Francis Guo
    NA
    ------------------------------



  • 12.  RE: Validate 8-digit Date of Birth slot length in Genesys Cloud Voice Bot

    Posted 3 hours ago

    Hi Adnan ,

    When you use the prompt: "Please say or enter your date of birth using a two digit month, two digit day, and four digit year." then when the customer input 13011 and got the 2011-01-30 and will realize only the input by the prompt format can return a correct date value.

    Thanks,



    ------------------------------
    Francis Guo
    NA
    ------------------------------