0.2.0 • Published 4 years ago

tcast v0.2.0

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

tcast

TCast SMS Indonesia Javascript client library

Install

npm add tcast

npm can be changed to yarn

Usage

Load the library

const tcast = require('tcast')

Send SMS

const numbers = ['62812xxx', '62855xxx']
const message = 'hello world'
const schedule = new Date('2080-01-02') // optional
const result = await tcast.send(numbers, message, schedule)

/*
{
  total: {
    success: 10,
    fail: 1
  },
  result: [
    {id: 1, number: '62812xxx'}
    ...
  ]
}
*/

Get Balance

const result = await tcast.balance()

/*
{
  balance: 1000,
  gift: 500,
  total: 1500
}
*/

Get Messages

const result = await tcast.messages()

/*
{
  total: 10,
  result: [
    { id: 12, number: '62812xxx', time: '14/10/2020, 11:17:52', message: 'hello'}
    ...
  ]
}
*/

Get Reports

const ids = [1,2,3]
const result = await tcast.reports(ids)

/*
{
  total: {
    sent: 1,
    unsent: 0,
    sending: 0,
    notFound: 0,
    fail: 0,
  },
  result: [
    {
      id: 1,
      number: '6281xxx',
      time: '14/10/2020, 11:17:52',
      status: 'sent' || 'unsent' || 'sending' || 'fail'
    }
    ...
  ]
}
*/
0.2.0

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago