https://github.com/gnuwilliam/fb-msg-bot
Simple Facebook Messenger Bot built with Node.js
https://github.com/gnuwilliam/fb-msg-bot
bot facebook-messenger-bot javascript nodejs
Last synced: about 1 month ago
JSON representation
Simple Facebook Messenger Bot built with Node.js
- Host: GitHub
- URL: https://github.com/gnuwilliam/fb-msg-bot
- Owner: gnuwilliam
- License: mit
- Created: 2017-01-21T02:36:03.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-01-21T04:37:32.000Z (over 9 years ago)
- Last Synced: 2025-01-11T17:23:16.978Z (over 1 year ago)
- Topics: bot, facebook-messenger-bot, javascript, nodejs
- Language: JavaScript
- Size: 7.81 KB
- Stars: 2
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Facebook Messenger Bot
Simple bootstrap to allow integration between Node.js and Facebook Messenger's API
## Usage
Simply define your VERIFY_TOKEN and PROFILE_TOKEN keys in `conf.js` and run with `npm install; npm start`
Send your page a message and the bot should respond "Hey! Welcome!"
Messenger Platform documentation: https://developers.facebook.com/docs/messenger-platform
## Message methods
`sendMessage`: Allow you to manually send a message to the end user. Expect `receiver` (string) and `msg` (string) as params.
### Example
```js
var messages = require('./lib/messages');
messages.sendMessage(sender, 'Hey! Welcome!');
```
---
`quickReply`: Send a custom message to the user with buttons containing possible replies. Expect `receiver` (string), `msg` (string) and `options` (array) as params.
### Example
```js
var messages = require('./lib/messages'),
options = [
{
content_type: "text",
title: "Red",
payload: "You chose Red!"
},
{
content_type: "text",
title: "Blue",
payload: "You chose Blue!"
}
];
messages.quickReply(sender, 'Favorite color?', options);
```
---
`isTyping`: Send 'chat bubbles' to the end user, simulating typing. Expect `receiver` as param
### Example
```js
var messages = require('./lib/messages'),
messages.isTyping(sender);
```
## Improvements
- refactor API requests repetition