Have the receiving page's access_token handy
npm:
npm install messenger-page-access-token
yarn:
yarn add messenger-page-access-token
const messenger = require('messenger-core')
const loadPlugins = require('plugin-powered')
const pluginOptions = {
prefix: 'messenger-'
}
loadPlugins(messenger, {
'page-access-token': '<<YOUR_PAGE_ACCESS_TOKEN>>'
}, pluginOptions)
// if your bot handles multiple pages
loadPlugins(messenger, {
'messenger-page-access-token': {
'<<PAGE_ID>>' : '<<YOUR_PAGE_ACCESS_TOKEN>>',
'<<ANOTHER_PAGE_ID>>' : '<<ANOTHER_PAGE_ACCESS_TOKEN>>'
// etc.
}, pluginOptions
})
// if you have your page access token store in an environment variable
loadPlugins(messenger, {
'page-access-token': 'MY_ENVIRONMENT_VARIABLE'
}, pluginOptions)
// use the `MESSENGER_PAGE_ACCESS_TOKEN` environment variable
loadPlugins(messenger, {
'page-access-token': true
}, pluginOptions)
Name | Website |
---|---|
Andreas Pizsa | https://github.com/AndreasPizsa |