totalvoice node
Versão 1.12.0
Pelanggan di NodeJs untuk TotalVoice API
Fungsionalitas
Persyaratan
Instalasi
npm install --save totalvoice-nodeatau
yarn add totalvoice-nodeMenggunakan
Untuk menggunakan perpustakaan ini, Anda harus terlebih dahulu mendaftar di situs web Total Voice. Setelah pembuatan pendaftaran akan disediakan sebagai Accessostoken untuk akses ke API.
Dengan AccessSstoken di tangan akan dimungkinkan untuk membuat konsultasi/pendaftaran sesuai dengan dokumentasi API
Metode API yang dapat dipanggil:
Contoh -contoh berikut tentang bagaimana perpustakaan ini dapat digunakan.
Membuat panggilan telepon antara dua nomor: A dan 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 )
} ) ; Hubungi Konsultasi dengan ID
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 )
} ) ; Menutup panggilan aktif
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 )
} ) ; Pengiriman 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 )
} ) ; Pengiriman 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 )
} ) ; Pengajuan Audio
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 )
} ) ; Pengaturan Telepon Tengah
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 )
} ) ; Manajemen Data Akun
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 )
} ) ; Saldo saldo akun saya
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 )
} ) ; Jika Anda perlu menggunakan alamat Anda sendiri yang dikonfigurasi dengan suara total
const totalvoice = require ( 'totalvoice-node' ) ;
const client = new totalvoice ( "access-token" , "https://seu-dominio.com.br" ) ;
...Jika Anda perlu menggunakannya dengan proxy
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 ) ;
...Informasi lebih lanjut tentang metode yang tersedia dapat ditemukan dalam dokumentasi API
Menyumbang!
Ingin berkontribusi? klik disini
Lisensi
Perpustakaan ini mengikuti ketentuan penggunaan MIT