helpful-purple
helpful-purple2y ago

#capture

Good day I have this problem, in other languages, there are no entities, how can I create using the code? to capture emails
15 Replies
Tico | Voiceflow Assistant
To capture emails in other languages using code, you can utilize the Capture step in Voiceflow. The Capture step allows you to record a user's entire utterance and store it within a selected variable. This can be used to collect specific pieces of information from your user, such as their email address. Here's a step-by-step guide on how to do it: 1. Add a Capture step to your assistant. 2. Select 'Entire User Reply' to capture the whole user response. 3. Choose the variable you want to use to store the user's reply response. You can select from your existing variables or create a new one. Please note that if the user response does not match the capture step's expected entity type (such as the user typing a word instead of an expected email), the capture step can be configured to ask for the value again using a reprompt. For more advanced entity capturing, you can create custom entities that capture the essential information relevant to your application's domain. For example, if you are looking for email addresses, you can create a custom entity and add examples of email addresses. Remember, entities that you create can be utilized in your designs and are available globally within the assistant. For more information, you can refer to the Voiceflow documentation here and here.
helpful-purple
helpful-purpleOP2y ago
it doesn't work. javascript code @voiceflow in other languages does not capture email, datatype is empty @voiceflow in other languages does not capture email, datatype is empty @voiceflow in other languages does not capture email, datatype is empty
W. Williams (SFT)
You can use javascript to verify / capture the email.
NiKo | Voiceflow
Tico will most likely not be useful if you don't provide a proper question with some context/detail, even if you send the same question multiple time 😉 Next time try to give as much information as possible, for example: Using the Javascript step, how can I extract an email from a string? Tico will answer:
No description
NiKo | Voiceflow
let str = "Hello, my email is example@example.com";
let email = str.match(/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b/);
let str = "Hello, my email is example@example.com";
let email = str.match(/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b/);
helpful-purple
helpful-purpleOP2y ago
thank you thank you I pasted this code into the javascript but nothing works, it saves the whole text. if there is a video instruction somewhere I would be grateful
fair-rose
fair-rose2y ago
@Ernest use a SET AI step to extract the email from the message something like
Based on the user's last utterance, output only the e-mail in their message and nothing else.
Based on the user's last utterance, output only the e-mail in their message and nothing else.
then choose the variable where you want to store it
W. Williams (SFT)
screenshot your js code in the Javascript step.
helpful-purple
helpful-purpleOP2y ago
Hi i tried different codes and it doesn't work for me, i must be doing something wrong.
No description
helpful-purple
helpful-purpleOP2y ago
const text = "Hi! My email is example@email.com. Other email: another@example.com."; const emailRegex = /[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,}/g; const extractedEmails = text.match(emailRegex); console.log(extractedEmails); // Output an array of found email addresses I also used this code and still email is not selected from the text.
helpful-purple
helpful-purpleOP2y ago
I also used this code
No description
helpful-purple
helpful-purpleOP2y ago
No description
helpful-purple
helpful-purpleOP2y ago
I did that and it worked.
No description
W. Williams (SFT)
Yep. email was already defined within your VF assistant. You can't re-declare it in your JS code.
helpful-purple
helpful-purpleOP2y ago
thanks for your help

Did you find this page helpful?