https://discord.gg/botpress logo
Phone Number and Address Capture Problem
# 🤝help
f
Hello everyone. I'm trying to capture a phone number and address which are to be entered by the user. I tried using the phone number and address information capture cards as well a single choice card (type:string) for the address and (type:number) for the phone number. However the bot keeps asking for the number after it's entered and the same happen for the address. Your help is greatly appreciated.
w
can you send a screenshot of how you have your capture configured?
f
Sure
m
I can help resolve the issue where Botpress keeps asking for the phone number and address. The problem usually comes from mismatched input types or missing validation rules. I’ll implement proper input capture cards with format validation and fallback handling. This ensures the bot accepts the user’s entries on the first attempt. Quick question: Are you capturing these inside a Flow or using Q&A events? @flaky-ability-56989
f
I'm capturing inside a workflow
w
can you send a screenshot of an example chat of it not working?
w
And a screenshot of your workflow
f
ok
w
Why doesn't it work? - Is the phone number card going into a loop? - Does the flow stop on the phone number request? - Does the flow proceed, but the variable is empty?
w
.
f
The phone number card is going into a loop.
w
Of course 4444444 is not a phone number
You should ready text and validate the number with Execute card or using card validation option
w
i don't think that's the issue
since it says "captured variable"
that means it recognizes 4444444 as a phone number
right after it executes a code card as well
@flaky-ability-56989 try connecting your final text card to an end or exit node
f
I tried with a valid phone number as well. However this card is just a number card so what would deem the number to be invalid? I tried using a raw capture card and that works, so I would use an Execute card or validation as you suggested. Thanks
Ok. Will do. If it works then I'll have another option. Thanks
It didn't work
Could this be a bug?
I'm trying not to use to many code cards so native botpress cards are preferred
w
maybe
you should ask a clearer question as well
"Number?" isn't a very clear question
could be answered with yes/no for example
try changing it to "What is your phone number?" and testing with a well-formated example phone number
b
I had the same problem, the validation was failing because I assumed that input was an object with a .number property, but in reality Botpress was sending a string. so I was always validating an empty string (""), which resulted in 0 digits. ´´´ function validate(input: any): boolean { let raw: string; if (typeof input === "string") { raw = input; } else { raw = input.rawInput || input.number || ""; } const digits = raw.replace(/\D/g, ""); return digits.length >= 10; } ´´´