huydo-channel-messenger
v10.34.2
Published
Official Facebook Messenger connector for botpress
Downloads
14
Maintainers
Readme
Botpress Messenger
Install
npm i @botpress/channel-messenger
Getting started
- Run
npm start
. Since you don't have configuration an error will be displayed to console which is fine. Once it's displayed bot will create default configuration which you'll need to edit after stopping the bot. - You need to create Facebook App
Explaining config keys
"displayGetStarted"
- exclude/include interaction with Get Started. Default: true
"greetingMessage"
- set default messege. Default: "Default greeting message"
"persistentMenu"
- added menu to your messenger. See more
"persistentMenuItems"
- <needs investigation>
"composerInputDisabled"
- <needs investigation>
"targetAudience"
- decied who will can/can't use your chat. Default: "openToAll"
"openToAll"
"openToSome"
- chat is available for people from"targetAudienceOpenToSome"
list"closeToSome"
- chat isn't available for people from"targetAudienceCloseToSome"
list"closeToAll"
- chat unavailable for all
"autoResponseOption"
- used for send automaticaly something (depend on used value) to user when he/she click on Get Started
It has three variant of value "autoResponseText"|"autoResponsePostback"|"noResponse"
"autoResponseText"
- send text to user. Text takes fromautoResponseText
"autoResponsePostback"
-<needs investigation>
"noResponse"
- auto response off
Features
Incoming
Outgoing
- Postbacks
- Referrals
- Display Get Started
- Greeting message
- Persistent menu
- Automatically mark as read
- Composer input disabled
- Trusted domains
- Automatic profile lookup
- Save users in DB
- Webhook security check
Reference
Incoming
You can listen to incoming event easily with Botpress by using bp
built-in hear
function. You only need to listen to specific Messenger event to be able to react to user's actions.
bp.hear({ platform: 'facebook', type: 'postback', text: 'GET_STARTED' }, (event, next) => {
bp.renderers.sendToUser(event.user.id, '#!text-77734', { typingIndicators: false })
}
})
In fact, this module preprocesses almost all types of message (message, attachment, postback, quick_reply, delivery, read, optin, referrals...) and send them to incoming middlewares. When you build a bot or a module, you can access to all information about incoming messages that have been send to middlewares.