totalvoice node
Versão 1.12.0
العميل في nodejs ل API TotalVoice
الوظيفة
متطلبات
تثبيت
npm install --save totalvoice-nodeأو
yarn add totalvoice-nodeيستخدم
لاستخدام هذه المكتبة ، يجب عليك أولاً التسجيل على موقع Total Voice. بعد إنشاء التسجيل ، سيتم توفير Accessostoken للوصول إلى API.
مع AccessSstoken في متناول اليد ، سيكون من الممكن إجراء المشاورات/التسجيلات وفقًا لوثائق API
طرق API التي يمكن استدعاؤها:
الأمثلة التالية لكيفية استخدام هذه المكتبة.
يقوم بإجراء مكالمة هاتفية بين رقمين: A و B.
const totalvoice = require ( 'totalvoice-node' ) ;
const client = new totalvoice ( "access-token" ) ;
client . chamada . ligar ( "4832830151" , "4811111111" )
. then ( function ( data ) {
console . log ( data )
} )
. catch ( function ( error ) {
console . error ( 'Erro: ' , error )
} ) ; استشارة استشارة المعرف
const totalvoice = require ( 'totalvoice-node' ) ;
const client = new totalvoice ( "access-token" ) ;
client . chamada . buscar ( 123 ) // ID da chamada
. then ( function ( data ) {
console . log ( data )
} )
. catch ( function ( error ) {
console . error ( 'Erro: ' , error )
} ) ; يغلق مكالمة نشطة
const totalvoice = require ( 'totalvoice-node' ) ;
const client = new totalvoice ( "access-token" ) ;
client . chamada . encerrar ( 123 ) // ID da chamada
. then ( function ( data ) {
console . log ( data )
} )
. catch ( function ( error ) {
console . error ( 'Erro: ' , error )
} ) ; SMS الشحن
const totalvoice = require ( 'totalvoice-node' ) ;
const client = new totalvoice ( "access-token" ) ;
var resposta_usuario = false ;
var multi_sms = false ;
var data_criacao = '' ;
client . sms . enviar ( "4811111111" , "Mensagem SMS" , resposta_usuario , multi_sms , data_criacao )
. then ( function ( data ) {
console . log ( data )
} )
. catch ( function ( error ) {
console . error ( 'Erro: ' , error )
} ) ; TTS الشحن
const totalvoice = require ( 'totalvoice-node' ) ;
const client = new totalvoice ( "access-token" ) ;
var opcoes = { velocidade : 2 , tipo_voz : "br-Vitoria" , bina : "bina_cadastrada" } ;
client . tts . enviar ( "4811111111" , "Mensagem TTS" , opcoes ) ;
. then ( function ( data ) {
console . log ( data ) ;
} )
. catch ( function ( error ) {
console . log ( 'Erro: ' , error )
} ) ; تقديم الصوت
const totalvoice = require ( 'totalvoice-node' ) ;
const client = new totalvoice ( "access-token" ) ;
client . audio . enviar ( "4811111111" , "https://foo.bar/audio.mp3" )
. then ( function ( data ) {
console . log ( data ) ;
} )
. catch ( function ( error ) {
console . log ( 'Erro: ' , error )
} ) ; إعدادات الهاتف المركزي
const totalvoice = require ( 'totalvoice-node' ) ;
const client = new totalvoice ( "access-token" ) ;
client . central . buscaRamal ( 123546 ) // ID do Ramal
. then ( function ( data ) {
console . log ( data ) ;
} )
. catch ( function ( error ) {
console . log ( 'Erro: ' , error )
} ) ; إدارة بيانات الحساب
const totalvoice = require ( 'totalvoice-node' ) ;
const client = new totalvoice ( "access-token" ) ;
client . conta . buscar ( 123546 ) // ID da Conta
. then ( function ( data ) {
console . log ( data ) ;
} )
. catch ( function ( error ) {
console . log ( 'Erro: ' , error )
} ) ; رصيد الرصيد حسابي
const totalvoice = require ( 'totalvoice-node' ) ;
const client = new totalvoice ( "access-token" ) ;
client . perfil . consultaSaldo ( )
. then ( function ( data ) {
console . log ( data ) ;
} )
. catch ( function ( error ) {
console . log ( 'Erro: ' , error )
} ) ; إذا كنت بحاجة إلى استخدام العنوان الخاص بك تم تكوينه بصوت إجمالي
const totalvoice = require ( 'totalvoice-node' ) ;
const client = new totalvoice ( "access-token" , "https://seu-dominio.com.br" ) ;
...إذا كنت بحاجة إلى استخدامه مع الوكيل
const totalvoice = require ( 'totalvoice-node' ) ;
let options = {
proxy : {
host : 'proxy.com' ,
port : 8888 ,
auth : {
username : 'XXXX' ,
password : 'XXXX'
}
}
} ;
const client = new totalvoice ( "access-token" , "https://seu-dominio.com.br" , options ) ;
...يمكن العثور على مزيد من المعلومات حول الطرق المتاحة في وثائق API
يساهم!
تريد المساهمة؟ انقر هنا
رخصة
تتبع هذه المكتبة شروط استخدام معهد ماساتشوستس للتكنولوجيا