Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@botpress/channel-messenger
Advanced tools
Official Facebook Messenger connector for botpress
npm i @botpress/channel-messenger
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.1)
2) Click on Messenger `Set Up` 3. Get all required fields from `config/channel-messenger.json` [config template](https://github.com/botpress/botpress/blob/master/packages/channels/botpress-channel-messenger/config.json)1)
2) 3) 4)In you facebook-app configuration at https://developers.facebook.com/ set webhook (an url should be something like https://[bot-hostname]/api/botpress-messenger/webhook
) and chose next option.. (webhook template https://[bot-hostname]/api/botpress-messenger/webhook
)
You need to send review request to FB. Do following:
App Review
-> Submit Items for Approval
-> Start a Submission
-> pick up: publish_pages
and manage_pages
-> Resolve all Additional Information Required
Messenger
-> Settings
-> Go to section App Review for Messenger
-> Select all fields -> Resolve all Additional Information Required
Settings
-> Basic
-> Need resolve all Currently Ineligible for Submission
"displayGetStarted"
- exclude/include interaction with Get Started. Default: true
"greetingMessage"
- set default messege. Default: "Default greeting message"
"enableAllProfileFields"
- If you need to know user timezone, gender, locale set true
and send you app to review.
"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
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.
bp.middlewares.sendIncoming({
platform: 'facebook',
type: 'message',
user: profile,
text: e.message.text,
raw: e
})
You can acces to all user's profile information by using this module. A cache have been implemented to fetch all information about users and this information is sent to middlewares.
{
id: profile.id,
platform: 'facebook',
gender: profile.gender,
timezone: profile.timezone,
locale: profile.locale,
picture_url: profile.profile_pic,
first_name: profile.first_name,
last_name: profile.last_name
}
Note: All new users are automatically saved by this module in Botpress built-in database (bp.db
).
An event
is sent to middlewares for each incoming text message from Messenger platform with all specific information.
{
platform: 'facebook',
type: 'message',
user: profile,
text: e.message.text,
raw: e
}
Then, you can listen easily to this event
in your module or bot
bp.hear('hello')
{
platform: 'facebook',
type: 'postback',
user: profile,
text: e.postback.payload,
raw: e
}
The original attachments messenger event. May contain multiple attachments. Individual attachments are also emmited individually (see Image, Video, File below)
{
platform: 'facebook',
type: 'attachments',
user: profile,
text: e.message.attachments.length + ' attachments',
raw: e
}
Individual Attachment extracted from the Attachments event.
Note that Stickers, Thumbs Up, GIFs and Pictures are considered images too.
{
platform: 'facebook',
type: 'image', // Same for 'video', 'file' and 'audio'
user: profile,
text: 'http://www.image.url',
raw: { type: 'image', payload: { url: '...' }}
}
Same signature as Image
above.
{
platform: 'facebook',
type: 'referral',
user: profile,
text: e.referral.ref,
raw: e
}
{
platform: 'facebook',
type: 'quick_reply',
user: profile,
text: e.message.quick_reply.payload,
raw: e
}
{
platform: 'facebook',
type: 'optin',
user: profile,
text: e.optin.ref,
raw: e
}
{
platform: 'facebook',
type: 'delivery',
user: profile,
text: e.delivery.watermark,
raw: e
}
{
platform: 'facebook',
type: 'read',
user: profile,
text: e.read.watermark,
raw: e
}
By using our module, you can send anything you want to your users on Messenger. In fact, this module support all types of messages that are available on Facebook (text, images, videos, audios, webviews...).
bp.renderers.sendToUser(userId, elementOrRenderer, data)
-> PromiseuserId
(String): Correspond to unique Messenger's recipient identifierelementOrRenderer
(String): The name of the renderer to use OR an element iddata
(Object): Additionnal data that will be passed to the renderer bp.renderers.sendToUser(event.user.id, '#!text-77734', { typingIndicators: false })
This module support postbacks. Postbacks occur when a Postback button, Get Started button, Persistent menu or Structured Message is tapped (facebook doc).
This module also support referrals. In fact, the value of the ref
parameter is passed by the server via webhook and we are able to access these referrals in parameters of input messages (facebook doc).
To active get started button on Messenger, users can modify display setting directly in user interface (facebook doc).
Directly in module view, users are able to modify greeting message (facebook doc).
Users can directly modify persistent menu in module user interface. By using UI, it's possible to add, modify and remove items (facebook doc).
Directly in UI, users can setup if they want to automatically mark all messages as read (facebook doc).
Directly in UI, users can setup if they want to deactivate or not the user input (facebook doc).
By using UI, users can configure (add, modify and remove) trusted domains (facebook doc).
Using the UI, you can set the home URL for your chat extension (facebook doc).
Note: the URL you specify must use HTTPS. Facebook will return an error if you enter an URL that is not using HTTPS.
Chat extensions supports the following configuration options:
Using the UI, you can assign users to be "Payment Testers."
In order for this to work, the user must be a registered admin, developer or test user through your Facebook developer console and they must have initiated conversation with your bot. You cannot just add any user to be a payment tester. It is also important to note that this is the only way to run a test payment with Messenger Extensions.
When adding a new user, you can start typing their name into the box. This will pull up a list of matching users who have been communicating with your bot. The value in the parentheses is the page-scoped user ID for that user.
Profiles are automatically lookedup using Facebook Graph API. The profile of the user can be found in the incoming middleware events: event.user
The following properties are available: first_name, last_name, locale, gender, timezone.
Users are automatically persisted in the built-in botpress database using the built-in bp.db.saveUser
function.
botpress-messenger verifies that requests really come from Facebook's servers by validating requests hash.
There's a Slack community where you are welcome to join us, ask any question and even help others.
Get an invite and join us now! 👉 https://slack.botpress.io
botpress-messenger is licensed under AGPL-3.0
FAQs
Official Facebook Messenger connector for botpress
The npm package @botpress/channel-messenger receives a total of 0 weekly downloads. As such, @botpress/channel-messenger popularity was classified as not popular.
We found that @botpress/channel-messenger demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.