https://github.com/marcl/chatfuel-bot-api
API to be called from Chatfuel to help with chatbot tasks
https://github.com/marcl/chatfuel-bot-api
Last synced: 10 months ago
JSON representation
API to be called from Chatfuel to help with chatbot tasks
- Host: GitHub
- URL: https://github.com/marcl/chatfuel-bot-api
- Owner: MarcL
- License: mit
- Created: 2021-03-20T20:02:45.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-03-22T19:36:53.000Z (almost 5 years ago)
- Last Synced: 2025-01-26T17:24:37.298Z (12 months ago)
- Language: JavaScript
- Homepage: chatfuel-bot-api.vercel.app
- Size: 133 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# chatfuel-bot-api
API to be called from Chatfuel to help with chatbot tasks
## Deploy using Vercel
Click on the button below to deploy the API using [Vercel](https://vercel.com).
[](https://vercel.com/new/git/external?repository-url=https%3A%2F%2Fgithub.com%2FMarcL%2Fchatfuel-bot-api)
## Usage
### GET /api/verify/email
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
```
#### Valid email response
If the email is valid you'll receive the following response.
```json
{
"set_attributes": {
"emailValid": true
}
}
```
This will set a Chatfuel use attribute called `emailValid` and set it to be `true`.
#### Invalid email response: no email
If the email is invalid because no `email` query parameter was provided, you'll receive this response.
```json
{
"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`.
#### Invalid email response: invalid domain
If the email is invalid because the email domain does not exist, you'll receive the following response.
```json
{
"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`.
#### Invalid email response: valid domain but no MX record
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.
```json
{
"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`.