totalvoice csharp
Versão 1.2.1
Client C# For the API of Totalvoice
Functionality
Pre -requirements
Use
To use this library, you must first register on the Total Voice website. After the creation of the registration will be made available an AccessoStoken for access to the API.
With AccessSstoken in hand it will be possible to make the consultations/registrations according to API documentation
Installing with Nuget Package Manager
PM> Install-Package TotalVoice -Version 1.0.1
or .NET CLI
dotnet add package TotalVoice --version 1.0.1
Here are some examples of how this library can be used.
Make a telephone call between two numbers: a and b
namespace Teste
{
class Program
{
static void Main ( string [ ] args )
{
TotalVoiceClient client = new TotalVoiceClient ( "access-token" ) ;
Chamada chamada = new Chamada ( client ) ;
var json = new {
numero_origem = "48988888888" ,
numero_destino = "48999999999"
} ;
string response = chamada . Ligar ( json ) ;
System . Diagnostics . Debug . WriteLine ( response ) ;
}
}
} CALL CONSULTATION BY ID
namespace Teste
{
class Program
{
static void Main ( string [ ] args )
{
TotalVoiceClient client = new TotalVoiceClient ( "access-token" ) ;
Chamada chamada = new Chamada ( client ) ;
string response = chamada . Buscar ( 123 ) ;
System . Diagnostics . Debug . WriteLine ( response ) ;
}
}
} Send an SMS
namespace Teste
{
class Program
{
static void Main ( string [ ] args )
{
TotalVoiceClient client = new TotalVoiceClient ( "access-token" ) ;
Sms sms = new Sms ( client ) ;
var json = new {
numero_destino = "48999999999" ,
mensagem = "Mensagem de teste"
} ;
string response = sms . Enviar ( json ) ;
System . Diagnostics . Debug . WriteLine ( response ) ;
}
}
} Search for the data of an SMS by the ID
namespace Teste
{
class Program
{
static void Main ( string [ ] args )
{
TotalVoiceClient client = new TotalVoiceClient ( "access-token" ) ;
Sms sms = new Sms ( client ) ;
string response = sms . Buscar ( 123 ) ;
System . Diagnostics . Debug . WriteLine ( response ) ;
}
}
} Send a TTS
namespace Teste
{
class Program
{
static void Main ( string [ ] args )
{
TotalVoiceClient client = new TotalVoiceClient ( "access-token" ) ;
Tts tts = new Tts ( client ) ;
var json = new {
numero_destino = "48999999999" ,
mensagem = "Mensagem de TTS"
} ;
string response = tts . Enviar ( json ) ;
System . Diagnostics . Debug . WriteLine ( response ) ;
}
}
} Number validation
namespace Teste
{
class Program
{
static void Main ( string [ ] args )
{
TotalVoiceClient client = new TotalVoiceClient ( "access-token" ) ;
ValidaNumero validacao = new ValidaNumero ( client ) ;
var json = new {
numero_destino = "48999999999" ,
gravar_audio = true ,
bina = "48808880804" ,
max_tentativas = 1
} ;
string response = validacao . Enviar ( json ) ;
System . Diagnostics . Debug . WriteLine ( response ) ;
}
}
} Send a compound
namespace Teste
{
class Program
{
static void Main ( string [ ] args )
{
TotalVoiceClient client = new TotalVoiceClient ( "access-token" ) ;
Composto composto = new Composto ( client ) ;
var json = new {
numero_destino = "48988888888" ,
dados = new [ ] {
new {
acao = "tts" ,
acao_dados = new {
mensagem = "O número digitado não consta em nosso cadastro. Por gentileza, tente novamente" ,
tipo_voz = "br-Ricardo"
}
} ,
new {
acao = "audio" ,
acao_dados = new {
url_audio = "https://minhaurl.com.br/audio.mp3"
}
}
} ,
gravar_audio = false ,
bina = "48988888888" ,
tags = "clienteX" ,
detecta_caixa = false
} ;
string response = composto . Enviar ( json ) ;
System . Diagnostics . Debug . WriteLine ( response ) ;
}
}
}License
This library follows MIT's terms of use