Giter Club home page Giter Club logo

textmagic-rest-nodejs's Introduction

TextMagic JavaScript SDK

This library provides you with an easy way of sending SMS and receiving replies by integrating TextMagic SMS Gateway into your JavaScript application.

What Is TextMagic?

TextMagic’s application programming interface (API) provides the communication link between your application and TextMagic’s SMS Gateway, allowing you to send and receive text messages and to check the delivery status of text messages you’ve already sent.

Installation

npm install [email protected] --save

Usage Example

Please follow the installation instructions and execute the following JS code:

const textmagicClient = require('textmagic-client');

const fs = require('fs');
const client = textmagicClient.ApiClient.instance;
const auth = client.authentications['BasicAuth'];

auth.username = 'YOUR_USERNAME';
auth.password = 'YOUR_PASSWORD';

const api = new textmagicClient.TextMagicApi();

// Simple ping request example
api.ping().then(function (data) {
    console.log(data.ping);
}).catch(function(err){
    console.error(err);
});

// Send a new message request example
api.sendMessage({
    'text': 'I love TextMagic!',
    'phones': '+12341234123'
}).then(function (data) {
    console.log(data.id);
}).catch(function(err){
    console.error(err);
});

// Get all outgoing messages request example
api.getAllOutboundMessages({
    'page': 1,
    'limit': 200
}).then(function (data) {
    console.log(data.resources[0].text);
}).catch(function(err){
    console.error(err);
});

// Upload new avatar for contacts list (group) with Id 3223 example
let stream = new fs.ReadStream('test.jpg');
api.uploadListAvatar(stream, 3223).then(function (data) {
    console.log(data.id);
}).catch(function(err){
    console.error(err);
});

License

The library is available as open source under the terms of the MIT License.

textmagic-rest-nodejs's People

Contributors

imissyouso avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.