Name Capture return bug
# 🤝help
f
when capturing someones name. If then i were to send a message saying, thank you for providing your name "@name". It will then return {"first":"tas","last":null} in the front end of the chat. any solutions?
r
Not a bug. That is the way the full name is captured when you use the name capture card. If you just want a first name so your bot can be friendly, just use a raw input. If you need full name, your usage could be something like hello your full name is {{workflow.personName.first + ' ' + workflow.personName.last}} and your first name is {{user.fname}} Alternatively you could have an execute code that does this: user.fname = workflow.personName.first user.lname = workflow.personName.last And then you could just use "Hello @fname!"
f
thanks for the reply, i have no issue with the way it collects the name, the issue is the way it displays the name whenever i want to use it variable. it shows exactly this {"first":"john","last":"doe"}
if i use a raw inout instead, and the user types, hi, my name is John Doe, then the bot will use the full sentance as the users name
r
Right. The Fullname capture is not storing a text value, it is creating a javascript object which can be displayed using either of the techniques I showed above. And right, using a raw text input for name comes with the hazard you mentioned.
e
That's exactly what the Name capture is for. The name in this case will be {"first":"Jhon","last":"Doe"}
Thanks for the detailed info @rich-oxygen-43707!
f
right ok i understand now that it will take the name exactly like this {"first":"Jhon","last":"Doe"}. I am fairly new to botpress and would appreciate if you could explain how i can mention the users first name throught out the conversation. I have tried the above ways without any success. currently i am at, capture person name...
this has been resolved. for anyone wondering... create name capture, add a variable for example @name to return this to the user for example: hello john, nice to meet you text: variable.first, for example @name.first or @name.last
e
glad it worked out! You could also create a user variable in the settings, and assign the user name to it in a Code card
158 Views