Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

messagebird

Package Overview
Dependencies
Maintainers
3
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

messagebird - npm Package Compare versions

Comparing version 2.0.1 to 2.1.0

examples/lookup_hlr_create.js

2

examples/balance.js
var messagebird = require('messagebird')('<YOUR_ACCESS_KEY');
var messagebird = require('messagebird')('<YOUR_ACCESS_KEY>');

@@ -4,0 +4,0 @@ messagebird.balance.read(function (err, response) {

var messagebird = require('messagebird')('<YOUR_ACCESS_KEY');
var messagebird = require('messagebird')('<YOUR_ACCESS_KEY>');

@@ -4,0 +4,0 @@ messagebird.hlr.create('31612345678', 'MessageBird', function (err, response) {

var messagebird = require('messagebird')('<YOUR_ACCESS_KEY');
var messagebird = require('messagebird')('<YOUR_ACCESS_KEY>');

@@ -4,0 +4,0 @@ messagebird.hlr.read('<HLR_ID>', function (err, response) {

var messagebird = require('messagebird')('<YOUR_ACCESS_KEY');
var messagebird = require('messagebird')('<YOUR_ACCESS_KEY>');

@@ -4,0 +4,0 @@ var params = {

var messagebird = require('messagebird')('<YOUR_ACCESS_KEY');
var messagebird = require('messagebird')('<YOUR_ACCESS_KEY>');

@@ -4,0 +4,0 @@ messagebird.messages.read('<MESSAGE_ID>', function (err, response) {

var messagebird = require('messagebird')('<YOUR_ACCESS_KEY');
var messagebird = require('messagebird')('<YOUR_ACCESS_KEY>');

@@ -4,0 +4,0 @@ messagebird.verify.create('31612345678', function (err, response) {

var messagebird = require('messagebird')('<YOUR_ACCESS_KEY');
var messagebird = require('messagebird')('<YOUR_ACCESS_KEY>');

@@ -4,0 +4,0 @@ messagebird.verify.delete('<VERIFY_ID>', function (err, response) {

var messagebird = require('messagebird')('<YOUR_ACCESS_KEY');
var messagebird = require('messagebird')('<YOUR_ACCESS_KEY>');

@@ -4,0 +4,0 @@ messagebird.verify.read('<VERIFY_ID>', function (err, response) {

var messagebird = require('messagebird')('<YOUR_ACCESS_KEY');
var messagebird = require('messagebird')('<YOUR_ACCESS_KEY>');

@@ -4,0 +4,0 @@ messagebird.verify.verify('<VERIFY_ID>', '<TOKEN>', function (err, response) {

var messagebird = require('messagebird')('<YOUR_ACCESS_KEY');
var messagebird = require('messagebird')('<YOUR_ACCESS_KEY>');

@@ -4,0 +4,0 @@ var params = {

var messagebird = require('messagebird')('<YOUR_ACCESS_KEY');
var messagebird = require('messagebird')('<YOUR_ACCESS_KEY>');

@@ -4,0 +4,0 @@ messagebird.voice_messages.read('<VOICE_MESSAGE_ID>', function (err, data) {

@@ -326,4 +326,72 @@ /**

}
},
lookup: {
/**
* Do a phonenumber lookup
*
* @param {String} phoneNumber
* @param {String} countryCode
* @param {Function} callback
* @return void
*/
read: function (phoneNumber, countryCode, callback) {
var params = {};
if (typeof countryCode === 'function') {
callback = countryCode;
countryCode = null;
}
if (countryCode) {
params.countryCode = countryCode;
}
httpRequest('GET', '/lookup/' + phoneNumber, params, callback);
},
hlr: {
/**
* View an HLR lookup
*
* @param {String} phoneNumber
* @param {String} countryCode
* @param {Function} callback
* @return void
*/
read: function (phoneNumber, countryCode, callback) {
var params = {};
if (typeof countryCode === 'function') {
callback = countryCode;
countryCode = null;
}
if (countryCode) {
params.countryCode = countryCode;
}
httpRequest('GET', '/lookup/' + phoneNumber + '/hlr', params, callback);
},
/**
* Request an HLR lookup
*
* @param {String} phoneNumber
* @param {Object} params
* @param {Function} callback
* @return void
*/
create: function (phoneNumber, params, callback) {
if (typeof params === 'function') {
callback = params;
params = null;
}
httpRequest('POST', '/lookup/' + phoneNumber + '/hlr', params, callback);
}
}
}
};
};

@@ -10,3 +10,3 @@ var fs = require('fs');

var timeout = process.env.MB_TIMEOUT || 5000;
var number = parseInt(process.env.MB_NUMBER, 10) || 31610948431;
var number = parseInt(process.env.MB_NUMBER, 10) || 31612345678;

@@ -42,2 +42,6 @@ var testStart = Date.now();

recipient: number
},
lookup: {
phoneNumber: number
}

@@ -324,3 +328,47 @@ };

queue.push(function () {
messagebird.lookup.read(cache.lookup.phoneNumber, function (err, data) {
doTest(err, 'lookup.read', [
['type', data instanceof Object],
['.countryCode', data.countryCode === 'NL'],
['.type', data.type === 'mobile'],
['.formats', data.formats instanceof Object]
]);
});
});
queue.push(function () {
messagebird.lookup.hlr.create(cache.lookup.phoneNumber, function (err, data) {
cache.lookup.id = data && data.id || null;
doTest(err, 'lookup.hlr.create', [
['type', data instanceof Object],
['.status', data.status === 'sent'],
['.network', data.network === null],
['.details', data.details === null]
]);
});
});
queue.push(function () {
setTimeout(function () {
messagebird.lookup.hlr.read(cache.lookup.phoneNumber, function (err, data) {
if (accessType === 'TEST' && err) {
doTest(null, 'hlr.read', [
['type', err instanceof Error],
['.message', err.message === 'api error'],
['.errors', err.errors instanceof Array]
]);
} else {
doTest(err, 'hlr.read', [
['type', data instanceof Object],
['.id', data.id === cache.lookup.id],
['.status', data.status === 'absent'],
['.network', data.network === 20408],
['.details', data.details instanceof Object && data.details.country_iso === 'NLD']
]);
}
});
}, 500);
});
// Start the tests

@@ -327,0 +375,0 @@ if (accessKey) {

{
"name": "messagebird",
"version": "2.0.1",
"version": "2.1.0",
"description": "A node.js wrapper for the MessageBird REST API",

@@ -5,0 +5,0 @@ "main": "lib/messagebird.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc