helpful-purple•2y 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
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-purpleOP•2y 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
You can use javascript to verify / capture the email.
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:
helpful-purpleOP•2y 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•2y ago
@Ernest use a SET AI step to extract the email from the message
something like
then choose the variable where you want to store it
screenshot your js code
in the Javascript step.
helpful-purpleOP•2y ago
Hi i tried different codes and it doesn't work for me, i must be doing something wrong.

helpful-purpleOP•2y 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-purpleOP•2y ago
I also used this code

helpful-purpleOP•2y ago

helpful-purpleOP•2y ago
I did that and it worked.

Yep. email was already defined within your VF assistant. You can't re-declare it in your JS code.
helpful-purpleOP•2y ago
thanks for your help