npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

totalvoice-node

v1.12.0

Published

API de comunicação com os serviços da TotalVoice (http://totalvoice.com.br)

Downloads

847

Readme

totalvoice-node

Cliente em NodeJS para API da Totalvoice

Build Status

Funcionalidades

  • [X] Gerenciamento das chamadas
  • [X] Consulta e envio de SMS
  • [X] Consulta e envio de TTS
  • [X] Consulta e envio de Audio
  • [X] Gerenciamento da Conta
  • [X] Gerenciamento da Central

Requisitos

  • NodeJS 6 ou superior

Instalação

npm install --save totalvoice-node

ou

yarn add totalvoice-node

Utilização

Para utilizar esta biblioteca, primeiramente você deverá realizar um cadastro no site da Total Voice. Após a criação do cadastro será disponibilizado um AccessToken para acesso a API.

Com o AccessToken em mãos será possível realizar as consultas/cadastros conforme documentação da API

Os métodos da API que poderão ser invocados:

  • audio
  • central
  • chamada
  • composto
  • conferencia
  • conta
  • perfil
  • sms
  • tts

A seguir exemplos de como pode ser utilizada esta biblioteca.

Realiza uma chamada telefônica entre dois números: A e 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)
    });
Consulta de chamada pelo 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)
    });
Encerra uma chamada ativa

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)
    });
Envio de 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)
    });
Envio de 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)
    });
Envio de 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)
    });
Configurações de central telefonica

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)
    });
Gerenciamento dos dados da Conta

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)
    });
Consulta saldo da Minha Conta

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)
    });
Caso você necessite utilizar seu próprio endereço configurado na Total Voice

const totalvoice = require('totalvoice-node');
const client = new totalvoice("access-token", "https://seu-dominio.com.br");
...
Caso você necessite utilizar com 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);
...

Mais informações sobre os métodos disponíveis podem ser encontrados na documentação da API

Contribua!

Quer contribuir? clique aqui

Licença

Esta biblioteca segue os termos de uso da MIT