
Research
PyPI Package Disguised as Instagram Growth Tool Harvests User Credentials
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
messagebird
Advanced tools
This repository contains the open source Node.js client for MessageBird's REST API. Documentation can be found at: https://developers.messagebird.com
access_key
in the developers sectionnpm install messagebird
We have put some self-explanatory examples in the examples directory, but here is a quick breakdown on how it works.
Let's go ahead and initialize the library first. Don't forget to replace <YOUR_ACCESS_KEY>
with your actual access key.
CommonJS require syntax:
const messagebird = require('messagebird').initClient('<YOUR_ACCESS_KEY>');
Typescript with ES6 import (or .mjs with Node >= v13):
import { initClient } from 'messagebird';
const messagebird = initClient('<YOUR_ACCESS_KEY>');
Nice! Now we can send API requests through node. Let's use getting your balance overview as an example:
// Get your balance
messagebird.balance.read(function (err, data) {
if (err) {
return console.log(err);
}
console.log(data);
});
// Result object:
{
payment: 'prepaid',
type: 'credits',
amount: 42.5
}
Or in case of an error:
{ [Error: api error]
errors: [
{
code: 2,
description: 'Request not allowed (incorrect access_key)',
parameter: 'access_key'
}
]
}
Messaging and Voice API use different pagination semantics:
Messaging API uses limit and offset params for list methods (where applicable)
// list conversations
// In this case 20 is limit and 0 is offset
messagebird.conversations.list(20, 0, function (err, response) {
if (err) {
return console.log(err);
}
console.log(response);
});
Voice API uses page and perPage params for list methods (where applicable)
// list Call Flows
// In this case 1 is page, 2 is items per page
messagebird.callflows.list(1, 2, function (err, response) {
if (err) {
return console.log(err);
}
console.log(response);
});
For each HTTP request that MessageBird sends, a MessageBird-Signature-JWT
header is added.
The MessageBird-Signature-JWT
header is a signature that consists of all the information that is required to verify the integrity of the request. The signature is generated from the request URL and request body and is signed with the HMAC-SHA256 algorithm using your your signing key. You can validate this signature using our SDKsto ensure that the request is valid and unaltered. The token also includes timestamp claims that allow you to prove the time of the request, protecting from replay attacks and the like.
For more details consult the documentation.
Examples:
Let's use Express Signature middleware to verify webhooks.
// This example show how to verify the authenticity of a MessageBird webhook.
const mbWebhookSignatureJwt = require('messagebird/lib/webhook-signature-jwt');
const express = require('express');
const secret = '<YOUR SIGNING KEY>';
const app = express();
// If the node server is behind a proxy, you must trust the proxy to infer the correct protocol and hostname.
app.set('trust proxy', () => true);
// Replace <YOUR_SIGNING_KEY> with your actual signing key.
const verifySignature = new mbWebhookSignatureJwt.ExpressMiddlewareVerify(secret);
// Retrieve the raw body as a buffer.
app.use(express.raw({ 'type': '*/*' }));
// Verified webhook.
app.get('/webhook', verifySignature, (req, res) => {
res.send('verified');
});
app.post('/webhook', verifySignature, (req, res) => {
res.send('verified');
});
Complete documentation, instructions, and examples are available at: https://developers.messagebird.com
The MessageBird REST API for Node.js is licensed under The BSD 2-Clause License. Copyright (c) 2022, MessageBird
FAQs
A node.js wrapper for the MessageBird REST API
The npm package messagebird receives a total of 14,110 weekly downloads. As such, messagebird popularity was classified as popular.
We found that messagebird 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
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
Product
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
Security News
Research
Socket uncovered two npm packages that register hidden HTTP endpoints to delete all files on command.