SDK oficial da Integrax para .NET 8.0+ — SMS, RCS, OTP e consultas via API.
- Crie uma conta gratuita em integrax.app
- Após o cadastro, acesse o menu API e crie um token
Pronto, você já pode integrar!
Se receber
MESSAGE_NOT_ALLOWED, entre em contato com o suporte pelo WhatsApp e solicite a liberação.
dotnet add package IntegraxOu adicione ao .csproj:
<PackageReference Include="Integrax" Version="1.0.0" />using Integrax;
using var ix = new IntegraxClient("seu-token-aqui");
// Enviar SMS
var res = await ix.Sms.SendAsync(["5511999999999"], "Pedido confirmado!");
Console.WriteLine(res.Data?[0].MessageId);// Envio simples
var res = await ix.Sms.SendAsync(["5511999999999"], "Pedido confirmado");
// Multiplos destinatarios
var res = await ix.Sms.SendAsync(
["5511999999999", "5511988888888"],
"Promocao especial!"
);
// Com shortcode customizado
var res = await ix.Sms.SendAsync(
["5511999999999"],
"Ola!",
from: "29094"
);// Envio minimo (usa defaults: 6 digitos, numerico, expira em 10 min)
var res = await ix.Otp.SendAsync("5511999999999");
// Personalizado: 5 digitos, alfanumerico, expira em 5 minutos
var res = await ix.Otp.SendAsync(
"5511999999999",
qtdDigits: 5,
withText: true,
expiresIn: 5
);
// Com mensagem customizada
var res = await ix.Otp.SendAsync(
"5511999999999",
messageDefault: "Use [code] para confirmar sua conta"
);
// Verificar codigo
var verify = await ix.Otp.VerifyAsync("1MP5L", "5511999999999");
if (verify.Status == "verified")
{
Console.WriteLine("Codigo valido!");
}// Mensagem BASIC
var res = await ix.Rcs.SendAsync(
["5511999999999"],
"Ola! Mensagem RCS basica.",
"IntegraX",
rcsType: "BASIC"
);
// Mensagem RICH com card
var res = await ix.Rcs.SendAsync(
["5511999999999"],
"Confira nossa oferta!",
"IntegraX",
rcsMessage: new
{
card = new
{
title = "Black Friday",
description = "Ate 60% OFF.",
media = new
{
file = new { url = "https://exemplo.com/banner.png" },
height = "MEDIUM"
},
suggestions = new[]
{
new
{
type = "OPEN_URL",
text = "Ver ofertas",
url = "https://exemplo.com/ofertas",
postbackData = "click_ofertas"
}
}
}
}
);var balance = await ix.Credits.BalanceAsync();
Console.WriteLine($"Saldo: {balance.Credits}");// Consulta por CPF
var res = await ix.Consult.CpfAsync(["00000000001"]);
// CPF com telefones validos e restricoes
var res = await ix.Consult.CpfAsync(
["00000000001"],
showPhoneValid: true,
showRestrictions: true
);
// Consulta por telefone
var res = await ix.Consult.PhoneAsync(["551199999999"]);
// Consulta premium por telefone
var res = await ix.Consult.PhonePremiumAsync(["551199999999"]);- Para números de outros países, insira
+na frente do número (ex:+34992000000). - Para envios internacionais, é necessário solicitar a ativação da rota através do suporte.
- Alguns países permitem
frompersonalizado. Se permitido, basta informar ofromno payload.
try
{
var res = await ix.Sms.SendAsync(["5511999999999"], "Teste");
}
catch (IntegraxException ex)
{
Console.WriteLine($"Status: {ex.Status}");
Console.WriteLine($"Mensagem: {ex.Message}");
Console.WriteLine($"Codigo: {ex.ErrorCode}");
Console.WriteLine($"Body: {ex.Body}");
}Todos os metodos aceitam CancellationToken como ultimo parametro:
using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10));
var res = await ix.Sms.SendAsync(["5511999999999"], "Teste", ct: cts.Token);Voce pode injetar seu proprio HttpClient (util com IHttpClientFactory):
var httpClient = httpClientFactory.CreateClient("integrax");
using var ix = new IntegraxClient("seu-token", httpClient: httpClient);| Servico | Metodo | Descricao |
|---|---|---|
Sms |
SendAsync |
Envia SMS para um ou mais numeros |
Otp |
SendAsync |
Envia codigo OTP via SMS |
Otp |
VerifyAsync |
Valida um codigo OTP |
Rcs |
SendAsync |
Envia mensagem RCS (BASIC/RICH) |
Credits |
BalanceAsync |
Consulta saldo de creditos |
Consult |
CpfAsync |
Consulta dados por CPF |
Consult |
PhoneAsync |
Consulta dados por telefone |
Consult |
PhonePremiumAsync |
Consulta premium por telefone |
MIT