Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
fabychyA ruby client for Facebook Messenger's bot API provided by Robochy. |
Add the gem to your application's Gemfile
gem 'fabychy'
and run the following
$ bundle install
Create a bot using Facebook Messenger developer portal. Once the registration is complete, copy the Page Access Token
to be used by this library.
With your Page Access Token
you can use fabychy
like the following:
require 'fabychy'
bot = Fabychy::Bot.new('[PAGE ACCESS TOKEN]')
You need to have the USER_ID
for the target user and then call the get_user
function:
require 'fabychy'
bot = Fabychy::Bot.new('[PAGE ACCESS TOKEN]')
bot.get_user('[USER_ID]')
With a created bot you can create messages of different types, attach custom keyboards, and pass them to the send_message
function as follows:
require 'fabychy'
bot = Fabychy::Bot.new('[PAGE ACCESS TOKEN]')
message = Fabychy::Message.new(
recipient: {id: [USER_ID] },
message: {
text: "hi there"
},
notification_type: Fabychy::Notification::REGULAR
)
The following notification types can be used:
Fabychy::Notification::REGULAR
Fabychy::Notification::SILENT_PUSH
Fabychy::Notification::NO_PUSH
Fabychy provides some light-weight validation of the generated message. However, when there is too much scaffolding it also allows you to pass the hash object instead of an actual element to create your messages. Below is an example:
require 'fabychy/message'
bot = Fabychy::Bot.new('[PAGE ACCESS TOKEN]')
message = Fabychy::Message.new(
recipient: {id: "1056613714384965"},
message: Fabychy::DataTypes::MessageBody.new(
attachment: Fabychy::DataTypes::TemplateAttachment.new(
payload: Fabychy::DataTypes::GenericTemplatePayload.new(
elements: [
Fabychy::DataTypes::GenericElement.new(
title: 123,
image_url: "http://wip.org/media/nima-456.jpg",
subtitle: "This thing is great!",
buttons: [
Fabychy::DataTypes::Button.new(
type: "web_url",
title: "robochy",
url: "http://robochy.com"
)
]
),
Fabychy::DataTypes::GenericElement.new(
title: "hello",
image_url: "http://wip.org/media/nima-456.jpg",
subtitle: "This thing a second thing great!",
)
]
)
)
)
)
bot.send_message(message)
Fabychy::DataTypes::TemplateAttachment
# OR
Fabychy::DataTypes::ImageAttachment
# use the following for Fabychy::DataTypes::ImageAttachment
Fabychy::DataTypes::ImagePayload
# use the following for Fabychy::DataTypes::TemplateAttachment
Fabychy::DataTypes::GenericTemplatePayload
Fabychy::DataTypes::ButtonTemplatePayload
Fabychy::DataTypes::ReceiptTemplatePayload
# for Fabychy::DataTypes::GenericTemplatePayload
Fabychy::DataTypes::GenericElement
# for Fabychy::DataTypes::ReceiptTemplatePayload
Fabychy::DataTypes::ReceiptElement
In your callback servlet, pass the received request
(not the request body) to the Fabychy::ApiResponse.parse
function and you will get the hash response back:
class Simple < WEBrick::HTTPServlet::AbstractServlet
def do_POST(request, response)
response = Fabychy::ApiResponse.parse(request) # response is of type Hash
end
end
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that fabychy demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.