validate users email
# 🤝help
j
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
Hey
You need to have a return statement
j
??
f
I added it as a file so Discord doesn't remove anything
Also
j
f
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
oh
f
That just tells you that it threw an error
It doesn't tell us why
j
f
Axios and Lodas are already install and imported
j
[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
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
this ?
f
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
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
Yea
Delete const axios = require('axios'); const _ = require('lodash'); From the code I sent you
j
okk
f
Also
We shouldn't share you API key publicly
j
(my trial is gonna end in 10 minutes)
f
Ah okay
j
f
Deleted my message any ways
j
im smart lol
f
Are you using the code I sent?
j
yesss
im saving the users email as a boolean
is that needed ?
f
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
WRKS !
WRKS !
WORKS
f
Amazing!
j
idk if this is good or not
wait. nevermind
let me try an invalid emai
nevemrind
it works !
it aint workin
f
Could you describe the new issue?
j
that is a valid emai
email**
but it says its not
well its outlook but still
f
Is your API still working?
j
yes
f
If the validation could not be completed for any reason it will return false
j
let me try again
f
Have you tried to do this from something like PostMan or Insomnia?
j
nope
are they free ?
f
Yea
I prefer Insomnia but you can use which ever
j
ok
thanks !
im getting serious results of sleeping disorder
f
Wha?
j
f
j
thx
this still isnt working lol
f
Is user.question a number type or string
j
user
oh
string
f
Has to he a number
j
ok
do i need to use code for it to wok aswell ?
f
No
j
ok
f
You set the variable type where you created it
You can also edit it
j
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
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
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
j
yes
it workes thank you !!!
3 Views