https://discord.gg/botpress logo
#🤝help
validate users email
# 🤝help
j

jolly-policeman-82775

02/16/2024, 4:56 PM
im having an error with validating users email via API through a platform
const apiKey = 'mlsn.ad45f71d4919263a97cbbed24d3ad43ea8ed9cc8fed2133943172f9534cd4902' const email = user.Email // Call the email validation API with the user's email and API key const response = await axios.get(
https://api.email-validator.net/api/verify?EmailAddress=${email}&APIKey=${apiKey}
) // Extract the validation result from the response const isValidEmail = _.get(response, 'data.status', '') === 'valid' // Log the validation result console.log(
Is the user's email valid? ${isValidEmail}
)
thats my code
thats the website
f

fresh-fireman-491

02/16/2024, 5:07 PM
Hey
You need to have a return statement
j

jolly-policeman-82775

02/16/2024, 5:08 PM
??
f

fresh-fireman-491

02/16/2024, 5:08 PM
I added it as a file so Discord doesn't remove anything
Also
j

jolly-policeman-82775

02/16/2024, 5:09 PM
f

fresh-fireman-491

02/16/2024, 5:09 PM
I think it will throw an error because of this but I am not sure
const axios = require('axios'); const _ = require('lodash');
You can see the error in the logs
j

jolly-policeman-82775

02/16/2024, 5:09 PM
oh
f

fresh-fireman-491

02/16/2024, 5:09 PM
That just tells you that it threw an error
It doesn't tell us why
j

jolly-policeman-82775

02/16/2024, 5:10 PM
f

fresh-fireman-491

02/16/2024, 5:10 PM
Axios and Lodas are already install and imported
j

jolly-policeman-82775

02/16/2024, 5:10 PM
[Capture] Capture is a raw listen, so we are skipping the cognitive extraction Executing capture card custom validation Error executing validation "inline-vld-c73c6fa2cf.js" [Capture] Field validation failed. Extracted: "theodt.bmm@gmail.com". Input: theodt.bmm@gmail.com [Capture] Extraction failed (0/2 attempts) [Capture] Retrying prompt
what does that mean ?
i dont know code sorry man
f

fresh-fireman-491

02/16/2024, 5:10 PM
If you click on Error executing validation "inline-vld-c73c6fa2cf.js" you can see the error code
No worries 🙂 Just means that they are ready to be used so you don't have to import them
j

jolly-policeman-82775

02/16/2024, 5:11 PM
this ?
f

fresh-fireman-491

02/16/2024, 5:11 PM
No
In the logs
Hit this
Error executing validation "inline-vld-c73c6fa2cf.js
To expand it
And then you can see the errror message
j

jolly-policeman-82775

02/16/2024, 5:11 PM
00:09:51 error vld-c73c6fa2cf action Error executing validation "inline-vld-c73c6fa2cf.js" Error executing validation "inline-vld-c73c6fa2cf.js" [SyntaxError, Identifier 'axios' has already been declared] {"scope":"bot-action","cardId":"vld-c73c6fa2cf","nodeId":"node:Question_KB","workflowId":"flow:Knowledge base"}
f

fresh-fireman-491

02/16/2024, 5:11 PM
Yea
Delete const axios = require('axios'); const _ = require('lodash'); From the code I sent you
j

jolly-policeman-82775

02/16/2024, 5:12 PM
okk
f

fresh-fireman-491

02/16/2024, 5:12 PM
Also
We shouldn't share you API key publicly
j

jolly-policeman-82775

02/16/2024, 5:12 PM
(my trial is gonna end in 10 minutes)
f

fresh-fireman-491

02/16/2024, 5:12 PM
Ah okay
j

jolly-policeman-82775

02/16/2024, 5:12 PM
f

fresh-fireman-491

02/16/2024, 5:12 PM
Deleted my message any ways
j

jolly-policeman-82775

02/16/2024, 5:12 PM
im smart lol
f

fresh-fireman-491

02/16/2024, 5:13 PM
Are you using the code I sent?
j

jolly-policeman-82775

02/16/2024, 5:13 PM
yesss
im saving the users email as a boolean
is that needed ?
f

fresh-fireman-491

02/16/2024, 5:13 PM
You can't really do that if you want to have the email
Save it as a string
Might be why its throwing the error
j

jolly-policeman-82775

02/16/2024, 5:14 PM
WRKS !
WRKS !
WORKS
f

fresh-fireman-491

02/16/2024, 5:14 PM
Amazing!
j

jolly-policeman-82775

02/16/2024, 5:15 PM
idk if this is good or not
wait. nevermind
let me try an invalid emai
nevemrind
it works !
it aint workin
f

fresh-fireman-491

02/16/2024, 5:23 PM
Could you describe the new issue?
j

jolly-policeman-82775

02/16/2024, 5:23 PM
that is a valid emai
email**
but it says its not
well its outlook but still
f

fresh-fireman-491

02/16/2024, 5:25 PM
Is your API still working?
j

jolly-policeman-82775

02/16/2024, 5:25 PM
yes
f

fresh-fireman-491

02/16/2024, 5:25 PM
If the validation could not be completed for any reason it will return false
j

jolly-policeman-82775

02/16/2024, 5:26 PM
let me try again
f

fresh-fireman-491

02/16/2024, 5:26 PM
Have you tried to do this from something like PostMan or Insomnia?
j

jolly-policeman-82775

02/16/2024, 5:26 PM
nope
are they free ?
f

fresh-fireman-491

02/16/2024, 5:26 PM
Yea
I prefer Insomnia but you can use which ever
j

jolly-policeman-82775

02/16/2024, 5:26 PM
ok
thanks !
im getting serious results of sleeping disorder
f

fresh-fireman-491

02/16/2024, 5:35 PM
Wha?
j

jolly-policeman-82775

02/16/2024, 5:35 PM
f

fresh-fireman-491

02/16/2024, 5:39 PM
j

jolly-policeman-82775

02/16/2024, 5:39 PM
thx
this still isnt working lol
f

fresh-fireman-491

02/16/2024, 5:50 PM
Is user.question a number type or string
j

jolly-policeman-82775

02/16/2024, 5:51 PM
user
oh
string
f

fresh-fireman-491

02/16/2024, 5:51 PM
Has to he a number
j

jolly-policeman-82775

02/16/2024, 5:51 PM
ok
do i need to use code for it to wok aswell ?
f

fresh-fireman-491

02/16/2024, 6:02 PM
No
j

jolly-policeman-82775

02/16/2024, 6:03 PM
ok
f

fresh-fireman-491

02/16/2024, 6:03 PM
You set the variable type where you created it
You can also edit it
j

jolly-policeman-82775

02/16/2024, 6:03 PM
i feel new :/
what do you mean ?
it syas questions "0"
do i need to change that aswell ?
pls gimme all info on this ?
mabye a template
ima go sleep
(thansk in advance)
f

fresh-fireman-491

02/16/2024, 6:34 PM
0 as the default value is fine
Not sure what all of this is for so its gonna be a bit hard for me to create a template.
But sleep well
j

jolly-policeman-82775

02/17/2024, 3:39 AM
i just want the useer to ask a question twice then he goes to a node where i ask for his name and email to continue asking questions.
good morning
f

fresh-fireman-491

02/17/2024, 6:21 AM
j

jolly-policeman-82775

02/17/2024, 6:23 AM
yes
it workes thank you !!!
3 Views