0.0.2 • Published 4 years ago

esms-sdk v0.0.2

Weekly downloads
1
License
MIT
Repository
-
Last release
4 years ago

esms-sdk

Sdk to work with eSMS.vn system.

Install

    npm i --save esms-sdk

or

    yarn add esms-sdk

then you use in your project

    const eSMSSdk = require('esms-sdk')

Api

    /**
    * @param config : (object) The object must have apiKey, secretKey. brandName and debug are optional
    * config = {
    *   apiKey: 'your apiKey', // you can get it from https://account.esms.vn/Account/ApiInfomation
    *   secretKey: 'your secretKey', // you can get it from https://account.esms.vn/Account/ApiInfomation
    *   brandName: 'your brandName', // Register with eSMS.vn
    *   debug: false,
    * }
    * @param adapter : (module) the sdk's adapter. This is used when using an external sdk
    **/
    eSMSSdk.init(config:object [, adapter]) : void
    
    /**
    * @param data : (object)
    * data = {
    *   phones: '0766541618', // customer phone. You can enter strings or arrays
    *   content: "eSMS SDK", // Message you want to send to customers
    *   requestId: Date.now(), // (optional) To prevent duplicate messages for 5 seconds
    *   isSandBox: true, // (optional) Environment testing, the message will not return to the receiving device
    *   isUnicode: true, // (optional) Content with unicode or non-Unicode
    *   isGetNetwork: true, // (optional) Set true, if you want to receive phone network details
	* }
    * @return : Promise
    **/
    eSMSSdk.sendSMS(data: object) : Promise<any>
    //require  module 
	const eSMSSdk = require('esms-sdk')

    //init sdk
    eSMSSdk.init({
        apiKey: 'your apiKey', // you can get it from https://account.esms.vn/Account/ApiInfomation
        secretKey: 'your secretKey', // you can get it from https://account.esms.vn/Account/ApiInfomation
        brandName: 'your brandName', // Register with eSMS.vn
        debug: false,
    })

    //send message
    eSMSSdk.sendSMS({
        phones: '0766541618',
        content: "Welcome to eSMS SDK",
        requestId: Date.now(),
        isSandBox: true,
        isUnicode: true,
        isGetNetwork: true,
    })
        .then((result) => {
            console.log(result)
        })
        .catch((err) => {
            console.log(err)
        });

Change Log

See CHANGELOG.md

Who's using dotenv?

These npm modules depend on it.

Projects that expand it often use the keyword "esms-sdk" on npm.

0.0.2

4 years ago

0.0.1

4 years ago