Facebook Messenger Platform
Node Facebook Messanger Platform adapter built with promises.
Write your best chat bot using best async techology!
Installation
npm install -S node-messenger-platform
Usage
There are two types of usage this node module:
const FBPlatform = // stateless usage FBPlatform FBPlatform // or statefull usage const Bot = FBPlatform Bot
API Reference
- FBPlatform
- .Bot
- new Bot(token) ⇒
Object
- new Bot(token) ⇒
- .send(token, recipient, message, [notificationType]) ⇒
Promise
- .sendImage(token, recipient, url, [notificationType]) ⇒
Promise
- .Bot
Bot
Statefull class for fb messanger platform usage. Stores token in object.
new Bot(token)
Creates an instance of FBPlatform bot using token.
.send(token, recipient, message, [notificationType])
Sending message using token to recipient.
Returns: Promise
See: https://developers.facebook.com/docs/messenger-platform/send-api-reference#request
Param | Type | Description |
---|---|---|
token | String |
Facebook Messanger Platform token. |
recipient | Object |
Recipient object with id or phone_number fields |
message | Object |
Any message object from documentation. message is required property |
[notificationType] | String |
Notification type. Default REGULAR |
.sendImage(token, recipient, url, [notificationType])
Sending images using token to recipient.
Returns: Promise
See: https://developers.facebook.com/docs/messenger-platform/send-api-reference#request
Param | Type | Description |
---|---|---|
token | String |
Facebook Messanger Platform token. |
recipient | Object |
Recipient object with id or phone_number fields |
url | String |
Image url that you want to send. |
[notificationType] | String |
Notification type. Default REGULAR |