Giter Site home page Giter Site logo

kr4ckhe4d / ideamart.js Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 1.0 56 KB

A lightweight Node.js wrapper for IdeaMart SMS API with exact functions that are available with the current PHP wrapper.

Home Page: https://www.npmjs.com/package/ideamart-sms-sdk

License: ISC License

JavaScript 100.00%
ideamart ideamartsms ideamartapi ideamartnodeapi node nodejs npm ideapro

ideamart.js's Introduction

ideamart-sdk

A lightweight unified Node.js wrapper for IdeaMart IdeaPro APIs.

alt text

Installation

In your command-line on Windows:

    c:\> npm i ideamart-sdk --save

In your terminal on Mac OS X/Linux:

    $npm i ideamart-sdk --save

How to use

In Node.js:

// Load full IdeaMart SMS SDK build
const IdeaMart = require('ideamart-sdk');

// Load SMSReceiver and SMSSender Modules separately
const SMSReceiver = IdeaMart.SMSReceiver;
const SMSSender = IdeaMart.SMSSender;

// Define the mandatory data that are needed for the API to function
const SERVER_URL = 'http://localhost:7000/sms/send';
const APP_ID = 'APP_000001';
const APP_PASSWORD = 'password';

// Create new sender instance to send a SMS.
const sender = new SMSSender.SMS(SERVER_URL, APP_ID, APP_PASSWORD);

// Sample route to test if the request response is working correctly.
app.post('/send', (req, res) => {
  // Extract the request data from request body using SMSReceiver module.
  const receiver = new SMSReceiver.SMS(req.body); 
  
  //Extract address and message from request body.
  const address = receiver.getAddress();
  const message = receiver.getMessage();

  // Send the SMS to the sender
  sender.sendSMS(message, address);
  // Return status for testing purposes when testing using Postman
  res.status(200).send(req.body);
});

Dependencies

  • axios: Promise based HTTP client for the browser and node.js

License

ISC

ideamart.js's People

Contributors

kr4ckhe4d avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

nexttoread

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.