npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mksms

v0.0.6

Published

A js lib for mksms Api

Downloads

8

Readme

Mksms

npm version license

This is the mksms API implement in js to make it easy to use.

Table of contents

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

You need an API_KEY and API_HASH, get them on our website https://mksms.cm

Installing

To install the package run

    $npm i mksms

Use package

To use the package you must first import it. here is an example of import.

Import in nodejs

    const mksms = require('mksms');

or

    const {Client, Message, Contact} = require('mksms');

Use


    const config = {
        api_key:"MY_API_KEY",
        api_hash:"MY_API_HASH"
    };
    let client = new mksms.Client(config.api_key,config.api_hash);

    client.send_message({
        to:{
            number:"+237692392932",
            name:"jean"
            },
        body:"hello"
    }).subscribe({
        error:(error)=>{
          //do any thing
        },
        next:(data)=>{
            //do any thing
        },
        complete:(rep)=>{
            //do any thing
        }
    });

or

    var config = {
        api_key:"MY_API_KEY",
        api_hash:"MY_API_HASH"
    };
    var contact = new Contact("+237692392932","jean");
    var message = new Message(contact,"hello");
    var client = new Client(config.api_key,config.api_hash);
    client.send_message(message);

Test

This must be done to test the configurations and the proper functioning of the API.

Launch the test

    $npm test

or to view test results in the browser

    $npm run test:browser

Set up the tests

You can change the test configuration in the ./test/data/data.json file.

    {
        "test_config":{
            "api_key": "BDCAA0C858",
            "api_hash": "f7e88b92f324bdd09d195019053a2d613c3ae6c5b1dcadf988c2b18e75770530"
        },
        "fake_message":{
            "to":{
                "number":"697898466f",
                "name":"moi"
            },
            "body":"Salut molah"
        },
        "good_message" :{
            "to":{
                "number":"697898466",
                "name":"moi"
            },
            "body":"Salut molah"
        }
    }

or directly from the command line

    $npm run test --key="MY_API_KEY" --hash="MY_API_HASH" --number="number" --name="name" --body="message"

Test results

In the console

test_mksms_console_result

In the browser

test_mksms_browser_result

NB: the api test fails if api_key and api_hash are not valid.

Methods docs

Get messages

  • name: get_messages

|Params |Type |Default value |Required | |----|----|----|----| |min_date |Date |null |not required | |direction | number | -1 |not required | |read |boolean |false |not required | |timestamp | Date |null |not required |

  • return: Promise< Array >
   []

Send messages

  • name: send_messages

|Params |Type |Default value |Required | |----|----|----|----| |message|Message | |true|

  • return: Promise< Object >
   {
     "success": true,
     "cost": 1
   }

or there is an error

  {
     "success": false,
     "message": "Invalid ..."
  }

Start verify

  • name: start_verify

|Params |Type |Default value |Required | |----|----|----|----| |number |string | |true| |name |string | |true|

  • return: Promise< Object>
   {
     "success": true
   }

or there is an error

  {
     "success": false,
     "message": "Invalid ..."
  }

Confirm verify

  • name: confirm_verify

|Params |Type |Default value |Required | |----|----|----|----| |number|string | |true| |code|string | |true|

  • return: Promise< Object >
   {
     "success": true
   }

or there is an error

  {
     "success": false,
     "message": "Invalid ..."
  }

Authors

License

This project is licensed under the Apache 2.0 License - see the LICENSE.md file for details