API to be called from Chatfuel to help with chatbot tasks
Click on the button below to deploy the API using Vercel.
Make a GET request to the /api/verify/email
endpoint using the Chatfuel JSON API block. Pass email
as a query parameter to verify if the email address is valid.
For example, if deployed to your Vercel domain https://your-project.vercel.app
then make a GET request like this:
https://your-project.vercel.app/api/verify/email?email=test@testing.com
If the email is valid you'll receive the following response.
{
"set_attributes": {
"emailValid": true
}
}
This will set a Chatfuel use attribute called emailValid
and set it to be true
.
If the email is invalid because no email
query parameter was provided, you'll receive this response.
{
"set_attributes": {
"emailValid": false,
"error": "No email provided"
}
}
This will set a Chatfuel use attribute called emailValid
and set it to be false
and will also set an error
user attribute with the error message No email provided
.
If the email is invalid because the email domain does not exist, you'll receive the following response.
{
"set_attributes": {
"emailValid": false,
"error": "Email doesn't have a valid domain: apaihfs.com"
}
}
This will set a Chatfuel use attribute called emailValid
and set it to be false
and will also set an error
user attribute with the error message Email doesn't have a valid domain: invalid-domain.com
.
If the email is valid, but no MX record exists, you cannot send email to the email address. For this you'll receive the following response.
{
"set_attributes": {
"emailValid": false,
"error": "Email domain is valid but has no MX record so no email can be delivered: gmail.co.uk"
}
}
This will set a Chatfuel use attribute called emailValid
and set it to be false
and will also set an error
user attribute with the error message Email domain is valid but has no MX record so no email can be delivered: valid-domain-no-mx-record.com
.