1.5.0 • Published 8 years ago

yuntongxun-sdk v1.5.0

Weekly downloads
7
License
MIT
Repository
github
Last release
8 years ago

yuntongxun

Node.js SDK for yuntongxun RestAPI.

Build Status semantic-release

Examples

import Yuntongxun from 'yuntongxun-sdk';

const yuntongxun = new Yuntongxun({
  urlPrefix: 'https://app.cloopen.com:8883',
  version: '2013-12-26',
  accountSid: '<Your accountSid>',
  authToken: '<Your authToken>',
  appId: '<Your appId>'
});

yuntongxun.voiceVerify('13700000000', '123456').then((callSid) => {
  console.log(callSid);
}, (err) => {
  console.error(err);
});

Installation

$ npm install yuntongxun-sdk

Documents

Official Rest API document

Table of Contents

Class: Yuntongxun

This class is a wrapper for yuntongxun Rest API

new Yuntongxun(options)

Construct a new yuntongxun object

options is an object with the following defaults:

{
  urlPrefix: 'https://app.cloopen.com:8883',
  version: '2013-12-26',
  useSubAccount: false,
  debug: false,
  logger: false
}

options's property list as below:

NametypeDescriptionRequirement
urlPrefixstringBase url without versionoptional
versionstringAPI versionoptional
accountSidstringThe accountSid or subAccountSidrequired
authTokenstringThe account auth tokenrequired
appIdstringThe app idrequired
useSubAccountboolWhether use subAccountSid or accountSidoptional
debugboolDebug toggleoptional
loggerfunctionA logger handleroptional
proxystringProxy for someone behind a firewalloptional
timeoutintegerTimeout for requestoptional

logger function accept only one argument msg like

(msg) => {
  // do some thing...
}
NametypeDescriptionRequirement
msgstringLog messageoptional

yuntongxun.voiceVerify(mobile, token, displayNum, playTimes)

Send Voice Verify token to mobile with CID displayNum and repeat playTimes times

NametypeDescriptionRequirement
mobilestringUser's mobile to receive voice verifyrequired
tokenstringToken playedrequired
displayNumstringCIDoptional
playTimesintegerRepeat play timesoptional

yuntongxun.callResult(callSid)

Get call result callSid

NametypeDescriptionRequirement
callSidstringCall IDrequired

yuntongxun.templateSms(mobile, templateId, datas)

Send Template SMS identified by templateId to mobile with template data datas

NametypeDescriptionRequirement
mobilestringUser's mobile to receive template SMSrequired
templateIdintegerTemplate ID applied from yuntongxun adminrequired
datasarrayTemplate data corresponding to template definitionoptional

Todo List

  • To implement other Rest API interface.

License

MIT License. See the LICENSE file.

1.5.0

8 years ago

1.4.0

8 years ago

1.3.0

8 years ago

1.2.0

8 years ago

1.1.0

8 years ago

0.6.1

9 years ago

0.6.0

9 years ago

0.5.0

9 years ago

0.4.0

9 years ago

0.3.0

9 years ago

0.2.0

9 years ago

0.1.0

9 years ago