├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── __tests__ └── totalvoice.js ├── index.js ├── lib ├── api │ ├── audio.js │ ├── bina.js │ ├── central.js │ ├── chamada.js │ ├── composto.js │ ├── conferencia.js │ ├── conta.js │ ├── did.js │ ├── fila.js │ ├── perfil.js │ ├── sms.js │ ├── status.js │ ├── tts.js │ └── verificacao.js ├── client.js ├── interceptor.js └── totalvoice.js └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Directory for instrumented libs generated by jscoverage/JSCover 15 | lib-cov 16 | 17 | # Coverage directory used by tools like istanbul 18 | coverage 19 | 20 | # nyc test coverage 21 | .nyc_output 22 | 23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 24 | .grunt 25 | 26 | # Bower dependency directory (https://bower.io/) 27 | bower_components 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # Compiled binary addons (https://nodejs.org/api/addons.html) 33 | build/Release 34 | 35 | # Dependency directories 36 | node_modules/ 37 | jspm_packages/ 38 | 39 | # Typescript v1 declaration files 40 | typings/ 41 | 42 | # Optional npm cache directory 43 | .npm 44 | 45 | # Optional eslint cache 46 | .eslintcache 47 | 48 | # Optional REPL history 49 | .node_repl_history 50 | 51 | # Output of 'npm pack' 52 | *.tgz 53 | 54 | # Yarn Integrity file 55 | .yarn-integrity 56 | 57 | # dotenv environment variables file 58 | .env 59 | .idea/ 60 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | 3 | node_js: 4 | - "6" 5 | - "8" 6 | 7 | sudo: false 8 | 9 | script: 10 | - npm test -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 TotalVoice 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # totalvoice-node 2 | Cliente em NodeJS para API da Totalvoice 3 | 4 | [![Build Status](https://travis-ci.org/totalvoice/totalvoice-node.svg?branch=master)](http://travis-ci.org/#!/totalvoice/totalvoice-node) 5 | 6 | > ### Funcionalidades 7 | 8 | - [X] Gerenciamento das chamadas 9 | - [X] Consulta e envio de SMS 10 | - [X] Consulta e envio de TTS 11 | - [X] Consulta e envio de Audio 12 | - [X] Gerenciamento da Conta 13 | - [X] Gerenciamento da Central 14 | 15 | > ### Requisitos 16 | 17 | - NodeJS 6 ou superior 18 | 19 | > ### Instalação 20 | 21 | ```bash 22 | npm install --save totalvoice-node 23 | ``` 24 | 25 | ou 26 | 27 | ```bash 28 | yarn add totalvoice-node 29 | ``` 30 | 31 | > ### Utilização 32 | 33 | Para utilizar esta biblioteca, primeiramente você deverá realizar um cadastro no site da [Total Voice](http://www.totalvoice.com.br). 34 | Após a criação do cadastro será disponibilizado um AccessToken para acesso a API. 35 | 36 | Com o AccessToken em mãos será possível realizar as consultas/cadastros conforme documentação da [API](https://api.totalvoice.com.br/doc/#/) 37 | 38 | Os métodos da API que poderão ser invocados: 39 | - audio 40 | - central 41 | - chamada 42 | - composto 43 | - conferencia 44 | - conta 45 | - perfil 46 | - sms 47 | - tts 48 | 49 | A seguir exemplos de como pode ser utilizada esta biblioteca. 50 | 51 | > ##### Realiza uma chamada telefônica entre dois números: A e B 52 | 53 | ```javascript 54 | 55 | const totalvoice = require('totalvoice-node'); 56 | const client = new totalvoice("access-token"); 57 | 58 | client.chamada.ligar("4832830151", "4811111111") 59 | .then(function (data) { 60 | console.log(data) 61 | }) 62 | .catch(function (error) { 63 | console.error('Erro: ', error) 64 | }); 65 | 66 | ``` 67 | 68 | > ##### Consulta de chamada pelo ID 69 | 70 | ```javascript 71 | 72 | const totalvoice = require('totalvoice-node'); 73 | const client = new totalvoice("access-token"); 74 | 75 | client.chamada.buscar(123) // ID da chamada 76 | .then(function (data) { 77 | console.log(data) 78 | }) 79 | .catch(function (error) { 80 | console.error('Erro: ', error) 81 | }); 82 | 83 | ``` 84 | 85 | 86 | > ##### Encerra uma chamada ativa 87 | 88 | ```javascript 89 | 90 | const totalvoice = require('totalvoice-node'); 91 | const client = new totalvoice("access-token"); 92 | 93 | client.chamada.encerrar(123) // ID da chamada 94 | .then(function (data) { 95 | console.log(data) 96 | }) 97 | .catch(function (error) { 98 | console.error('Erro: ', error) 99 | }); 100 | 101 | ``` 102 | 103 | > ##### Envio de SMS 104 | 105 | ```javascript 106 | 107 | const totalvoice = require('totalvoice-node'); 108 | const client = new totalvoice("access-token"); 109 | 110 | var resposta_usuario = false; 111 | var multi_sms = false; 112 | var data_criacao = ''; 113 | client.sms.enviar("4811111111", "Mensagem SMS", resposta_usuario, multi_sms, data_criacao) 114 | .then(function (data) { 115 | console.log(data) 116 | }) 117 | .catch(function (error) { 118 | console.error('Erro: ', error) 119 | }); 120 | 121 | ``` 122 | 123 | > ##### Envio de TTS 124 | 125 | ```javascript 126 | 127 | const totalvoice = require('totalvoice-node'); 128 | const client = new totalvoice("access-token"); 129 | 130 | var opcoes = {velocidade: 2, tipo_voz: "br-Vitoria", bina: "bina_cadastrada"}; 131 | client.tts.enviar("4811111111", "Mensagem TTS", opcoes); 132 | .then(function(data) { 133 | console.log(data); 134 | }) 135 | .catch(function(error) { 136 | console.log('Erro: ', error) 137 | }); 138 | 139 | ``` 140 | 141 | > ##### Envio de Audio 142 | 143 | ```javascript 144 | 145 | const totalvoice = require('totalvoice-node'); 146 | const client = new totalvoice("access-token"); 147 | 148 | client.audio.enviar("4811111111", "https://foo.bar/audio.mp3") 149 | .then(function(data) { 150 | console.log(data); 151 | }) 152 | .catch(function(error) { 153 | console.log('Erro: ', error) 154 | }); 155 | 156 | ``` 157 | 158 | > ##### Configurações de central telefonica 159 | 160 | ```javascript 161 | 162 | const totalvoice = require('totalvoice-node'); 163 | const client = new totalvoice("access-token"); 164 | 165 | client.central.buscaRamal(123546) // ID do Ramal 166 | .then(function(data) { 167 | console.log(data); 168 | }) 169 | .catch(function(error) { 170 | console.log('Erro: ', error) 171 | }); 172 | 173 | ``` 174 | 175 | > ##### Gerenciamento dos dados da Conta 176 | 177 | ```javascript 178 | 179 | const totalvoice = require('totalvoice-node'); 180 | const client = new totalvoice("access-token"); 181 | 182 | client.conta.buscar(123546) // ID da Conta 183 | .then(function(data) { 184 | console.log(data); 185 | }) 186 | .catch(function(error) { 187 | console.log('Erro: ', error) 188 | }); 189 | 190 | ``` 191 | 192 | > ##### Consulta saldo da Minha Conta 193 | 194 | ```javascript 195 | 196 | const totalvoice = require('totalvoice-node'); 197 | const client = new totalvoice("access-token"); 198 | 199 | client.perfil.consultaSaldo() 200 | .then(function(data) { 201 | console.log(data); 202 | }) 203 | .catch(function(error) { 204 | console.log('Erro: ', error) 205 | }); 206 | 207 | ``` 208 | 209 | > ##### Caso você necessite utilizar seu próprio endereço configurado na Total Voice 210 | 211 | ```javascript 212 | 213 | const totalvoice = require('totalvoice-node'); 214 | const client = new totalvoice("access-token", "https://seu-dominio.com.br"); 215 | ... 216 | 217 | ``` 218 | 219 | > ##### Caso você necessite utilizar com Proxy 220 | 221 | ```javascript 222 | 223 | const totalvoice = require('totalvoice-node'); 224 | let options = { 225 | proxy: { 226 | host: 'proxy.com', 227 | port: 8888, 228 | auth: { 229 | username: 'XXXX', 230 | password: 'XXXX' 231 | } 232 | } 233 | }; 234 | const client = new totalvoice("access-token", "https://seu-dominio.com.br", options); 235 | ... 236 | 237 | ``` 238 | 239 | Mais informações sobre os métodos disponíveis podem ser encontrados na documentação da [API](https://api.totalvoice.com.br/doc/#/) 240 | 241 | > ### Contribua! 242 | 243 | Quer contribuir? [clique aqui](https://github.com/totalvoice/totalvoice-node/blob/master/CONTRIBUTING.md) 244 | 245 | > ### Licença 246 | 247 | Esta biblioteca segue os termos de uso da [MIT](https://github.com/totalvoice/totalvoice-node/blob/master/LICENSE) 248 | -------------------------------------------------------------------------------- /__tests__/totalvoice.js: -------------------------------------------------------------------------------- 1 | const Totalvoice = require('../index.js'); 2 | const Chamada = require('../lib/api/chamada.js'); 3 | const Audio = require('../lib/api/audio.js'); 4 | const Bina = require('../lib/api/bina.js'); 5 | const Perfil = require('../lib/api/perfil'); 6 | const Conta = require('../lib/api/conta'); 7 | const Composto = require('../lib/api/composto'); 8 | const Conferencia = require('../lib/api/conferencia'); 9 | const SMS = require('../lib/api/sms'); 10 | const TTS = require('../lib/api/tts'); 11 | const Central = require('../lib/api/central'); 12 | const DID = require('../lib/api/did'); 13 | const fila = require('../lib/api/fila'); 14 | const status = require('../lib/api/status'); 15 | const Verificacao = require('../lib/api/verificacao'); 16 | 17 | const client = new Totalvoice('123456789', 'https://foo.bar'); 18 | 19 | test('Testa o atributo se é instância de Audio', function(){ 20 | expect(client.audio).toBeInstanceOf(Audio); 21 | }); 22 | 23 | test('Testa o atributo se é instância de Bina', function(){ 24 | expect(client.bina).toBeInstanceOf(Bina); 25 | }); 26 | 27 | test('Testa o atributo se é instância de Chamada', function(){ 28 | expect(client.chamada).toBeInstanceOf(Chamada); 29 | }); 30 | 31 | test('Testa o atributo se é instância de Peril', function(){ 32 | expect(client.perfil).toBeInstanceOf(Perfil); 33 | }); 34 | 35 | test('Testa o atributo se é instância de Conta', function(){ 36 | expect(client.conta).toBeInstanceOf(Conta); 37 | }); 38 | 39 | test('Testa o atributo se é instância de Composto', function(){ 40 | expect(client.composto).toBeInstanceOf(Composto); 41 | }); 42 | 43 | test('Testa o atributo se é instância de Conferência', function(){ 44 | expect(client.conferencia).toBeInstanceOf(Conferencia); 45 | }); 46 | 47 | test('Testa o atributo se é instância de SMS', function(){ 48 | expect(client.sms).toBeInstanceOf(SMS); 49 | }); 50 | 51 | test('Testa o atributo se é instância de TTS', function(){ 52 | expect(client.tts).toBeInstanceOf(TTS); 53 | }); 54 | 55 | test('Testa o atributo se é instância de Central', function(){ 56 | expect(client.central).toBeInstanceOf(Central); 57 | }); 58 | 59 | test('Testa o atributo se é instância de DID', function(){ 60 | expect(client.did).toBeInstanceOf(DID); 61 | }); 62 | 63 | test('Testa o atributo se é instância de Fila', function(){ 64 | expect(client.fila).toBeInstanceOf(fila); 65 | }); 66 | 67 | test('Testa o atributo se é instância de Status', function(){ 68 | expect(client.status).toBeInstanceOf(status); 69 | }); 70 | 71 | test('Testa o atributo se é instância de Verificacao', function(){ 72 | expect(client.verificacao).toBeInstanceOf(Verificacao); 73 | }); 74 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./lib/totalvoice'); -------------------------------------------------------------------------------- /lib/api/audio.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Módulo Audio 3 | * @param {object} httpClient 4 | */ 5 | module.exports = function Audio(httpClient) { 6 | 7 | const client = httpClient 8 | 9 | const ROTA_AUDIO = '/audio' 10 | 11 | /** 12 | * Envia um audio para um número destino 13 | * @param {string} numero_destino 14 | * @param {string} url_audio 15 | * @param {bool} resposta_usuario 16 | * @param {string} bina 17 | * @param {bool} gravar_audio 18 | * @return {Promise} 19 | */ 20 | this.enviar = function (numero_destino, url_audio, resposta_usuario, bina, gravar_audio) { 21 | return client.post(ROTA_AUDIO, { 22 | numero_destino, 23 | url_audio, 24 | resposta_usuario, 25 | bina, 26 | gravar_audio 27 | }) 28 | } 29 | 30 | /** 31 | * Busca um audio pelo seu ID 32 | * @param {int} id 33 | * @return {Promise} 34 | */ 35 | this.buscar = function (id) { 36 | return client.get(`${ROTA_AUDIO}/${id}`) 37 | } 38 | 39 | /** 40 | * Relatório de mensagens de Audios 41 | * @param {string} data_inicio 42 | * @param {string} data_fim 43 | * @return {Promise} 44 | */ 45 | this.relatorio = function (data_inicio, data_fim) { 46 | return client.get(`${ROTA_AUDIO}/relatorio`, { 47 | params: { 48 | data_inicio, 49 | data_fim 50 | } 51 | }) 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /lib/api/bina.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Módulo Bina 3 | * @param {object} httpClient 4 | */ 5 | module.exports = function Bina(httpClient) { 6 | 7 | const client = httpClient 8 | 9 | const ROTA_BINA = '/bina' 10 | 11 | /** 12 | * Envia um número pra receber um código de validação 13 | * @param {string} telefone 14 | * @return {Promise} 15 | */ 16 | this.enviar = function (telefone) { 17 | return client.post(ROTA_BINA, {telefone}); 18 | } 19 | 20 | /** 21 | * Verifica se o código é válido para o telefone 22 | * @param {string} codigo 23 | * @param {string} telefone 24 | * @return {Promise} 25 | */ 26 | this.validar = function (codigo, telefone) { 27 | return client.get(ROTA_BINA, { 28 | params: { 29 | codigo, 30 | telefone 31 | } 32 | }); 33 | } 34 | 35 | /** 36 | * Remove o telefone cadastrado na sua Conta 37 | * @param {string} telefone 38 | * @return {Promise} 39 | */ 40 | this.excluir = function (telefone) { 41 | return client.delete(`${ROTA_BINA}/${telefone}`); 42 | } 43 | 44 | /** 45 | * @return {Promise} 46 | */ 47 | this.relatorio = function () { 48 | return client.get(`${ROTA_BINA}/relatorio`); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /lib/api/central.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Módulo Central 3 | * @param {object} httpClient 4 | */ 5 | module.exports = function Central(httpClient) { 6 | 7 | const client = httpClient 8 | 9 | const ROTA_RAMAL = '/ramal' 10 | const ROTA_FILA = '/fila' 11 | const ROTA_URA = '/ura' 12 | const ROTA_WEBPHONE = '/webphone' 13 | 14 | /** 15 | * Cria um novo ramal 16 | * @param {object} data 17 | * @return {Promise} 18 | */ 19 | this.criarRamal = function (data) { 20 | return client.post(ROTA_RAMAL, data) 21 | } 22 | 23 | /** 24 | * Remove um Ramal 25 | * @param {int} id 26 | * @return {Promise} 27 | */ 28 | this.excluirRamal = function (id) { 29 | return client.delete(`${ROTA_RAMAL}/${id}`) 30 | } 31 | 32 | /** 33 | * Busca uma Ramal pelo seu ID 34 | * @param {int} id 35 | * @return {Promise} 36 | */ 37 | this.buscaRamal = function (id) { 38 | return client.get(`${ROTA_RAMAL}/${id}`) 39 | } 40 | 41 | /** 42 | * Atualiza um ramal 43 | * @param {int} id 44 | * @param {object} data 45 | * @return {Promise} 46 | */ 47 | this.atualizarRamal = function (id, data) { 48 | return client.put(`${ROTA_RAMAL}/${id}`, data) 49 | } 50 | 51 | /** 52 | * Relatório de mensagens de Ramal 53 | * @return {Promise} 54 | */ 55 | this.relatorio = function () { 56 | return client.get(`${ROTA_RAMAL}/relatorio`) 57 | } 58 | 59 | /** 60 | * Listar pausas do ramal 61 | * @param {int} id 62 | * @return {Promise} 63 | */ 64 | this.relatorioPausas = function (id) { 65 | return client.get(`${ROTA_RAMAL}/${id}/pausas`) 66 | } 67 | 68 | /** 69 | * Listar pausas do ramal 70 | * @param {int} ramal 71 | * @return {Promise} 72 | */ 73 | this.atualizarRamalFila = function (id, data) { 74 | return client.put(`${ROTA_RAMAL}/${id}${ROTA_FILA}`, data) 75 | } 76 | 77 | /** 78 | * Requisita a URL do webphone de um ramal 79 | * @param {array} data 80 | * @return {Promise} 81 | */ 82 | this.webphone = function (data) { 83 | return client.get(ROTA_WEBPHONE, { 84 | params: data 85 | }) 86 | } 87 | 88 | /** 89 | * Cria uma nova URA 90 | * @param {string} nome 91 | * @param {array} dados 92 | * @return {Promise} 93 | */ 94 | this.criarUra = function (nome, dados) { 95 | return client.post(ROTA_URA, { 96 | nome, 97 | dados 98 | }) 99 | } 100 | 101 | /** 102 | * Remove uma Ura 103 | * @param {int} id 104 | * @return {Promise} 105 | */ 106 | this.excluirUra = function (id) { 107 | return client.delete(`${ROTA_URA}/${id}`) 108 | } 109 | 110 | /** 111 | * Busca uma Ura pelo seu ID 112 | * @param {int} id 113 | * @return {Promise} 114 | */ 115 | this.buscaUra = function (id) { 116 | return client.get(`${ROTA_URA}/${id}`) 117 | } 118 | 119 | /** 120 | * Atualiza uma ura 121 | * @param {id} id 122 | * @param {string} nome 123 | * @param {array} dados 124 | * @return {Promise} 125 | */ 126 | this.atualizarUra = function (id, nome, dados) { 127 | return client.put(`${ROTA_URA}/${id}`, { 128 | nome, 129 | dados 130 | }) 131 | } 132 | 133 | /** 134 | * Retorna a sua lista de URAs e suas estruturas 135 | * @return {Promise} 136 | */ 137 | this.relatorioUra = function () { 138 | return client.get(`${ROTA_URA}/relatorio`) 139 | } 140 | } 141 | -------------------------------------------------------------------------------- /lib/api/chamada.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Módulo Chamada 3 | * @param {object} httpClient 4 | */ 5 | module.exports = function Chamada(httpClient) { 6 | 7 | const client = httpClient 8 | 9 | const ROTA_CHAMADA = '/chamada' 10 | 11 | /** 12 | * Realiza uma chamada telefônica entre dois números: A e B 13 | * @param {string} numero_origem 14 | * @param {string} numero_destino 15 | * @param {object} opcoes 16 | * @return {Promise} 17 | */ 18 | this.ligar = function (numero_origem, numero_destino, opcoes = {}) { 19 | return client.post(ROTA_CHAMADA, { 20 | numero_origem, 21 | numero_destino, 22 | opcoes 23 | }) 24 | } 25 | 26 | /** 27 | * Encerra uma chamada ativa 28 | * @param {int} id 29 | * @return {Promise} 30 | */ 31 | this.encerrar = function (id) { 32 | return client.delete(`${ROTA_CHAMADA}/${id}`) 33 | } 34 | 35 | /** 36 | * Busca uma chamada pelo seu ID 37 | * @param {int} id 38 | * @return {Promise} 39 | */ 40 | this.buscar = function (id) { 41 | return client.get(`${ROTA_CHAMADA}/${id}`) 42 | } 43 | 44 | /** 45 | * Download do áudio de uma chamada gravada 46 | * @param {int} id 47 | * @return {Promise} 48 | */ 49 | this.downloadGravacao = function (id) { 50 | return client.get(`${ROTA_CHAMADA}/${id}/gravacao`) 51 | } 52 | 53 | /** 54 | * Relatório de mensagens de Chamadas 55 | * @param {string} data_inicio 56 | * @param {string} data_fim 57 | * @return {Promise} 58 | */ 59 | this.relatorio = function (data_inicio, data_fim) { 60 | return client.get(`${ROTA_CHAMADA}/relatorio`, { 61 | params: { 62 | data_inicio, 63 | data_fim 64 | } 65 | }) 66 | } 67 | 68 | /** 69 | * (Beta) Escuta uma chamada ativa 70 | * @param {int} id 71 | * @param {string} numero 72 | * @param {int} modo 73 | * @return {Promise} 74 | */ 75 | this.escutar = function (id, numero, modo) { 76 | return client.post(`${ROTA_CHAMADA}/${id}/escuta`, { 77 | numero, 78 | modo 79 | }) 80 | } 81 | 82 | /** 83 | * (Beta) Faz uma transferência da chamada atual 84 | * @param {int} id 85 | * @param {string} numero 86 | * @param {string} perna 87 | * @return {Promise} 88 | */ 89 | this.transferir = function (id, numero, perna) { 90 | return client.post(`${ROTA_CHAMADA}/${id}/transfer`, { 91 | numero, 92 | perna 93 | }) 94 | } 95 | 96 | /** 97 | * Avalia uma Chamada com nota de 1 a 5 98 | * @param {int} id 99 | * @param {string} nota 100 | * @param {string} comentario 101 | * @return {Promise} 102 | */ 103 | this.avaliar = function (id, nota, comentario) { 104 | return client.post(`${ROTA_CHAMADA}/${id}/transfer`, { 105 | nota, 106 | comentario 107 | }) 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /lib/api/composto.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Módulo Composto 3 | * @param {object} httpClient 4 | */ 5 | module.exports = function Composto(httpClient) { 6 | 7 | const client = httpClient 8 | 9 | const ROTA_COMPOSTO = '/composto' 10 | 11 | /** 12 | * Envia um composto para um número destino 13 | * @param {string} numero_destino 14 | * @param {array} dados 15 | * @param {string} bina 16 | * @param {string} tags 17 | * @param {boolean} gravar_audio 18 | * @return {Promise} 19 | */ 20 | this.enviar = function (numero_destino, dados, bina, tags, gravar_audio) { 21 | return client.post(ROTA_COMPOSTO, { 22 | numero_destino, 23 | dados, 24 | bina, 25 | tags, 26 | gravar_audio 27 | }) 28 | } 29 | 30 | /** 31 | * Busca um composto pelo seu ID 32 | * @param {int} id 33 | * @return {Promise} 34 | */ 35 | this.buscar = function (id) { 36 | return client.get(`${ROTA_COMPOSTO}/${id}`) 37 | } 38 | 39 | /** 40 | * Relatório de mensagens de Composto 41 | * @param {string} data_inicio 42 | * @param {string} data_fim 43 | * @return {Promise} 44 | */ 45 | this.relatorio = function (data_inicio, data_fim) { 46 | return client.get(`${ROTA_COMPOSTO}/relatorio`, { 47 | params: { 48 | data_inicio, 49 | data_fim 50 | } 51 | }) 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /lib/api/conferencia.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Módulo Conferencia 3 | * @param {object} httpClient 4 | */ 5 | module.exports = function Conferencia(httpClient) { 6 | 7 | const client = httpClient 8 | 9 | const ROTA_CONFERENCIA = '/conferencia' 10 | 11 | /** 12 | * Cria uma conferência 13 | * @return {Promise} 14 | */ 15 | this.criar = function () { 16 | return client.post(ROTA_CONFERENCIA, {}) 17 | } 18 | 19 | /** 20 | * Busca uma conferência pelo seu ID 21 | * @param {int} id 22 | * @return {Promise} 23 | */ 24 | this.buscar = function (id) { 25 | return client.get(`${ROTA_CONFERENCIA}/${id}`) 26 | } 27 | 28 | /** 29 | * Adiciona na conferência 30 | * @param {int} id 31 | * @param {string} numero 32 | * @param {string} bina 33 | * @param {bool} gravar_audio 34 | * @return {Promise} 35 | */ 36 | this.addNumero = function (id, numero, bina, gravar_audio) { 37 | return client.post(`${ROTA_CONFERENCIA}/${id}`, { 38 | numero, 39 | bina, 40 | gravar_audio 41 | }) 42 | } 43 | 44 | /** 45 | * Remove uma conferência ativa 46 | * @param {int} id 47 | * @return {Promise} 48 | */ 49 | this.excluir = function (id) { 50 | return client.delete(`${ROTA_CONFERENCIA}/${id}`) 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /lib/api/conta.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Módulo Conta 3 | * @param {object} httpClient 4 | */ 5 | module.exports = function Conta(httpClient) { 6 | 7 | const client = httpClient 8 | 9 | const ROTA_CONTA = '/conta' 10 | const ROTA_WEBHOOK_DEFAULT = '/webhook-default' 11 | 12 | /** 13 | * Cria uma nova conta na plataforma 14 | * @param {object} data 15 | * @return {Promise} 16 | */ 17 | this.criar = function (data) { 18 | return client.post(ROTA_CONTA, data) 19 | } 20 | 21 | /** 22 | * Leitura dos dados de uma conta criada 23 | * @param {int} id 24 | * @return {Promise} 25 | */ 26 | this.buscar = function (id) { 27 | return client.get(`${ROTA_CONTA}/${id}`) 28 | } 29 | 30 | /** 31 | * Remove uma conta 32 | * @param {int} id 33 | * @return {Promise} 34 | */ 35 | this.excluir = function (id) { 36 | return client.delete(`${ROTA_CONTA}/${id}`) 37 | } 38 | 39 | /** 40 | * Atualiza os dados de uma conta criada 41 | * @param {int} $id 42 | * @param {object} data 43 | * @return {Promise} 44 | */ 45 | this.atualizar = function (id, data) { 46 | return client.put(`${ROTA_CONTA}/${id}`, data) 47 | } 48 | 49 | /** 50 | * Lista contas criadas por mim 51 | * @return {Promise} 52 | */ 53 | this.relatorio = function () { 54 | return client.get(`${ROTA_CONTA}/relatorio`) 55 | } 56 | 57 | /** 58 | * Credita valor de bônus em uma conta filha 59 | * @param {int} id 60 | * @param {object} data 61 | * @return {Promise} 62 | */ 63 | this.recargaBonus = function (id, data) { 64 | return client.post(`${ROTA_CONTA}/${id}/bonus`, data) 65 | } 66 | 67 | /** 68 | * Retorna a lista de webhooks default configurados para esta conta 69 | * @return {Promise} 70 | */ 71 | this.webhooksDefault = function () { 72 | return client.get(`${ROTA_CONTA}${ROTA_WEBHOOK_DEFAULT}`) 73 | } 74 | 75 | /** 76 | * Apaga um webhook 77 | * @param {string} nome 78 | * @return {Promise} 79 | */ 80 | this.excluirWebhookDefault = function (nome) { 81 | return client.delete(`${ROTA_CONTA}/${ROTA_WEBHOOK_DEFAULT}/${nome}`) 82 | } 83 | 84 | /** 85 | * Cadastra ou atualiza um webhook 86 | * @param {string} nome 87 | * @param {string} url 88 | * @return {Promise} 89 | */ 90 | this.salvaWebhookDefault = function (nome, url) { 91 | return client.put(`${ROTA_CONTA}/${ROTA_WEBHOOK_DEFAULT}/${nome}`, { 92 | url 93 | }) 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /lib/api/did.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Módulo DID 3 | * @param {object} httpClient 4 | */ 5 | module.exports = function Did(httpClient) { 6 | 7 | const client = httpClient 8 | 9 | const ROTA_DID = '/did' 10 | 11 | /** 12 | * Lista todos os dids pertencentes 13 | * @return {Promise} 14 | */ 15 | this.listar = function () { 16 | return client.get(ROTA_DID) 17 | } 18 | 19 | /** 20 | * Remove um did 21 | * @param {int} id 22 | * @return {Promise} 23 | */ 24 | this.excluir = function (id) { 25 | return client.delete(`${ROTA_DID}/${id}`) 26 | } 27 | 28 | /** 29 | * Atualiza um did 30 | * @param {int} id 31 | * @param {string} ramal_id 32 | * @param {string} ura_id 33 | * @return {Promise} 34 | */ 35 | this.atualizar = function (id, ramal_id, ura_id) { 36 | return client.put(`${ROTA_DID}/${id}`, { 37 | ramal_id, 38 | ura_id 39 | }) 40 | } 41 | 42 | /** 43 | * Lista todos os dids disponiveis 44 | * @return {Promise} 45 | */ 46 | this.listaEstoque = function () { 47 | return client.get(`${ROTA_DID}/estoque`) 48 | } 49 | 50 | /** 51 | * Adquire um novo did para sua conta 52 | * @param {int} id 53 | * @return {Promise} 54 | */ 55 | this.adquirir = function (id) { 56 | return client.post(`${ROTA_DID}/estoque/${id}`, {}) 57 | } 58 | 59 | /** 60 | * Busca uma chamada recebida pelo seu ID 61 | * @param {int} id 62 | * @return {Promise} 63 | */ 64 | this.buscaChamadaRecebida = function (id) { 65 | return client.post(`${ROTA_DID}/estoque/${id}`, {}) 66 | } 67 | 68 | /** 69 | * Relatório de chamadas DID 70 | * @param {string} data_inicio 71 | * @param {string} data_fim 72 | * @return {Promise} 73 | */ 74 | this.relatorio = function (data_inicio, data_fim) { 75 | return client.get(`${ROTA_DID}/relatorio`, { 76 | params: { 77 | data_inicio, 78 | data_fim 79 | } 80 | }) 81 | } 82 | }; 83 | -------------------------------------------------------------------------------- /lib/api/fila.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Módulo FILA 3 | * @param {object} httpClient 4 | */ 5 | module.exports = function Fila(httpClient) { 6 | 7 | const client = httpClient 8 | 9 | const ROTA_FILA = '/fila' 10 | 11 | /** 12 | * Lista as filas da sua Conta 13 | * @return {Promise} 14 | */ 15 | this.listar = function () { 16 | return client.get(`${ROTA_FILA}`) 17 | } 18 | 19 | /** 20 | * Cria uma nova fila 21 | * @param {string} nome 22 | * @param {string} estrategia_ring 23 | * @param {object} timeout_ring 24 | * @return {Promise} 25 | */ 26 | this.enviar = function (nome, estrategia_ring, timeout_ring=null) { 27 | 28 | const data = { 29 | nome, 30 | estrategia_ring, 31 | timeout_ring 32 | } 33 | 34 | return client.post(ROTA_FILA, Object.assign(data, opcoes)) 35 | } 36 | 37 | /** 38 | * Adiciona um ramal na fila 39 | * @param {string} id 40 | * @param {string} ramal_id 41 | * @return {Promise} 42 | */ 43 | this.addRamal = function (id, ramal_id) { 44 | 45 | const data = { 46 | ramal_id 47 | } 48 | 49 | return client.post(ROTA_FILA, Object.assign(data, opcoes)) 50 | } 51 | 52 | /** 53 | * Busca uma fila pelo seu id 54 | * @param {int} id 55 | * @return {Promise} 56 | */ 57 | this.buscar = function (id) { 58 | return client.get(`${ROTA_FILA}/${id}`) 59 | } 60 | 61 | /** 62 | * Busca um ramal da fila pelo seu id 63 | * @param {int} id 64 | * @return {Promise} 65 | */ 66 | this.buscarRamalFila = function (id, ramal_id) { 67 | return client.get(`${ROTA_FILA}/${id}/${ramal_id}`) 68 | } 69 | 70 | /** 71 | * Atualiza uma fila 72 | * @param {int} id 73 | * @param {object} data 74 | * @return {Promise} 75 | */ 76 | this.atualizarFila = function (id, data) { 77 | return client.put(`${ROTA_FILA}/${id}`, data) 78 | } 79 | 80 | /** 81 | * Remove um Ramal da fila 82 | * @param {int} id 83 | * @return {Promise} 84 | */ 85 | this.excluirRamalFila = function (id, ramal_id) { 86 | return client.delete(`${ROTA_RAMAL}/${id}/${ramal_id}`) 87 | } 88 | 89 | } -------------------------------------------------------------------------------- /lib/api/perfil.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Módulo Perfil 3 | * @param {object} httpClient 4 | */ 5 | module.exports = function Perfil(httpClient) { 6 | 7 | const client = httpClient 8 | 9 | const ROTA_CONTA = '/conta' 10 | const ROTA_WEBHOOK = '/webhook' 11 | const ROTA_SALDO = '/saldo' 12 | 13 | /** 14 | * Consulta saldo atual 15 | * @return {Promise} 16 | */ 17 | this.consultaSaldo = function () { 18 | return client.get(ROTA_SALDO) 19 | } 20 | 21 | /** 22 | * Consulta os dados da minha Conta 23 | * @return {Promise} 24 | */ 25 | this.minhaConta = function () { 26 | return client.get(ROTA_CONTA) 27 | } 28 | 29 | /** 30 | * Atualiza os dados da minha conta 31 | * @param {object} $data 32 | * @return {Promise} 33 | */ 34 | this.atualizaDadosConta = function (data) { 35 | return client.put(ROTA_CONTA, data) 36 | } 37 | 38 | /** 39 | * Gera um relatório com as recargas efetuadas 40 | * @return {Promise} 41 | */ 42 | this.relatorioRecarga = function () { 43 | return client.get(`${ROTA_CONTA}/recargas`) 44 | } 45 | 46 | /** 47 | * Gera uma URL para recarga de créditos 48 | * @param {string} url_retorno 49 | * @return {Promise} 50 | */ 51 | this.urlRecarga = function (url_retorno) { 52 | return client.get(`${ROTA_CONTA}/urlrecarga`, { 53 | params: { 54 | url_retorno 55 | } 56 | }) 57 | } 58 | 59 | /** 60 | * Retorna a lista de webhooks configurados para esta conta 61 | * @return {Promise} 62 | */ 63 | this.webhooks = function () { 64 | return client.get(ROTA_WEBHOOK) 65 | } 66 | 67 | /** 68 | * Apaga um webhook 69 | * @param {string} nome 70 | * @return {Promise} 71 | */ 72 | this.excluirWebhook = function (nome) { 73 | return client.delete(`${ROTA_CONTA}/${nome}`) 74 | } 75 | 76 | /** 77 | * Cadastra ou atualiza um webhook 78 | * @param {string} nome 79 | * @param {string} url 80 | * @return {Promise} 81 | */ 82 | this.salvaWebhook = function (nome, url) { 83 | return client.put(`${ROTA_CONTA}/${nome}`, { 84 | url 85 | }) 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /lib/api/sms.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Módulo SMS 3 | * @param {object} httpClient 4 | */ 5 | module.exports = function Sms(httpClient) { 6 | 7 | const client = httpClient 8 | 9 | const ROTA_SMS = '/sms' 10 | 11 | /** 12 | * Envia um sms para um número destino 13 | * @param {string} numero_destino 14 | * @param {string} mensagem 15 | * @param {bool} resposta_usuario 16 | * @param {bool} multi_sms 17 | * @param {string} data_criacao 18 | * @return {Promise} 19 | */ 20 | this.enviar = function (numero_destino, mensagem, resposta_usuario, multi_sms, data_criacao) { 21 | return client.post(ROTA_SMS, { 22 | numero_destino, 23 | mensagem, 24 | resposta_usuario, 25 | multi_sms, 26 | data_criacao 27 | }) 28 | } 29 | 30 | /** 31 | * Busca um sms pelo seu ID 32 | * @param {int} id 33 | * @return {Promise} 34 | */ 35 | this.buscar = function (id) { 36 | return client.get(`${ROTA_SMS}/${id}`) 37 | } 38 | 39 | /** 40 | * Relatório de mensagens de Sms 41 | * @param {string} data_inicio 42 | * @param {string} data_fim 43 | * @return {Promise} 44 | */ 45 | this.relatorio = function (data_inicio, data_fim) { 46 | return client.get(`${ROTA_SMS}/relatorio`, { 47 | params: { 48 | data_inicio, 49 | data_fim 50 | } 51 | }) 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /lib/api/status.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Módulo Status 3 | * @param {object} httpClient 4 | */ 5 | module.exports = function Status(httpClient) { 6 | 7 | const client = httpClient 8 | 9 | const ROTA_STATUS = '/status' 10 | 11 | /** 12 | * Verifica o status da API 13 | * @return {Promise} 14 | */ 15 | this.verificar = function () { 16 | return client.get(ROTA_STATUS) 17 | } 18 | 19 | /** 20 | * Consulta o status de um serviço 21 | * @param {string} nome 22 | * @return {Promise} 23 | */ 24 | this.consultar = function (nome) { 25 | return client.get(`${ROTA_STATUS}/${nome}`) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /lib/api/tts.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Módulo TTS 3 | * @param {object} httpClient 4 | */ 5 | module.exports = function Tts(httpClient) { 6 | 7 | const client = httpClient 8 | 9 | const ROTA_TTS = '/tts' 10 | 11 | /** 12 | * Envia um TTS (text-to-speach) para um número destino 13 | * @param {string} numero_destino 14 | * @param {string} mensagem 15 | * @param {object} opcoes 16 | * @return {Promise} 17 | */ 18 | this.enviar = function (numero_destino, mensagem, opcoes) { 19 | 20 | const data = { 21 | numero_destino, 22 | mensagem 23 | } 24 | 25 | return client.post(ROTA_TTS, Object.assign(data, opcoes)) 26 | } 27 | 28 | /** 29 | * Busca um tts pelo seu ID 30 | * @param {int} id 31 | * @return {Promise} 32 | */ 33 | this.buscar = function (id) { 34 | return client.get(`${ROTA_TTS}/${id}`) 35 | } 36 | 37 | /** 38 | * Relatório de mensagens de Tts 39 | * @param {string} data_inicio 40 | * @param {string} data_fim 41 | * @return {Promise} 42 | */ 43 | this.relatorio = function (data_inicio, data_fim) { 44 | return client.get(`${ROTA_TTS}/relatorio`, { 45 | params: { 46 | data_inicio, 47 | data_fim 48 | } 49 | }) 50 | } 51 | } -------------------------------------------------------------------------------- /lib/api/verificacao.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Módulo Verificacao 3 | * @param {object} httpClient 4 | */ 5 | module.exports = function Verificacao(httpClient) { 6 | 7 | const client = httpClient 8 | 9 | const ROTA_VERIFICACAO = '/verificacao' 10 | 11 | this.enviar = function (numero_destino, nome_produto, tamanho, tts) { 12 | return client.post(ROTA_VERIFICACAO, { 13 | numero_destino, 14 | nome_produto, 15 | tamanho, 16 | tts 17 | }) 18 | } 19 | 20 | this.buscar = function (id, pin) { 21 | return client.get(`${ROTA_VERIFICACAO}`, { 22 | params: { 23 | id, 24 | pin 25 | } 26 | }) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /lib/client.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios') 2 | const defaultResolve = require('./interceptor').defaultResolve 3 | const defaultReject = require('./interceptor').defaultReject 4 | 5 | /** 6 | * Módulo Client 7 | */ 8 | module.exports = function Client(baseURL, options, resolve = defaultResolve, reject = defaultReject) { 9 | const URL = baseURL || "https://voice-api.zenvia.com"; 10 | let params = Object.assign({ 11 | baseURL: URL, 12 | timeout: 5000 13 | }, options); 14 | const instance = axios.create(params); 15 | instance.interceptors.response.use(resolve, reject); 16 | return instance 17 | } -------------------------------------------------------------------------------- /lib/interceptor.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | defaultResolve (data) { 3 | return Promise.resolve(data.data) 4 | }, 5 | defaultReject (error) { 6 | return Promise.reject({ 7 | message: error.message, 8 | code: error.code, 9 | data: error.response.data 10 | }) 11 | } 12 | } -------------------------------------------------------------------------------- /lib/totalvoice.js: -------------------------------------------------------------------------------- 1 | const Client = require('./client'); 2 | const Chamada = require('./api/chamada'); 3 | const Audio = require('./api/audio'); 4 | const Bina = require('./api/bina'); 5 | const Perfil = require('./api/perfil'); 6 | const Conta = require('./api/conta'); 7 | const Composto = require('./api/composto'); 8 | const Conferencia = require('./api/conferencia'); 9 | const SMS = require('./api/sms'); 10 | const TTS = require('./api/tts'); 11 | const Central = require('./api/central'); 12 | const DID = require('./api/did'); 13 | const Status = require('./api/status'); 14 | const Fila = require('./api/fila'); 15 | const Verificacao = require('./api/verificacao'); 16 | const pack = require('../package.json'); 17 | /** 18 | * Módulo TotalVoice 19 | * @param {string} accessToken 20 | * @param {string} baseUrl 21 | * @param {object} options 22 | */ 23 | function Totalvoice(accessToken, baseUrl, options) { 24 | options = options || {}; 25 | let env = options.env || process.env; 26 | 27 | let opts = Object.assign({}, options); 28 | let token = accessToken || env.TOTALVOICE_ACCESS_TOKEN; 29 | if (!token) { 30 | throw new Error('Access Token inválido!'); 31 | } 32 | 33 | opts['headers'] = { 34 | 'Access-Token': token, 35 | 'Content-Type': 'application/json', 36 | 'User-Agent': `lib-node/${pack.version}` 37 | }; 38 | 39 | this.httpClient = opts.httpClient || new Client(baseUrl, opts); 40 | 41 | this._chamada = undefined; 42 | this._audio = undefined; 43 | this._bina = undefined; 44 | this._perfil = undefined; 45 | this._conta = undefined; 46 | this._composto = undefined; 47 | this._conferencia = undefined; 48 | this._sms = undefined; 49 | this._tts = undefined; 50 | this._central = undefined; 51 | this._did = undefined; 52 | this._status = undefined; 53 | this._fila = undefined; 54 | this._verificacao = undefined; 55 | } 56 | 57 | Object.defineProperty(Totalvoice.prototype, 58 | 'chamada', { 59 | get: function() { 60 | this._chamada = this._chamada || new Chamada(this.httpClient); 61 | return this._chamada; 62 | } 63 | }); 64 | 65 | Object.defineProperty(Totalvoice.prototype, 66 | 'audio', { 67 | get: function() { 68 | this._audio = this._audio || new Audio(this.httpClient); 69 | return this._audio; 70 | } 71 | }); 72 | 73 | Object.defineProperty(Totalvoice.prototype, 74 | 'bina', { 75 | get: function() { 76 | this._bina = this._bina || new Bina(this.httpClient); 77 | return this._bina; 78 | } 79 | }); 80 | 81 | Object.defineProperty(Totalvoice.prototype, 82 | 'perfil', { 83 | get: function() { 84 | this._perfil = this._perfil || new Perfil(this.httpClient); 85 | return this._perfil; 86 | } 87 | }); 88 | 89 | Object.defineProperty(Totalvoice.prototype, 90 | 'conta', { 91 | get: function() { 92 | this._conta = this._conta || new Conta(this.httpClient); 93 | return this._conta; 94 | } 95 | }); 96 | 97 | Object.defineProperty(Totalvoice.prototype, 98 | 'composto', { 99 | get: function() { 100 | this._composto = this._composto || new Composto(this.httpClient); 101 | return this._composto; 102 | } 103 | }); 104 | 105 | Object.defineProperty(Totalvoice.prototype, 106 | 'conferencia', { 107 | get: function() { 108 | this._conferencia = this._conferencia || new Conferencia(this.httpClient); 109 | return this._conferencia; 110 | } 111 | }); 112 | 113 | Object.defineProperty(Totalvoice.prototype, 114 | 'sms', { 115 | get: function() { 116 | this._sms = this._sms || new SMS(this.httpClient); 117 | return this._sms; 118 | } 119 | }); 120 | 121 | Object.defineProperty(Totalvoice.prototype, 122 | 'tts', { 123 | get: function() { 124 | this._tts = this._tts || new TTS(this.httpClient); 125 | return this._tts; 126 | } 127 | }); 128 | 129 | Object.defineProperty(Totalvoice.prototype, 130 | 'central', { 131 | get: function() { 132 | this._central = this._central || new Central(this.httpClient); 133 | return this._central; 134 | } 135 | }); 136 | 137 | Object.defineProperty(Totalvoice.prototype, 138 | 'did', { 139 | get: function() { 140 | this._did = this._did || new DID(this.httpClient); 141 | return this._did; 142 | } 143 | }); 144 | 145 | Object.defineProperty(Totalvoice.prototype, 146 | 'status', { 147 | get: function() { 148 | this._status = this._status || new Status(this.httpClient); 149 | return this._status; 150 | } 151 | }); 152 | 153 | Object.defineProperty(Totalvoice.prototype, 154 | 'fila', { 155 | get: function() { 156 | this._fila = this._fila || new Fila(this.httpClient); 157 | return this._fila; 158 | } 159 | }); 160 | 161 | Object.defineProperty(Totalvoice.prototype, 162 | 'verificacao', { 163 | get: function() { 164 | this._verificacao = this._verificacao || new Verificacao(this.httpClient); 165 | return this._verificacao; 166 | } 167 | }); 168 | 169 | module.exports = Totalvoice; 170 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "totalvoice-node", 3 | "version": "1.12.0", 4 | "description": "API de comunicação com os serviços da TotalVoice (http://totalvoice.com.br)", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "jest" 8 | }, 9 | "jest": { 10 | "verbose": true, 11 | "testURL": "http://localhost" 12 | }, 13 | "repository": { 14 | "type": "git", 15 | "url": "git+https://github.com/totalvoice/totalvoice-node.git" 16 | }, 17 | "keywords": [ 18 | "totalvoice", 19 | "sms", 20 | "node", 21 | "lib", 22 | "api", 23 | "voip", 24 | "tts", 25 | "centrais", 26 | "ramais", 27 | "sip", 28 | "did" 29 | ], 30 | "author": "Diego Wagner ", 31 | "license": "MIT", 32 | "bugs": { 33 | "url": "https://github.com/totalvoice/totalvoice-node/issues" 34 | }, 35 | "homepage": "https://github.com/totalvoice/totalvoice-node#readme", 36 | "dependencies": { 37 | "axios": "^0.21.1" 38 | }, 39 | "devDependencies": { 40 | "babel-cli": "^6.26.0", 41 | "babel-preset-es2015": "^6.24.1", 42 | "babel-preset-stage-2": "^6.24.1", 43 | "jest": "^24.8.0" 44 | } 45 | } 46 | --------------------------------------------------------------------------------