Unofficial module for the MessageBird API.
Unofficial node.js module for the MessageBird API.
The best way is to install the npm package.
npm install messagebird
Alternatively you can install directly from the source code on Github, but this can be unstable!
npm install git+
username required Your API username.password required Your API password.timeout option Abort request after this amount of milliseconds.(default 5000)
var messagebird = require'messagebird'messagebirdusername = 'myname'messagebirdpassword = 'mysecret'messagebirdcreditsif ! errconsole.log '€ '+ dataeuro +' and '+ datacredits +' credits left'elseconsole.log 'An error occured:'console.log err
npm should fix the dependencies for you.
- node-xml2json v1.0 - This is a small and fast library for XML to JSON translation.
Each method below takes a callback function as last parameter to receive the result status and data. This function receives two parameters:
data. When an error occurs
err will be an instance of
Error with stack trace and possibly additional properties,
data won't be set. When everything is good
err is null and
data is the result.
if errconsole.log errconsole.log errstackelseconsole.log datamessagebirdcredits myCallback
request failed There was an error, see err.errorrequest timeout The request took too long to process, see Configurationrequest closed The request ended too early, no data processedapi error The API returned an error, see err.resultcode and err.resultmessageapi invalid The API returned something unreadableapi http error The API returned an HTTP error, see err.statusCode and err.body
Send sms to one or multiple phone numbers.
sender required Your name or numberdestination required Receiver(s), comma-separated string or arraybody required The messagevars option Object with more settings, see below.callback required See Callback
messagebirdsms 'MyName' 316123456789316098765432 'Hello world' myCallback
Object with additional settings for this SMS.
var vars =timestamp: '201401201803'reference: 'message1'gateway_id: 2messagebirdsms 'MyName' '123' 'Hello' vars myCallback
Lookup network information for one or more phone numbers.
recipients required Numbers to lookup, comma-seperated string or array.reference option String to be included http call from the API.callback required See Callback.
messagebirdhlr '316987654321' 'user2' myCallback
Get remaining credits in your account.
euros: 0 credits: 57.8
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.
In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to http://unlicense.org