Skip to content

evilai/nbp-adapter-fb-messenger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Facebook Messenger adapter

This is Facebook Messenger adapter for Node.js Bot Platform.

import fbMessengerAdapterFactory from 'nbp-adapter-fb-messenger';
const fbMessengerAdapter = fbMessengerAdapterFactory({
    accessToken: 'your-fb-application-access-token',
    logger // your logging tool instance
});

Then you should pass the recipientId, which you can get from facebook message body.

const messenger = fbMessengerAdapter(recipientId);

messenger.send('Text for the user'); // Send text to the user
messenger.typing(); // Show typing action for the user 
messenger.seen(); // Mark as seen previous user's messages

Please, look at usage example. I use a wrapper around messenger, that accept rules and don't send anything if there is a rule silent.

Tunneling

Check tunneling.js. To bind context of all client's function we need to perform tunneling on each request, so inside skills you can do im.send('Some text) without specifying user IDs and application tokens.

Look at router-builder.js as an example.

About

Facebook Messenger adapter for Node.js Bot Platform

Resources

Stars

Watchers

Forks

Packages

No packages published