GithubHelp home page GithubHelp logo

wittyflowsmsnpmpackage's Introduction

WITTY FLOW SMS NPM PACKAGE

Step 1: Install The Package Via Yarn Or Npm

Via Yarn

  yarn add witty-flow-sms

Via Npm

  npm i witty-flow-sms

Step 2: Initialize

  // IMPORT   
  // Style One
  import { WFClient } from 'witty-flow-sms';
  // Style Two
  const { WFClient } = require('witty-flow-sms');

  // Create An Instance Of The Class You Imported And Pass The App ID And App Secret
  const wittySmsClient = new WFClient('app_id_here', 'app_secret_here');

Usage

Send Text Message

  // SEND SMS
  // sendMessage Takes 3 Params (from, to, message)
  // from => string should not be more than 14 characters
  // to => string should take the 0244XXXXXX format
  // message => string should not me more than 180 characters
  const sendMessage = await wittySmsClient.sendSms('Ghana', '0541348180', 'New message');

  // OnSuccess Response
  {
    "status": "success",
    "code": 2020,
    "message": "Accpeted for delivery",
    "data": {
        "status": "accepted",
        "message_id": "ebb04f7f-147f-4d17-877b-8dd8af4ed2fe",
        "message": "New message",
        "date_created": "2020-08-24T00:17:09.000000Z",
        "direction": "MT",
        "from": "Ghana",
        "to": "233541348180",
        "type": "plain",
        "message_segments": 1,
        "cost": "0.03",
        "service_rate": "0.030000",
        "callback_url": null
    }
}

Send Flash Message

  // SEND Flash Message
  // sendFlashMessage Takes 3 Params (from, to, message)
  // from => string should not be more than 14 characters
  // to => string should take the 0244XXXXXX format
  // message => string should not me more than 180 characters
  const sendFlashMessage = await wittySmsClient.sendFlashMessage('Ghana', '0541348180', 'New message');

  // OnSuccess Response
  {
    "status": "success",
    "code": 2020,
    "message": "Accpeted for delivery",
    "data": {
        "status": "accepted",
        "message_id": "14291778-aacb-4e91-ac0c-8da6b64c75ed",
        "message": "News message",
        "date_created": "2020-08-24T00:19:37.000000Z",
        "direction": "MT",
        "from": "Kumi",
        "to": "233541348180",
        "type": "flash",
        "message_segments": 1,
        "cost": "0.03",
        "service_rate": "0.030000",
        "callback_url": null
    }
}

Get Sms Status

  // Get Sms Status
  // getSmsStatus Takes 1 Param (message_id)
  // message_id => string
  const getSmsStatus = await wittySmsClient.getSmsStatus('8048d233-f7bf-49eb-8b97-71362b929e7b');

  // OnSuccess Response
  {
    "status": "success",
    "code": 2000,
    "message": "Message retrieved",
    "data": {
        "message_id": "8048d233-f7bf-49eb-8b97-71362b929e7b",
        "status": "delivered",
        "message": "New message",
        "date": "2020-08-23T23:54:04.000000Z",
        "readable_date": "Sun August 23, 2020 11:54:04 PM",
        "direction": "MT",
        "type": "1",
        "sender": "Ghana",
        "recipient": "233541348180",
        "message_segments": 1,
        "cost": "0.03",
        "rate": "0.030000",
        "billing": "charged"
    }
}

Get Account Balance

  const getAccountBalance = await wittySmsClient.getAccountBalance();
  // OnSuccess Response
  {
    "status": "success",
    "code": 2000,
    "message": "Balance Retrieved",
    "data": {
        "balance": "19.19",
        "currency": "GHS"
    }
}

wittyflowsmsnpmpackage's People

Contributors

charlesagyemang avatar kofosu avatar

Watchers

James Cloos 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.