Onurix API v1.0.0
Desplácese hacia abajo para ver ejemplos de código, solicitudes de ejemplo y respuestas. Seleccione un idioma para las muestras de código de las pestañas de arriba o del menú de navegación móvil.
Aqui se describe el API -REST a fin de enviar mensajes de texto por medio de la plataforma https://www.onurix.com, para utilizarlos usted previamente debe haber permitido la IP del servidor donde se va a ejecutar el script que va a consumir el API, el key key
y codigo de client client
siempre debe enviarse en cada petición, para realizar la configuracion de la IP y consultar estos parametros ingrese a su cuenta menu Seguridad.
Base URLs:
Url del repositorio de github:
Email: Support
Balance
Consulta el numero disponible de creditos de una cuenta
Obtiene el balance de una cuenta
Code samples
# También puede usar wget
curl -X GET "https://www.onurix.com/api/v1/balance?client=AQUI_SU_CLIENT_ID&key=AQUI_SU_KEY"
<?php
// Ejecutar: composer require guzzlehttp/guzzle:*
require'vendor/autoload.php';
$headers=array(
'Content-Type'=>'application/x-www-form-urlencoded',
'Accept'=>'application/json',
);
$client= new \GuzzleHttp\Client();
try{
$response=$client->request('GET','https://www.onurix.com/api/v1/balance?client=AQUI_SU_CLIENT&key=AQUI_SU_KEY',
array(
'headers'=>$headers,
)
);
print_r($response->getBody()->getContents());
}
catch(\GuzzleHttp\Exception\BadResponseException $e){
// Manejar excepciones o errores de API
print_r($e->getMessage());
}
import requests
headers ={
'Content-Type':'application/x-www-form-urlencoded',
'Accept':'application/json'
}
r = requests.get('https://www.onurix.com/api/v1/balance?client=AQUI_SU_CLIENT&key=AQUI_SU_KEY', headers = headers)
print(r.json())
//Este codigo fue hecho en .net 6
namespace PruebaOnurix
{
public class Program
{
public static void Main(string[] args)
{
GetBalance("AQUI_SU_CLIENT", "AQUI_SU_KEY");
}
public static void GetBalance(string client, string key)
{
using var httpClient = new HttpClient()
{
BaseAddress = new Uri("https://www.onurix.com"),
};
HttpResponseMessage request = httpClient.GetAsync($"api/v1/balance?client={client}&key={key}").Result;
string responseString = request.Content.ReadAsStringAsync().Result;
if(!String.IsNullOrEmpty(responseString))
{
BalanceResponse balance = JsonConvert.DeserializeObject<BalanceResponse>(responseString);
}
}
}
}
package main
import (
"fmt"
"io/ioutil"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/x-www-form-urlencoded"},
"Accept": []string{"application/json"},
}
req, err := http.NewRequest("GET", "https://www.onurix.com/api/v1/balance?client=AQUI_SU_CLIENT&key=AQUI_SU_KEY", nil)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
// Ejecutar: npm install request --save
var requests = require("request");
var options = {
method: 'GET',
url: 'https://www.onurix.com/api/v1/balance?key=AQUI_SU_KEY&client=AQUI_SU_CLIENT',
headers:{ 'content-type': 'application/x-www-form-urlencoded' },
};
var test = requests(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
//Para este codigo se uso jdk 11
import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Balance {
public static void main(String[] args) throws IOException, InterruptedException {
// TODO Auto-generated method stub
var httpClient = HttpClient.newHttpClient();
var request = HttpRequest.newBuilder(URI.create("https://www.onurix.com/api/v1/balance?client=AQUI_SU_CLIENT_ID&key=AQUI_SU_KEY")).build();
var response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
//System.out.println(response.body());
}
}
GET /balance
Body parameter
client:0
key: stringstri
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | object | true | none |
» client | body | integer(int64) | true | El Id del cliente |
» key | body | string | true | Key de la cuenta Onurix |
Example responses
200 Response
{
"status":0
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Operación exitosa | ResponseBalance |
520 | Unknown | Parametros invalidos | ErrorResponseBalance |
Security
Bloquea un numero de telefono para que el sistema no envie mensajes de texto SMS
Bloquea un numero de telefono para evitar enviar mensajes
Code samples
# También puede usar wget
curl -X POST "https://www.onurix.com/api/v1/block-phone" -d key="AQUI_SU_KEY" -d client="AQUI_SU_CLIENT" -d phone="AQUI_EL_NUMERO_DE_CELULAR" -d name="AQUI_NOMBRE_CONTACTO" -H 'Content-Type: application/x-www-form-urlencoded' -H 'Accept: application/json'
<?php
// Ejecutar: composer require guzzlehttp/guzzle:*
require'vendor/autoload.php';
$headers=array(
'Content-Type'=>'application/x-www-form-urlencoded',
'Accept'=>'application/json',
);
$client= new \GuzzleHttp\Client();
// Define la matriz del cuerpo de la solicitud.
$request_body=array(
"client"=>"AQUI_SU_CLIENT",
"key"=>"AQUI_SU_KEY",
"phone"=>"AQUI_EL_NUMERO_DE_CELULAR",
"name"=>"AQUI_NOMBRE_CONTACTO");
try{
$response=$client->request('POST','https://www.onurix.com/api/v1/block-phone',
array('headers'=>$headers,'form_params'=>$request_body,));
print_r($response->getBody()->getContents());
}
catch(\GuzzleHttp\Exception\BadResponseException $e){
// Manejar excepciones o errores de API
print_r($e->getMessage());
}
import requests
headers ={
'Content-Type':'application/x-www-form-urlencoded',
'Accept':'application/json'
}
data = {
'client':'AQUI_SU_CLIENT',
'key':'AQUI_SU_KEY',
'phone':'AQUI_EL_NUMERO_DE_CELULAR',
'name':'AQUI_NOMBRE_CONTACTO'
}
r = requests.post('https://www.onurix.com/api/v1/block-phone', headers = headers, data = data)
print(r.json())
//Este codigo fue hecho en .net 6
namespace PruebaOnurix
{
public class Program
{
public static void Main(string[] args)
{
Dictionary<string, string> parameters = new()
{
{ "client", "AQUI_SU_CLIENT"},
{ "key", "AQUI_SU_KEY"},
{ "phone", "AQUI_EL_NUMERO_DE_CELULAR"},
{ "name", "AQUI_NOMBRE_CONTACTO"}
};
BlockPhone(parameters);
}
public static void BlockPhone(Dictionary<string,string> parameters)
{
using var httpClient = new HttpClient()
{
BaseAddress = new Uri("https://www.onurix.com"),
};
HttpResponseMessage request = httpClient.PostAsync("api/v1/block-phone", new FormUrlEncodedContent(parameters)).Result;
string responseString = request.Content.ReadAsStringAsync().Result;
}
}
}
package main
import (
"fmt"
"io/ioutil"
"net/http"
"strings"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/x-www-form-urlencoded"},
"Accept": []string{"application/json"},
}
data := strings.NewReader("client=AQUI_SU_CLIENT&key=AQUI_SU_KEY&phone=AQUI_EL_NUMERO_DE_CELULAR&name=AQUI_NOMBRE_CONTACTO")
req, err := http.NewRequest("POST", "https://www.onurix.com/api/v1/block-phone", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
// Ejecutar: npm install request --save
var requests = require("request");
var options = {
method: 'POST',
url: 'https://www.onurix.com/api/v1/block-phone',
headers: { 'content-type': 'application/x-www-form-urlencoded'},
formData: {
key:'AQUI_SU_KEY',
client:'AQUI_SU_CLIENT',
phone:'AQUI_EL_NUMERO_DE_CELULAR',
name:'AQUI_NOMBRE_CONTACTO'
}
};
var test = requests(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
//Para este codigo se uso jdk 11
import java.io.IOException;
import java.net.URI;
import java.net.URLEncoder;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
public class Security {
public static void main(String[] args) throws IOException, InterruptedException {
// TODO Auto-generated method stub
Map<String,String> parameters = new HashMap<>();
parameters.put("client", "AQUI_SU_CLIENT");
parameters.put("key", "AQUI_SU_KEY");
parameters.put("phone", "AQUI_EL_NUMERO_DE_CELULAR");
parameters.put("name", "AQUI_NOMBRE_CONTACTO");
var httpClient = HttpClient.newHttpClient();
var request = HttpRequest.newBuilder()
.POST(ofFormData(parameters))
.uri(URI.create("https://www.onurix.com/api/v1/block-phone"))
.header("Content-Type", "application/x-www-form-urlencoded")
.build();
var response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
//System.out.println(response.body());
}
public static HttpRequest.BodyPublisher ofFormData(Map<String, String> parameters) {
var builder = new StringBuilder();
for (Entry<String, String> entry : parameters.entrySet()) {
if (builder.length() > 0) {
builder.append("&");
}
builder.append(URLEncoder.encode(entry.getKey().toString(), StandardCharsets.UTF_8));
builder.append("=");
builder.append(URLEncoder.encode(entry.getValue().toString(), StandardCharsets.UTF_8));
}
return HttpRequest.BodyPublishers.ofString(builder.toString());
}
}
POST /block-phone
Body parameter
client:0
key: stringstri
phone: stringstri
name: string
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | object | true | none |
» client | body | integer(int64) | true | El Id del cliente |
» key | body | string | true | Key de la cuenta Onurix |
» phone | body | string | true | Numero de telefono a bloquear |
» name | body | string | false | Nombre del contacto a bloquear |
Example responses
200 Response
{
"id":"string",
"status":"string",
"phone":"string",
"name":"string"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Operación exitosa | ResponseSecurity |
520 | Unknown | Parametros invalidos | ErrorResponseSecurity |
SMS
Envia un mensaje SMS a cada numero de telefono suministrado
Envia un mensaje de texto
Code samples
curl -X POST "https://www.onurix.com/api/v1/send-sms" -d key="AQUI_SU_KEY" -d client="AQUI_SU_CLIENT" -d phone="AQUI_EL_NUMERO_DE_CELULAR" -d sms="AQUI_EL_SMS_A_ENVIAR" -d country-code="CO" -H 'Content-Type: application/x-www-form-urlencoded' -H 'Accept: application/json'
<?php
// Ejecutar: composer require guzzlehttp/guzzle:*
require'vendor/autoload.php';
$headers=array(
'Content-Type'=>'application/x-www-form-urlencoded',
'Accept'=>'application/json',
);
$client= new \GuzzleHttp\Client();
// Define la matriz del cuerpo de la solicitud.
$request_body = array(
"client"=>"AQUI_SU_CLIENT",
"key"=>"AQUI_SU_KEY",
"phone"=>"AQUI_EL_NUMERO_DE_CELULAR",
"sms"=>"AQUI_EL_SMS_A_ENVIAR",
"country-code"=>"CO");
try{
$response=$client->request('POST','https://www.onurix.com/api/v1/send-sms',array(
'headers'=>$headers,
'form_params'=>$request_body,
)
);
print_r($response->getBody()->getContents());
}
catch(\GuzzleHttp\Exception\BadResponseException $e){
// Manejar excepciones o errores de API
print_r($e->getMessage());
}
import requests
headers ={
'Content-Type':'application/x-www-form-urlencoded',
'Accept':'application/json'
}
data = {
'client':'AQUI_SU_CLIENT',
'key':'AQUI_SU_KEY',
'phone':'AQUI_EL_NUMERO_DE_CELULAR',
'sms':'AQUI_EL_SMS_A_ENVIAR',
'country-code':'CO'}
r = requests.post('https://www.onurix.com/api/v1/send-sms', headers = headers, data = data)
print(r.json())
//Este codigo fue hecho en .net 6
namespace PruebaOnurix
{
public class Program
{
public static void Main(string[] args)
{
Dictionary<string, string> parameters = new()
{
{ "client", "AQUI_SU_CLIENT"},
{ "key", "AQUI_SU_KEY"},
{ "phone", "AQUI_EL_NUMERO_DE_CELULAR"},
{ "sms","AQUI_EL_SMS_A_ENVIAR"},
{ "country-code","CO"}
};
SendSMS(parameters);
}
public static void SendSMS(Dictionary<string,string> parameters)
{
using var httpClient = new HttpClient()
{
BaseAddress = new Uri("https://www.onurix.com"),
};
HttpResponseMessage request = httpClient.PostAsync("/api/v1/send-sms", new FormUrlEncodedContent(parameters)).Result;
string responseString = request.Content.ReadAsStringAsync().Result;
}
}
}
package main
import (
"fmt"
"io/ioutil"
"net/http"
"strings"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/x-www-form-urlencoded"},
"Accept": []string{"application/json"},
}
data := strings.NewReader("client=AQUI_SU_CLIENT&key=AQUI_SU_KEY&phone=AQUI_EL_NUMERO_DE_CELULAR&sms=AQUI_EL_SMS_A_ENVIAR&country-code=CO")
req, err := http.NewRequest("POST", "https://www.onurix.com/api/v1/send-sms", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
// Ejecutar: npm install request --save
var requests = require("request");
var options = {
method: 'POST',
url: 'https://www.onurix.com/api/v1/send-sms',
headers: { 'content-type': 'application/x-www-form-urlencoded'},
formData: {
key:'AQUI_SU_KEY',
client:'AQUI_SU_CLIENT',
phone:'AQUI_EL_NUMERO_DE_CELULAR',
sms:'AQUI_EL_SMS_A_ENVIAR',
'country-code':'CO'
}
};
var test = requests(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
//Para este codigo se uso jdk 11
import java.io.IOException;
import java.net.URI;
import java.net.URLEncoder;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
public class SendSMS {
public static void main(String[] args) throws IOException, InterruptedException {
// TODO Auto-generated method stub
Map<String,String> parameters = new HashMap<>();
parameters.put("client", "AQUI_SU_CLIENT");
parameters.put("key", "AQUI_SU_KEY");
parameters.put("phone", "AQUI_EL_NUMERO_DE_CELULAR");
parameters.put("sms", "AQUI_EL_SMS_A_ENVIAR");
parameters.put("country-code", "CO");
var httpClient = HttpClient.newHttpClient();
var request = HttpRequest.newBuilder()
.POST(ofFormData(parameters))
.uri(URI.create("https://www.onurix.com/api/v1/send-sms"))
.header("Content-Type", "application/x-www-form-urlencoded")
.build();
var response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
//System.out.println(response.body());
}
public static HttpRequest.BodyPublisher ofFormData(Map<String, String> parameters) {
var builder = new StringBuilder();
for (Entry<String, String> entry : parameters.entrySet()) {
if (builder.length() > 0) {
builder.append("&");
}
builder.append(URLEncoder.encode(entry.getKey().toString(), StandardCharsets.UTF_8));
builder.append("=");
builder.append(URLEncoder.encode(entry.getValue().toString(), StandardCharsets.UTF_8));
}
return HttpRequest.BodyPublishers.ofString(builder.toString());
}
}
POST /send-sms
Body parameter
client:0
key: stringstri
country-code: CO
phone: stringstri
sms: stringstri
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | object | true | none |
» client | body | integer(int64) | true | El Id del cliente |
» key | body | string | true | Key de la cuenta Onurix |
» country-code | body | string | false | Codigo ISO 3166, para Colombia enviar “CO” |
» phone | body | string | true | Numero o numeros de telefono separados por coma ejemplo “573150123456” ó “573150123456,573150012345” |
» sms | body | string | true | Mensaje de texto a enviar a los numeros de telefono |
Example responses
200 Response
{
"id":"string",
"status":0,
"data":[
{
"id":"string",
"status":"string",
"credits":0,
"sms":"string",
"phone":"string"
}
]
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Operación exitosa | ResponseSMS |
520 | Unknown | Parametros invalidos | ErrorResponse |
Call
Genera una llamada con cada numero de telefono proporcionado
Genera una llamada con cada numero de telefono proporcionado
Code samples
# También puede usar wget
curl -X POST "https://www.onurix.com/api/v1/call/send" -d key="AQUI_SU_KEY" -d client="AQUI_SU_CLIENT" -d phone="AQUI_EL_NUMERO_DE_CELULAR" -d message="AQUI_EL_MENSAJE_A_ENVIAR" -d voice="AQUI_TIPO_DE_VOZ" -d retries="AQUI_NUMERO_DE_INTENTOS" -d country-code="CO" -d leave-voicemail="AQUI_CONFIRMACION_BUZON_DE_VOZ" -d audio-code="AQUI_ID_AUDIO" -H 'Content-Type: application/x-www-form-urlencoded' -H 'Accept: application/json'
<?php
// Ejecutar: composer require guzzlehttp/guzzle:*
require'vendor/autoload.php';
$headers=array(
'Content-Type'=>'application/x-www-form-urlencoded',
'Accept'=>'application/json',
);
$client= new \GuzzleHttp\Client();
// Define la matriz del cuerpo de la solicitud.
$request_body = array(
"client"=>"AQUI_SU_CLIENT",
"key"=>"AQUI_SU_KEY",
"phone"=>"AQUI_EL_NUMERO_DE_CELULAR",
"message"=>"AQUI_EL_MENSAJE_A_ENVIAR",
"voice"=>"AQUI_TIPO_DE_VOZ",
"retries"=>"AQUI_NUMERO_DE_INTENTOS",
"leave-voicemail"=>"false",
"audio-code"=>"AQUI_ID_AUDIO",
"country-code"=>"CO");
try{
$response=$client->request('POST','https://www.onurix.com/api/v1/call/send',array(
'headers'=>$headers,
'form_params'=>$request_body,
)
);
print_r($response->getBody()->getContents());
}
catch(\GuzzleHttp\Exception\BadResponseException $e){
// Manejar excepciones o errores de API
print_r($e->getMessage());
}
import requests
headers ={
'Content-Type':'application/x-www-form-urlencoded',
'Accept':'application/json'
}
data = {
'client':'AQUI_SU_CLIENT',
'key':'AQUI_SU_KEY',
'phone':'AQUI_EL_NUMERO_DE_CELULAR',
'message':'AQUI_EL_MENSAJE_A_ENVIAR',
'voice':'AQUI_TIPO_DE_VOZ',
'retries':'AQUI_NUMERO_DE_INTENTOS',
'leave-voicemail':'false',
#'audio-code':'AQUI_ID_AUDIO',
'country-code':'CO'
}
r = requests.post('https://www.onurix.com/api/v1/call/send', headers = headers, data = data)
print(r.json())
//Este codigo fue hecho en .net 6
namespace PruebaOnurix
{
public class Program
{
public static void Main(string[] args)
{
Dictionary<string, string> parameters = new()
{
{ "client", "AQUI_SU_CLIENT"},
{ "key", "AQUI_SU_KEY"},
{ "phone", "AQUI_EL_NUMERO_DE_CELULAR"},
{ "message", "AQUI_EL_MENSAJE_A_ENVIAR"},
{ "voice", "AQUI_TIPO_DE_VOZ" },
{ "retries", "AQUI_NUMERO_DE_INTENTOS"},
{ "leave-voicemail","AQUI_CONFIRMACION_BUZON_DE_VOZ"},
//{ "audio-code","AQUI_ID_AUDIO"},
{ "country-code","CO"}
};
SendCall(parameters);
}
public static void SendCall(Dictionary<string,string> parameters)
{
using var httpClient = new HttpClient()
{
BaseAddress = new Uri("https://www.onurix.com"),
};
HttpResponseMessage request = httpClient.PostAsync("api/v1/call/send", new FormUrlEncodedContent(parameters)).Result;
string responseString = request.Content.ReadAsStringAsync().Result;
}
}
}
package main
import (
"fmt"
"io/ioutil"
"net/http"
"strings"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/x-www-form-urlencoded"},
"Accept": []string{"application/json"},
}
data := strings.NewReader("client=AQUI_SU_CLIENT&key=AQUI_SU_KEY&phone=AQUI_EL_NUMERO_DE_CELULAR&message=AQUI_EL_MENSAJE_A_ENVIAR&voice=AQUI_TIPO_DE_VOZ&retries=AQUI_NUMERO_DE_INTENTOS&leave-voicemail=false&audio-code=7b9765ef-48b0-494c-8671-89ddb8f75fa4&country-code=CO")
req, err := http.NewRequest("POST", "https://www.onurix.com/api/v1/call/send", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
// Ejecutar: npm install request --save
var requests = require("request");
var options = {
method: 'POST',
url: 'https://www.onurix.com/api/v1/call/send',
headers: { 'content-type': 'application/x-www-form-urlencoded'},
formData: {
key:'AQUI_SU_KEY',
client:'AQUI_SU_CLIENT',
phone:'AQUI_EL_NUMERO_DE_CELULAR',
message:'AQUI_EL_MENSAJE_A_ENVIAR',
voice:'AQUI_TIPO_DE_VOZ',
retries:'AQUI_NUMERO_DE_INTENTOS',
'leave-voicemail':'false',
//'audio-code':'AQUI_ID_AUDIO',
'country-code':'CO'
}
};
var test = requests(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
//Para este codigo se uso jdk 11
import java.io.IOException;
import java.net.URI;
import java.net.URLEncoder;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
public class SendCALL {
public static void main(String[] args) throws IOException, InterruptedException {
// TODO Auto-generated method stub
Map<String,String> parameters = new HashMap<>();
parameters.put("client", "AQUI_SU_CLIENT");
parameters.put("key", "AQUI_SU_KEY");
parameters.put("phone", "AQUI_EL_NUMERO_DE_CELULAR");
parameters.put("message", "AQUI_EL_MENSAJE_A_ENVIAR");
parameters.put("voice", "AQUI_TIPO_DE_VOZ");
parameters.put("retries", "AQUI_NUMERO_DE_INTENTOS");
parameters.put("leave-voicemail", "false");
//parameters.put("audio-code", "AQUI_ID_AUDIO");
parameters.put("country-code", "CO");
var httpClient = HttpClient.newHttpClient();
var request = HttpRequest.newBuilder()
.POST(ofFormData(parameters))
.uri(URI.create("https://www.onurix.com/api/v1/call/send"))
.header("Content-Type", "application/x-www-form-urlencoded")
.build();
var response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
//System.out.println(response.body());
}
public static HttpRequest.BodyPublisher ofFormData(Map<String, String> parameters) {
var builder = new StringBuilder();
for (Entry<String, String> entry : parameters.entrySet()) {
if (builder.length() > 0) {
builder.append("&");
}
builder.append(URLEncoder.encode(entry.getKey().toString(), StandardCharsets.UTF_8));
builder.append("=");
builder.append(URLEncoder.encode(entry.getValue().toString(), StandardCharsets.UTF_8));
}
return HttpRequest.BodyPublishers.ofString(builder.toString());
}
}
POST /call/send
Body parameter
client:0
key: stringstri
phone: stringstri
message: stringstri
voice: stringstri
retries: stringstri
leave-voicemail: false
audio-code: stringstri
country-code: CO
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | object | true | none |
» client | body | integer(int64) | true | El Id del cliente |
» key | body | string | true | Key de la cuenta Onurix |
» phone | body | string | true | Numero o numeros de telefono separados por coma ejemplo “573150123456” ó “573150123456,573150012345” |
» message | body | string | false | Mensaje para reproducir al iniciar la llamar. Este parámetro es requerido si no se usa el parámetro audio-code |
» voice | body | string | false | Voz a usar en la llamada, puede escoger entre Marian, Penelope, Conchita, Mia, Lucia, Enrique, Miguel. Este parámetro es requerido si no se usa el parámetro audio-code |
» retries | body | string | false | Numero de intentos de la llamada, maximo 3 | » leave-voicemail | body | boolean | false | Use true para dejar mensaje en buzón de voz en caso de que la llamada no sea atendida |
» country-code | body | string | false | Codigo ISO 3166, para Colombia enviar “CO” |
» audio-code | body | string | false | Id único que hace referencia a un audio cargado a través de la plataforma de Onurix, si envía este parámetro se usara el correspondiente audio en las llamadas generadas. No se permite el uso de este parámetro junto con el parámetro voice y message |
Example responses
200 Response
{
"status":"string",
"id":"string",
"data":[
{
"id":"string",
"state":"string",
"credits":0,
"message":"string",
"phone":"string",
"voice":"string"
}
]
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Operación exitosa | ResponseCall |
520 | Unknown | Parametros invalidos | ErrorResponseCall |
MessageState
Consulta el estado de envio de los mensajes SMS y CALL.
Verifica el estado de un grupo de mensajes SMS y CALL
Code samples
curl -X GET "https://www.onurix.com/api/v1/messages-state?client=AQUI_SU_CLIENT_ID&key=AQUI_SU_KEY&id=AQUI_SU_MENSAJE_ID"
<?php
// Ejecutar: composer require guzzlehttp/guzzle:*
require'vendor/autoload.php';
$headers=array(
'Content-Type'=>'application/x-www-form-urlencoded',
'Accept'=>'application/json',
);
$client= new \GuzzleHttp\Client();
try{
$response=$client->request('GET','https://www.onurix.com/api/v1/messages-state?client=AQUI_SU_CLIENT&key=AQUI_SU_KEY&id=AQUI_ID',array(
'headers'=>$headers,
)
);
print_r($response->getBody()->getContents());
}
catch(\GuzzleHttp\Exception\BadResponseException $e){
// Manejar excepciones o errores de API
print_r($e->getMessage());
}
import requests
headers ={
'Content-Type':'application/x-www-form-urlencoded',
'Accept':'application/json'
}
r = requests.get('https://www.onurix.com/api/v1/messages-state?client=AQUI_SU_CLIENT&key=AQUI_SU_KEY&id=AQUI_ID_MENSAJE', headers = headers)
print(r.json())
//Este codigo fue hecho en .net 6
using Newtonsoft.Json;
namespace PruebaOnurix
{
public class Program
{
public static void Main(string[] args)
{
VerificationMessage("AQUI_SU_CLIENT", "AQUI_SU_KEY", "AQUI_SU_MENSAJE_ID");
}
public static void VerificationMessage(string client, string key,string idMensaje)
{
using var httpClient = new HttpClient()
{
BaseAddress = new Uri("https://www.onurix.com"),
};
HttpResponseMessage request = httpClient.GetAsync($"api/v1/messages-state?client={client}&key={key}&id{idMensaje}").Result;
string responseString = request.Content.ReadAsStringAsync().Result;
}
}
}
package main
import (
"fmt"
"io/ioutil"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/x-www-form-urlencoded"},
"Accept": []string{"application/json"},
}
req, err := http.NewRequest("GET", "https://www.onurix.com/api/v1/messages-state?client=AQUI_SU_CLIENT&key=AQUI_SU_KEY&id=AQUI_SU_MENSAJE_ID", nil)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
// Ejecutar: npm install request --save
var requests = require("request");
var options = {
method: 'GET',
url: 'https://www.onurix.com/api/v1/messages-state?key=AQUI_SU_KEY&client=AQUI_SU_CLIENT&id=AQUI_SU_MENSAJE_ID',
headers:{ 'content-type': 'application/x-www-form-urlencoded' },
};
var test = requests(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
//Para este codigo se uso jdk 11
import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class VerificationMessage {
public static void main(String[] args) throws IOException, InterruptedException {
// TODO Auto-generated method stub
var httpClient = HttpClient.newHttpClient();
var request = HttpRequest.newBuilder(URI.create("https://www.onurix.com/api/v1/messages-state?client=AQUI_SU_CLIENT&key=AQUI_SU_KEY&id=AQUI_SU_MENSAJE_ID")).build();
var response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
//System.out.println(response.body());
}
}
GET /messages-state
Body parameter
client:0
key: stringstri
id: stringstri
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | object | true | none |
» client | body | integer(int64) | true | El Id del cliente |
» key | body | string | true | Key de la cuenta Onurix |
» id | body | string | true | Key de la cuenta Onurix |
Example responses
200 Response
{
"state":"string",
"credits":0,
"phone":0,
"created":"string",
"sms":"string",
"dispatch_id":"string",
"id":"string"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Operación exitosa | ResponseStatusSMS |
520 | Unknown | Parametros invalidos | ErrorResponseBalance |
APP2faSendSMS
Envia un mensaje de texto con un codigo de verificacion
Envia un mensaje de texto con un codigo
Code samples
curl -X POST "https://www.onurix.com/api/v1/2fa/send-sms" -d key="AQUI_SU_KEY" -d client="AQUI_SU_CLIENT" -d phone="AQUI_EL_NUMERO_DE_CELULAR" -d app-name="AQUI_NOMBRE_APP" -d country-code="CO" -H 'Content-Type: application/x-www-form-urlencoded' -H 'Accept: application/json'
<?php
// Ejecutar: composer require guzzlehttp/guzzle:*
require'vendor/autoload.php';
$headers=array(
'Content-Type'=>'application/x-www-form-urlencoded',
'Accept'=>'application/json',
);
$client= new \GuzzleHttp\Client();
// Define la matriz del cuerpo de la solicitud.
$request_body = array(
"client"=>"AQUI_SU_CLIENT",
"key"=>"AQUI_SU_KEY",
"phone"=>"AQUI_EL_NUMERO_DE_CELULAR",
"app-name"=>"AQUI_NOMBRE_APP",
"country-code"=>"CO");
try{
$response=$client->request('POST','https://www.onurix.com/api/v1/2fa/send-sms',array(
'headers'=>$headers,
'form_params'=>$request_body,
)
);
print_r($response->getBody()->getContents());
}
catch(\GuzzleHttp\Exception\BadResponseException $e){
// Manejar excepciones o errores de API
print_r($e->getMessage());
}
import requests
headers ={
'Content-Type':'application/x-www-form-urlencoded',
'Accept':'application/json'
}
data = {
'client':'AQUI_SU_CLIENT',
'key':'AQUI_SU_KEY',
'phone':'AQUI_EL_NUMERO_DE_CELULAR',
'app-name':'AQUI_NOMBRE_APP',
'country-code':'CO'
}
r = requests.post('https://www.onurix.com/api/v1/2fa/send-sms', headers = headers, data = data)
print(r.json())
//Este codigo fue hecho en .net 6
namespace PruebaOnurix
{
public class Program
{
public static void Main(string[] args)
{
Dictionary<string, string> parameters = new()
{
{ "client", "AQUI_SU_CLIENT"},
{ "key", "AQUI_SU_KEY"},
{ "phone", "AQUI_EL_NUMERO_DE_CELULAR"},
{ "app-name","AQUI_NOMBRE_APP"},
{ "country-code","CO"}
};
SendSMS2FA(parameters);
}
public static void SendSMS2FA(Dictionary<string,string> parameters)
{
using var httpClient = new HttpClient()
{
BaseAddress = new Uri("https://www.onurix.com"),
};
HttpResponseMessage request = httpClient.PostAsync("/api/v1/2fa/send-sms", new FormUrlEncodedContent(parameters)).Result;
string responseString = request.Content.ReadAsStringAsync().Result;
}
}
}
package main
import (
"fmt"
"io/ioutil"
"net/http"
"strings"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/x-www-form-urlencoded"},
"Accept": []string{"application/json"},
}
data := strings.NewReader("client=AQUI_SU_CLIENT&key=AQUI_SU_KEY&phone=AQUI_EL_NUMERO_DE_CELULAR&app-name=AQUI_NOMBRE_APP&country-code=CO")
req, err := http.NewRequest("POST", "https://www.onurix.com/api/v1/2fa/send-sms", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
// Ejecutar: npm install request --save
var requests = require("request");
var options = {
method: 'POST',
url: 'https://www.onurix.com/api/v1/2fa/send-sms',
headers: { 'content-type': 'application/x-www-form-urlencoded'},
formData: {
key:'AQUI_SU_KEY',
client:'AQUI_SU_CLIENT',
phone:'AQUI_EL_NUMERO_DE_CELULAR',
'app-name':'AQUI_NOMBRE_APP',
'country-code':'CO'
}
};
var test = requests(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
//Para este codigo se uso jdk 11
import java.io.IOException;
import java.net.URI;
import java.net.URLEncoder;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
public class SendSMS2FA {
public static void main(String[] args) throws IOException, InterruptedException {
// TODO Auto-generated method stub
Map<String,String> parameters = new HashMap<>();
parameters.put("client", "AQUI_SU_CLIENT");
parameters.put("key", "AQUI_SU_KEY");
parameters.put("phone", "AQUI_EL_NUMERO_DE_CELULAR");
parameters.put("app-name", "AQUI_NOMBRE_APP");
parameters.put("country-code", "CO");
var httpClient = HttpClient.newHttpClient();
var request = HttpRequest.newBuilder()
.POST(ofFormData(parameters))
.uri(URI.create("https://www.onurix.com/api/v1/2fa/send-sms"))
.header("Content-Type", "application/x-www-form-urlencoded")
.build();
var response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
//System.out.println(response.body());
}
public static HttpRequest.BodyPublisher ofFormData(Map<String, String> parameters) {
var builder = new StringBuilder();
for (Entry<String, String> entry : parameters.entrySet()) {
if (builder.length() > 0) {
builder.append("&");
}
builder.append(URLEncoder.encode(entry.getKey().toString(), StandardCharsets.UTF_8));
builder.append("=");
builder.append(URLEncoder.encode(entry.getValue().toString(), StandardCharsets.UTF_8));
}
return HttpRequest.BodyPublishers.ofString(builder.toString());
}
}
POST /2fa/send-sms
Body parameter
client:0
key: stringstri
phone: stringstri
app-name: string
country-code: CO
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | object | true | none |
» client | body | integer(int64) | true | El Id del cliente |
» key | body | string | true | Key de la cuenta Onurix |
» phone | body | string | true | Numero de telefono, ejemplo “57573150123456” |
» app-name | body | string | true | Nombre de la app que va a ser usada para generar el codigo |
» country-code | body | string | false | Codigo ISO 3166, para Colombia enviar “CO” |
Example responses
200 Response
{
"id":"string",
"status":"string",
"minutes_to_expire":0,
"data":[
{
"id":"string",
"status":"string",
"credits":0,
"sms":"string",
"phone":"string"
}
]
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Respuesta exitosa de la operacion | ResponseSMS2fa |
520 | Unknown | Parametros invalidos | ErrorResponse |
APP2faSendCALL
Entrega un codigo a través de llamada
Entrega un codigo en llamada
Code samples
curl -X POST "https://www.onurix.com/api/v1/call/2fa/send-call" -d key="AQUI_SU_KEY" -d client="AQUI_SU_CLIENT" -d retries="AQUI_NUMERO_DE_INTENTOS" -d voice="AQUI_TIPO_DE_VOZ" -d phone="AQUI_EL_NUMERO_DE_CELULAR" -d app-name="AQUI_NOMBRE_APP" -d country-code="CO" -H 'Content-Type: application/x-www-form-urlencoded' -H 'Accept: application/json'
<?php
// Ejecutar: composer require guzzlehttp/guzzle:*
require'vendor/autoload.php';
$headers=array(
'Content-Type'=>'application/x-www-form-urlencoded',
'Accept'=>'application/json',
);
$client= new \GuzzleHttp\Client();
// Define la matriz del cuerpo de la solicitud.
$request_body = array(
"client"=>"AQUI_SU_CLIENT",
"key"=>"AQUI_SU_KEY",
"phone"=>"AQUI_EL_NUMERO_DE_CELULAR",
"app-name"=>"AQUI_NOMBRE_APP",
"voice"=>"AQUI_TIPO_DE_VOZ",
"retries"=>"AQUI_NUMERO_DE_INTENTOS",
"country-code"=>"CO");
try{
$response=$client->request('POST','https://www.onurix.com/api/v1/call/2fa/send-call',array(
'headers'=>$headers,
'form_params'=>$request_body,
)
);
print_r($response->getBody()->getContents());
}
catch(\GuzzleHttp\Exception\BadResponseException $e){
// Manejar excepciones o errores de API
print_r($e->getMessage());
}
import requests
headers ={
'Content-Type':'application/x-www-form-urlencoded',
'Accept':'application/json'
}
data = {
'client':'AQUI_SU_CLIENT',
'key':'AQUI_SU_KEY',
'app-name':'AQUI_NOMBRE_APP',
'voice':'AQUI_TIPO_DE_VOZ',
'retries':'AQUI_NUMERO_DE_INTENTOS',
'country-code':'CO',
'phone':'AQUI_EL_NUMERO_DE_CELULAR'
}
r = requests.post('https://www.onurix.com/api/v1/call/2fa/send-call', headers = headers, data = data)
print(r.json())
//Este codigo fue hecho en .net 6
namespace PruebaOnurix
{
public class Program
{
public static void Main(string[] args)
{
Dictionary<string, string> parameters = new()
{
{ "client", "AQUI_SU_CLIENT"},
{ "key", "AQUI_SU_KEY"},
{ "phone", "AQUI_EL_NUMERO_DE_CELULAR"},
{ "app-name", "AQUI_NOMBRE_APP"},
{ "voice", "AQUI_TIPO_DE_VOZ" },
{ "retries", "AQUI_NUMERO_DE_INTENTOS"},
{ "country-code","CO"}
};
SendCall2FA(parameters);
}
public static void SendCall2FA(Dictionary<string,string> parameters)
{
using var httpClient = new HttpClient()
{
BaseAddress = new Uri("https://www.onurix.com"),
};
HttpResponseMessage request = httpClient.PostAsync("/api/v1/call/2fa/send-call", new FormUrlEncodedContent(parameters)).Result;
string responseString = request.Content.ReadAsStringAsync().Result;
}
}
}
package main
import (
"fmt"
"io/ioutil"
"net/http"
"strings"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/x-www-form-urlencoded"},
"Accept": []string{"application/json"},
}
data := strings.NewReader("client=AQUI_SU_CLIENT&key=AQUI_SU_KEY&phone=AQUI_EL_NUMERO_DE_CELULAR&app-name=AQUI_NOMBRE_APP&voice=AQUI_TIPO_DE_VOZ&retries=AQUI_NUMERO_DE_INTENTOS&country-code=CO")
req, err := http.NewRequest("POST", "https://www.onurix.com/api/v1/call/2fa/send-call", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
// Ejecutar: npm install request --save
var requests = require("request");
var options = {
method: 'POST',
url: 'https://www.onurix.com/api/v1/call/2fa/send-call',
headers: { 'content-type': 'application/x-www-form-urlencoded'},
formData: {
key:'AQUI_SU_KEY',
client:'AQUI_SU_CLIENT',
phone:'AQUI_EL_NUMERO_DE_CELULAR',
'app-name':'AQUI_NOMBRE_APP',
voice:'AQUI_TIPO_DE_VOZ',
retries:'AQUI_NUMERO_DE_INTENTOS',
'country-code':'CO'
}
};
var test = requests(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
//Para este codigo se uso jdk 11
import java.io.IOException;
import java.net.URI;
import java.net.URLEncoder;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
public class SendCALL2FA {
public static void main(String[] args) throws IOException, InterruptedException {
// TODO Auto-generated method stub
Map<String,String> parameters = new HashMap<>();
parameters.put("client", "AQUI_SU_CLIENT");
parameters.put("key", "AQUI_SU_KEY");
parameters.put("phone", "AQUI_EL_NUMERO_DE_CELULAR");
parameters.put("app-name", "AQUI_NOMBRE_APP");
parameters.put("voice", "AQUI_TIPO_DE_VOZ");
parameters.put("retries", "AQUI_NUMERO_DE_INTENTOS");
parameters.put("country-code", "CO");
var httpClient = HttpClient.newHttpClient();
var request = HttpRequest.newBuilder()
.POST(ofFormData(parameters))
.uri(URI.create("https://www.onurix.com/api/v1/call/2fa/send-call"))
.header("Content-Type", "application/x-www-form-urlencoded")
.build();
var response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
//System.out.println(response.body());
}
public static HttpRequest.BodyPublisher ofFormData(Map<String, String> parameters) {
var builder = new StringBuilder();
for (Entry<String, String> entry : parameters.entrySet()) {
if (builder.length() > 0) {
builder.append("&");
}
builder.append(URLEncoder.encode(entry.getKey().toString(), StandardCharsets.UTF_8));
builder.append("=");
builder.append(URLEncoder.encode(entry.getValue().toString(), StandardCharsets.UTF_8));
}
return HttpRequest.BodyPublishers.ofString(builder.toString());
}
}
POST /call/2fa/send-call
Body parameter
client:0
key: stringstri
voice: string
app-name: string
retries: stringstri
phone: stringstri
country-code: CO
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | object | true | none |
» client | body | integer(int64) | true | El Id del cliente |
» key | body | string | true | Key de la cuenta Onurix |
» voice | body | string | true | Voz a usar en la llamada, puede escoger entre Mariana, Penelope, Conchita, Mia, Lucia, Enrique, Miguel |
» app-name | body | string | true | Nombre de la app que va a ser usada para generar el codigo |
» retries | body | string | true | Numero de telefono, ejemplo “573150123456” |
» phone | body | string | true | Numero de telefono, ejemplo “573150123456” |
» country-code | body | string | false | Codigo ISO 3166, para Colombia enviar “CO” |
Example responses
200 Response
{
"status":"string",
"id":"string",
"minutes_to_expire":0,
"data":[
{
"id":"string",
"state":"string",
"credits":0,
"phone":0,
"voice":"string"
}
]
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Respuesta exitosa de la operacion | ResponseCALL2fa |
520 | Unknown | Parametros invalidos | ErrorResponseCall |
APP2fa
Realiza la verificación del codigo
Verifica el codigo 2FA
Code samples
curl -X POST "https://www.onurix.com/api/v1/2fa/verification-code" -d key="AQUI_SU_KEY" -d client="AQUI_SU_CLIENT_ID" -d phone="AQUI_EL_NUMERO_DE_CELULAR" -d app-name="AQUI_NOMBRE_APP" -d code="AQUI_CODIGO" -d country-code="CO" -H 'Content-Type: application/x-www-form-urlencoded' -H 'Accept: application/json'
<?php
// Ejecutar: composer require guzzlehttp/guzzle:*
require'vendor/autoload.php';
$headers=array(
'Content-Type'=>'application/x-www-form-urlencoded',
'Accept'=>'application/json',
);
$client= new \GuzzleHttp\Client();
// Define la matriz del cuerpo de la solicitud.
$request_body = array(
"client"=>"AQUI_SU_CLIENT",
"key"=>"AQUI_SU_KEY",
"phone"=>"AQUI_EL_NUMERO_DE_CELULAR",
"app-name"=>"AQUI_NOMBRE_APP",
"code"=>"AQUI_CODIGO",
"country-code"=>"CO");
try{
$response=$client->request('POST','https://www.onurix.com/api/v1/2fa/verification-code',array(
'headers'=>$headers,
'form_params'=>$request_body,
)
);
print_r($response->getBody()->getContents());
}
catch(\GuzzleHttp\Exception\BadResponseException $e){
// Manejar excepciones o errores de API
print_r($e->getMessage());
}
import requests
headers ={
'Content-Type':'application/x-www-form-urlencoded',
'Accept':'application/json'
}
data = {
'client':'AQUI_SU_CLIENT',
'key':'AQUI_SU_KEY',
'phone':'AQUI_EL_NUMERO_DE_CELULAR',
'code':'AQUI_NOMBRE_APP',
'app-name':'AQUI_CODIGO',
'country-code':'CO'
}
r = requests.post('https://www.onurix.com/api/v1/2fa/verification-code', headers = headers, data = data)
print(r.json())
//Este codigo fue hecho en .net 6
namespace PruebaOnurix
{
public class Program
{
public static void Main(string[] args)
{
Dictionary<string, string> parameters = new()
{
{ "client", "AQUI_SU_CLIENT"},
{ "key", "AQUI_SU_KEY"},
{ "phone", "AQUI_EL_NUMERO_DE_CELULAR"},
{ "app-name", "AQUI_NOMBRE_APP"},
{ "code", "AQUI_CODIGO"},
{ "country-code", "CO"}
};
VerificationCode2FA(parameters);
}
public static void VerificationCode2FA(Dictionary<string,string> parameters)
{
using var httpClient = new HttpClient()
{
BaseAddress = new Uri("https://www.onurix.com"),
};
HttpResponseMessage request = httpClient.PostAsync("/api/v1/2fa/verification-code", new FormUrlEncodedContent(parameters)).Result;
string responseString = request.Content.ReadAsStringAsync().Result;
Console.WriteLine(responseString);
}
}
}
package main
import (
"fmt"
"io/ioutil"
"net/http"
"strings"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/x-www-form-urlencoded"},
"Accept": []string{"application/json"},
}
data := strings.NewReader("client=AQUI_SU_CLIENT&key=AQUI_SU_KEY&phone=AQUI_EL_NUMERO_DE_CELULAR&app-name=AQUI_NOMBRE_APP&code=AQUI_CODIGO&country-code=CO")
req, err := http.NewRequest("POST", "https://www.onurix.com/api/v1/2fa/verification-code", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
// Ejecutar: npm install request --save
var requests = require("request");
var options = {
method: 'POST',
url: 'https://www.onurix.com/api/v1/2fa/verification-code',
headers: { 'content-type': 'application/x-www-form-urlencoded'},
formData: {
key:'AQUI_SU_KEY',
client:'AQUI_SU_CLIENT',
phone:'AQUI_EL_NUMERO_DE_CELULAR',
'app-name':'AQUI_NOMBRE_APP',
'code':'AQUI_CODIGO',
'country-code':'CO'
}
};
var test = requests(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
//Para este codigo se uso jdk 11
import java.io.IOException;
import java.net.URI;
import java.net.URLEncoder;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
public class VerificationCode2FA {
public static void main(String[] args) throws IOException, InterruptedException {
// TODO Auto-generated method stub
Map<String,String> parameters = new HashMap<>();
parameters.put("client", "AQUI_SU_CLIENT");
parameters.put("key", "AQUI_SU_KEY");
parameters.put("phone", "AQUI_EL_NUMERO_DE_CELULAR");
parameters.put("app-name", "AQUI_NOMBRE_APP");
parameters.put("code", "AQUI_CODIGO");
parameters.put("country-code", "CO");
var httpClient = HttpClient.newHttpClient();
var request = HttpRequest.newBuilder()
.POST(ofFormData(parameters))
.uri(URI.create("https://www.onurix.com/api/v1/2fa/verification-code"))
.header("Content-Type", "application/x-www-form-urlencoded")
.build();
var response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
//System.out.println(response.body());
}
public static HttpRequest.BodyPublisher ofFormData(Map<String, String> parameters) {
var builder = new StringBuilder();
for (Entry<String, String> entry : parameters.entrySet()) {
if (builder.length() > 0) {
builder.append("&");
}
builder.append(URLEncoder.encode(entry.getKey().toString(), StandardCharsets.UTF_8));
builder.append("=");
builder.append(URLEncoder.encode(entry.getValue().toString(), StandardCharsets.UTF_8));
}
return HttpRequest.BodyPublishers.ofString(builder.toString());
}
}
POST /2fa/verification-code
Body parameter
client:0
key: stringstri
phone: stringstri
app-name: stringstri
code: stringstri
country-code: CO
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | object | true | none |
» client | body | integer(int64) | true | El Id del cliente |
» key | body | string | true | Key de la cuenta Onurix |
» phone | body | string | true | Numero de telefono, ejemplo “573150123456” |
» app-name | body | string | true | Nombre de la app que fue usada para generar el codigo en sendSMS2FA |
» code | body | string | true | codigo enviado en el SMS |
» country-code | body | string | false | Codigo ISO 3166, para Colombia enviar “CO” |
Example responses
200 Response
{
"status":"string"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Resultado de la operacion | ResponseSucces |
520 | Unknown | error | ErrorResponse |
URLShort
Crea una URL corta a partir de una URL Larga
Crea una URL corta a partir de una URL larga
Code samples
curl -X POST "https://www.onurix.com/api/v1/url/short" -d key="AQUI_SU_KEY" -d client="AQUI_SU_CLIENT" -d name="AQUI_NOMBE_DE_URL" -d url-long="AQUI_URL_LARGA" -H 'Content-Type: application/x-www-form-urlencoded' -H 'Accept: application/json'
<?php
// Ejecutar: composer require guzzlehttp/guzzle:*
require'vendor/autoload.php';
$headers=array(
'Content-Type'=>'application/x-www-form-urlencoded',
'Accept'=>'application/json',
);
$client= new \GuzzleHttp\Client();
// Define la matriz del cuerpo de la solicitud.
$request_body = array(
"client"=>"AQUI_SU_CLIENT",
"key"=>"AQUI_SU_KEY",
"name"=>"AQUI_NOMBE_DE_URL",
"url-long"=>"AQUI_URL_LARGA",
);
try{
$response=$client->request('POST','https://www.onurix.com/api/v1/url/short',array(
'headers'=>$headers,
'form_params'=>$request_body,
)
);
print_r($response->getBody()->getContents());
}
catch(\GuzzleHttp\Exception\BadResponseException $e){
// Manejar excepciones o errores de API
print_r($e->getMessage());
}
import requests
headers ={
'Content-Type':'application/x-www-form-urlencoded',
'Accept':'application/json'
}
data = {
'client':'AQUI_SU_CLIENT',
'key':'AQUI_SU_KEY',
'name':'AQUI_NOMBRE_DE_URL',
'url-long':'AQUI_URL_LARGA'
}
r = requests.post('https://www.onurix.com/api/v1/url/short', headers = headers, data = data)
print(r.json())
//Este codigo fue hecho en .net 6
namespace PruebaOnurix
{
public class Program
{
public static void Main(string[] args)
{
Dictionary<string, string> parameters = new()
{
{ "client", "AQUI_SU_CLIENT"},
{ "key", "AQUI_SU_KEY"},
{ "name", "AQUI_NOMBRE_DE_URL"},
{ "url-long","AQUI_URL_LARGA"}
};
UrlShortener(parameters);
}
public static void UrlShortener(Dictionary<string,string> parameters)
{
using var httpClient = new HttpClient()
{
BaseAddress = new Uri("https://www.onurix.com"),
};
HttpResponseMessage request = httpClient.PostAsync("/api/v1/url/short", new FormUrlEncodedContent(parameters)).Result;
string responseString = request.Content.ReadAsStringAsync().Result;
}
}
}
package main
import (
"fmt"
"io/ioutil"
"net/http"
"strings"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/x-www-form-urlencoded"},
"Accept": []string{"application/json"},
}
data := strings.NewReader("client=AQUI_SU_CLIENT&key=AQUI_SU_KEY&name=AQUI_NOMBRE_DE_URL&name=AQUI_NOMBRE_DE_URL&url-longAQUI_URL_LARGA")
req, err := http.NewRequest("POST", "https://www.onurix.com/api/v1/url/short", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
// Ejecutar: npm install request --save
var requests = require("request");
var options = {
method: 'POST',
url: 'https://www.onurix.com/api/v1/url/short',
headers: { 'content-type': 'application/x-www-form-urlencoded'},
formData: {
key:'AQUI_SU_KEY',
client:'AQUI_SU_CLIENT',
name:'AQUI_NOMBE_DE_URL',
'url-long':'AQUI_URL_LARGA'
}
};
var test = requests(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
//Para este codigo se uso jdk 11
import java.io.IOException;
import java.net.URI;
import java.net.URLEncoder;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
public class URLShortener {
public static void main(String[] args) throws IOException, InterruptedException {
// TODO Auto-generated method stub
Map<String,String> parameters = new HashMap<>();
parameters.put("client", "AQUI_SU_CLIENT");
parameters.put("key", "AQUI_SU_KEY");
parameters.put("name", "AQUI_NOMBE_DE_URL");
parameters.put("url-long", "AQUI_URL_LARGA");
var httpClient = HttpClient.newHttpClient();
var request = HttpRequest.newBuilder()
.POST(ofFormData(parameters))
.uri(URI.create("https://www.onurix.com/api/v1/url/short"))
.header("Content-Type", "application/x-www-form-urlencoded")
.build();
var response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
//System.out.println(response.body());
}
public static HttpRequest.BodyPublisher ofFormData(Map<String, String> parameters) {
var builder = new StringBuilder();
for (Entry<String, String> entry : parameters.entrySet()) {
if (builder.length() > 0) {
builder.append("&");
}
builder.append(URLEncoder.encode(entry.getKey().toString(), StandardCharsets.UTF_8));
builder.append("=");
builder.append(URLEncoder.encode(entry.getValue().toString(), StandardCharsets.UTF_8));
}
return HttpRequest.BodyPublishers.ofString(builder.toString());
}
}
POST /url/short
Body parameter
client:0
key: string
name: string
url-long: string
alias: string
is-premium:true
group-name: string
domain-name: string
expiration-time-statistics: string
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | object | true | none |
» client | body | integer(int64) | true | El Id del cliente |
» key | body | string | true | Key de la cuenta Onurix |
» name | body | string | true | Nombre de la URL |
» url-long | body | string | true | URL Larga |
» alias | body | string | false | Alias para la URL corta |
» is-premium | body | boolean | false | Es premium por defecto falso |
» group-name | body | string | false | Grupo al que se desea asociar |
» domain-name | body | string | false | Dominio al que se desea asociar |
» expiration-time-statistics | body | string | false | Expiración de la URL en meses valores por defecto enviar 0 |
Example responses
200 Response
{
"urlShort":"string",
"urlLong":"string",
"msg":"string"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Respuesta exitosa de la operacion | ResponseURLShort |
520 | Unknown | Parametros invalidos | ErrorResponse |
URLStatistics
Devuelve estadísticas de la URL a partir de su nombre
Obtiene los clicks de una URL corta
Code samples
curl -X POST "https://www.onurix.com/api/v1/url/short-statistic" -d key="AQUI_SU_KEY" -d client="AQUI_SU_CLIENT" -d name-url="AQUI_NOMBE_DE_URL" -d since="Fecha inicial YYYY-MM-DD" -d until="Fecha final YYYY-MM-DD" -H 'Content-Type: application/x-www-form-urlencoded' -H 'Accept: application/json'
<?php
// Ejecutar: composer require guzzlehttp/guzzle:*
require'vendor/autoload.php';
$headers=array(
'Content-Type'=>'application/x-www-form-urlencoded',
'Accept'=>'application/json',
);
$client= new \GuzzleHttp\Client();
// Define la matriz del cuerpo de la solicitud.
$request_body = array(
"client"=>"AQUI_SU_CLIENT",
"key"=>"AQUI_SU_KEY",
"name-url"=>"AQUI_NOMBE_DE_URL",
"since"=>"Fecha inicial YYYY-MM-DD",
"until"=>"Fecha final YYYY-MM-DD");
try{
$response=$client->request('POST','https://www.onurix.com/api/v1/url/short-statistic',array(
'headers'=>$headers,
'form_params'=>$request_body,
)
);
print_r($response->getBody()->getContents());
}
catch(\GuzzleHttp\Exception\BadResponseException $e){
// Manejar excepciones o errores de API
print_r($e->getMessage());
}
import requests
headers ={
'Content-Type':'application/x-www-form-urlencoded',
'Accept':'application/json'
}
data = {
'client':'AQUI_SU_CLIENT',
'key':'AQUI_SU_KEY',
'name-url':'AQUI_NOMBRE_DE_URL',
'since':'Fecha inicial YYYY-MM-DD',
'until':'Fecha final YYYY-MM-DD'
}
r = requests.post('https://www.onurix.com/api/v1/url/short-statistic', headers = headers, data = data)
print(r.json())
//Este codigo fue hecho en .net 6
namespace PruebaOnurix
{
public class Program
{
public static void Main(string[] args)
{
Dictionary<string, string> parameters = new()
{
{ "client", "AQUI_SU_CLIENT"},
{ "key", "AQUI_SU_KEY"},
{ "name-url", "AQUI_NOMBE_DE_URL"},
{ "since","Fecha inicial YYYY-MM-DD"},
{ "until","Fecha final YYYY-MM-DD"}
};
GetStatistics(parameters);
}
public static void GetStatistics(Dictionary<string,string> parameters)
{
using var httpClient = new HttpClient()
{
BaseAddress = new Uri("https://www.onurix.com"),
};
HttpResponseMessage request = httpClient.PostAsync("/api/v1/url/short-statistic", new FormUrlEncodedContent(parameters)).Result;
string responseString = request.Content.ReadAsStringAsync().Result;
}
}
}
package main
import (
"fmt"
"io/ioutil"
"net/http"
"strings"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/x-www-form-urlencoded"},
"Accept": []string{"application/json"},
}
data := strings.NewReader("client=AQUI_SU_CLIENT&key=AQUI_SU_KEY&phone=AQUI_EL_NUMERO_DE_CELULAR&name-url=AQUI_NOMBRE_DE_URL&since=Fecha inicial YYYY-MM-DD&until=Fecha final YYYY-MM-DD")
req, err := http.NewRequest("POST", "https://www.onurix.com/api/v1/url/short-statistic", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
// Ejecutar: npm install request --save
var requests = require("request");
var options = {
method: 'POST',
url: 'https://www.onurix.com/api/v1/url/short-statistic',
headers: { 'content-type': 'application/x-www-form-urlencoded'},
formData: {
key:'AQUI_SU_KEY',
client:'AQUI_SU_CLIENT',
'name-url':'AQUI_NOMBE_DE_URL',
since:'Fecha inicial YYYY-MM-DD',
until:'Fecha final YYYY-MM-DD'
}
};
var test = requests(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
//Para este codigo se uso jdk 11
import java.io.IOException;
import java.net.URI;
import java.net.URLEncoder;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
public class Statistics {
public static void main(String[] args) throws IOException, InterruptedException {
// TODO Auto-generated method stub
Map<String,String> parameters = new HashMap<>();
parameters.put("client", "AQUI_SU_CLIENT");
parameters.put("key", "AQUI_SU_KEY");
parameters.put("name-url", "AQUI_NOMBE_DE_URL");
parameters.put("since", "Fecha inicial YYYY-MM-DD");
parameters.put("until", "Fecha final YYYY-MM-DD");
var httpClient = HttpClient.newHttpClient();
var request = HttpRequest.newBuilder()
.POST(ofFormData(parameters))
.uri(URI.create("https://www.onurix.com/api/v1/url/short-statistic"))
.header("Content-Type", "application/x-www-form-urlencoded")
.build();
var response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
//System.out.println(response.body());
}
public static HttpRequest.BodyPublisher ofFormData(Map<String, String> parameters) {
var builder = new StringBuilder();
for (Entry<String, String> entry : parameters.entrySet()) {
if (builder.length() > 0) {
builder.append("&");
}
builder.append(URLEncoder.encode(entry.getKey().toString(), StandardCharsets.UTF_8));
builder.append("=");
builder.append(URLEncoder.encode(entry.getValue().toString(), StandardCharsets.UTF_8));
}
return HttpRequest.BodyPublishers.ofString(builder.toString());
}
}
POST /url/short-statistic
Body parameter
client:0
key: string
name-url: string
since: string
until: string
category: string
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | object | true | none |
» client | body | integer(int64) | true | El Id del cliente |
» key | body | string | true | Key de la cuenta Onurix |
» name-url | body | string | true | Nombre de la URL corta |
» since | body | string | true | Fecha inicial año-mes-dia |
» until | body | string | true | Fecha hasta año-mes-dia |
» category | body | string | false | Categoría que desea información detallada {date,hour,country,device,operatingSystem} URLs Premium adicional {region,city,brand,model,browser,lang} |
Example responses
200 Response
{
"urlShort":"string",
"urlLong":"string",
"clicksNumber":0,
"metrics":[
{
"date":{
"property":"string",
"clicks":0
},
"hour":{
"property":"string",
"clicks":0,
"date":"string"
},
"country":{
"property":"string",
"clicks":0
},
"region":{
"property":"string",
"clicks":0
},
"city":{
"property":"string",
"clicks":0,
"countryIsoCode":"string",
"region":"string",
"percent":0
},
"device":{
"property":"string",
"clicks":0
},
"brand":{
"property":"string",
"clicks":0,
"percent":0
},
"model":{
"property":"string",
"clicks":0,
"percent":0
},
"operatingSystem":{
"property":"string",
"clicks":0
},
"browser":{
"property":"string",
"clicks":0
},
"lang":{
"property":"string",
"clicks":0
}
}
]
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Respuesta exitosa de la operacion | ResponseStatistic |
520 | Unknown | Parametros invalidos | ErrorResponse |
WhatsApp general
Envió de mensajes de texto mediante WhatsApp, no es necesario usar una plantilla personalizada.
Enviar mensaje de texto por WhatsApp
Code samples
# También puede usar wget
curl -X POST "https://www.onurix.com/api/v1/whatsapp/send?client=AQUI_SU_KEY&key=AQUI_SU_CLIENT&template=AQUI_EL_NOMBRE_DE_LA_PLANTILLA" -H 'Content-Type: application/json' -d 'AQUI_EL_JSON_CON_LOS_VALORES_PARA_LA_PLANTILLA'
<?php
// Ejecutar: composer require guzzlehttp/guzzle:*
require'vendor/autoload.php';
$clientId = "AQUI_SU_CLIENT";
$key = "AQUI_SU_KEY";
$template = "AQUI_EL_NOMBRE_DE_LA_PLANTILLA";
$client = new \GuzzleHttp\Client();
$headers = [
'Content-Type' => 'application/json'
];
//$data = ['phone' => '+573201234567','body' => ['Parametro1','Parametro2']];
$data = 'AQUI_EL_ARREGLO_CON_LOS_VALORES_PARA_LA_PLANTILLA';
$response = $client->post("https://www.onurix.com/api/v1/whatsapp/send?key=$key&client=$clientId&template=$template",['body' => json_encode($data)]);
echo $response->getBody()->getContents();
import requests
import json
url = "https://www.onurix.com/api/v1/whatsapp/send?key=AQUI_SU_KEY&client=AQUI_SU_CLIENT&template=AQUI_EL_NOMBRE_DE_LA_PLANTILLA"
# payload = json.dumps({
# "phone": "+57320123457",
# "body": [
# "Parametro1",
# "Parametro2"
# ]
# })
payload = json.dumps('AQUI_EL_JSON_CON_LOS_VALORES_PARA_LA_PLANTILLA')
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
//Este codigo fue hecho en .net 6
using System.Text;
namespace PruebaOnurix
{
public class Program
{
public static void Main(string[] args)
{
WhatsAppSend();
}
public static void WhatsAppSend()
{
string key = "AQUI_SU_KEY";
string client = "AQUI_SU_CLIENT";
string template = "AQUI_EL_NOMBRE_DE_LA_PLANTILLA";
string parameters = "AQUI_EL_JSON_CON_LOS_VALORES_PARA_LA_PLANTILLA"
//string parameters = "{\"phone\": \"573201234567\",\"body\": [\"Parametro1\",\"Parametro2\"]}";
using var httpClient = new HttpClient()
{
BaseAddress = new Uri("https://www.onurix.com"),
};
HttpResponseMessage request = httpClient.PostAsync($"api/v1/whatsapp/send?client={client}&key={key}&template={template}", content: new StringContent(parameters, Encoding.UTF8, "application/json")).Result;
string responseString = request.Content.ReadAsStringAsync().Result;
Console.WriteLine(responseString);
}
}
}
package main
import (
"fmt"
"io/ioutil"
"net/http"
"strings"
)
func main() {
url := "https://www.onurix.com/api/v1/whatsapp/send?key=AQUI_SU_KEY&client=AQUI_SU_CLIENT&template=AQUI_EL_NOMBRE_DE_LA_PLANTILLA"
method := "POST"
payload := strings.NewReader(`AQUI_EL_JSON_CON_LOS_VALORES_PARA_LA_PLANTILLA`)
client := &http.Client{}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "text/plain")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
// ejecutar: npm install request --save
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://www.onurix.com/api/v1/whatsapp/send?key=AQUI_SU_KEY&client=AQUI_SU_CLIENT&template=AQUI_EL_NOMBRE_DE_LA_PLANTILLA',
'headers': {
'Content-Type': 'application/json'
},
// body: JSON.stringify({
// "phone": "+573201234567",
// "body": [
// "Parametro1",
// "Parametro2"
// ]
// })
body: JSON.stringify('AQUI_EL_JSON_CON_LOS_VALORES_PARA_LA_PLANTILLA')
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
//Para este codigo se uso jdk 11
import java.io.IOException;
import java.net.URI;
import java.net.URLEncoder;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
public class WhatsAppGeneralSend {
public static void main(String[] args) throws IOException, InterruptedException {
// TODO Auto-generated method stub
String clientId = "AQUI_SU_CLIENT";
String key = "AQUI_SU_KEY";
String template = "AQUI_EL_NOMBRE_DE_LA_PLANTILLA";
var httpClient = HttpClient.newHttpClient();
var request = HttpRequest.newBuilder()
.POST(HttpRequest.BodyPublishers.ofString("AQUI_EL_JSON_CON_LOS_VALORES_PARA_LA_PLANTILLA"))
.uri(URI.create("https://www.onurix.com/api/v1/whatsapp/send?client=" + clientId + "&key=" + key + "&template=" + template))
.header("Content-Type", "application/json")
.build();
var response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
POST /whatsapp/send
Body parameter
client:0
key: stringstri
phone: stringstri
name: string
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
» template | body | string | true | El nombre de la plantilla a usar |
» key | body | string | true | Key de la cuenta Onurix |
» client | body | integer(int64) | true | El Id del cliente |
» content | body | json | true | Los valores con los cuales se va a llenar la plantilla |
Example responses
200 Response
{
"id":"string",
"status":"string",
"phone":"string",
"name":"string"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Operación exitosa | ResponseSucces |
520 | Unknown | Parametros invalidos | ErrorResponse |
WhatsApp Shopify
Envió de notificaciones de Shopify mediante WhatsApp, es necesario contar con una plantilla personalizada
Enviar notificaciones sobre compras en Shopify mediante WhatsApp
Code samples
# También puede usar wget
curl -X POST "https://www.onurix.com/api/v1/whatsapp/shopify/order?client=AQUI_SU_KEY&key=AQUI_SU_CLIENT&template=AQUI_EL_NOMBRE_DE_LA_PLANTILLA" -H 'Content-Type: application/json' -d 'AQUI_EL_JSON_CON_LOS_VALORES_PARA_LA_PLANTILLA'
<?php
// Ejecutar: composer require guzzlehttp/guzzle:*
require'vendor/autoload.php';
$clientId = "AQUI_SU_CLIENT";
$key = "AQUI_SU_KEY";
$template = "AQUI_EL_NOMBRE_DE_LA_PLANTILLA";
$client = new \GuzzleHttp\Client();
$headers = [
'Content-Type' => 'application/json'
];
//$data = ['phone' => '+573201234567','body' => ['Parametro1','Parametro2']];
$data = 'AQUI_EL_ARREGLO_CON_LOS_VALORES_PARA_LA_PLANTILLA';
$response = $client->post("https://www.onurix.com/api/v1/whatsapp/shopify/order?key=$key&client=$clientId&template=$template",['body' => json_encode($data)]);
echo $response->getBody()->getContents();
import requests
import json
url = "https://www.onurix.com/api/v1/whatsapp/shopify/order?key=AQUI_SU_KEY&client=AQUI_SU_CLIENT&template=AQUI_EL_NOMBRE_DE_LA_PLANTILLA"
# payload = json.dumps({
# "phone": "+57320123457",
# "body": [
# "Parametro1",
# "Parametro2"
# ]
# })
payload = json.dumps('AQUI_EL_JSON_CON_LOS_VALORES_PARA_LA_PLANTILLA')
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
//Este codigo fue hecho en .net 6
using System.Text;
namespace PruebaOnurix
{
public class Program
{
public static void Main(string[] args)
{
WhatsAppSend();
}
public static void WhatsAppSend()
{
string key = "AQUI_SU_KEY";
string client = "AQUI_SU_CLIENT";
string template = "AQUI_EL_NOMBRE_DE_LA_PLANTILLA";
string parameters = "AQUI_EL_JSON_CON_LOS_VALORES_PARA_LA_PLANTILLA"
//string parameters = "{\"phone\": \"573201234567\",\"body\": [\"Parametro1\",\"Parametro2\"]}";
using var httpClient = new HttpClient()
{
BaseAddress = new Uri("https://www.onurix.com"),
};
HttpResponseMessage request = httpClient.PostAsync($"api/v1/whatsapp/shopify/order?client={client}&key={key}&template={template}", content: new StringContent(parameters, Encoding.UTF8, "application/json")).Result;
string responseString = request.Content.ReadAsStringAsync().Result;
Console.WriteLine(responseString);
}
}
}
package main
import (
"fmt"
"io/ioutil"
"net/http"
"strings"
)
func main() {
url := "https://www.onurix.com/api/v1/whatsapp/shopify/order?key=AQUI_SU_KEY&client=AQUI_SU_CLIENT&template=AQUI_EL_NOMBRE_DE_LA_PLANTILLA"
method := "POST"
payload := strings.NewReader(`AQUI_EL_JSON_CON_LOS_VALORES_PARA_LA_PLANTILLA`)
client := &http.Client{}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "text/plain")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
// ejecutar: npm install request --save
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://www.onurix.com/api/v1/whatsapp/shopify/order?key=AQUI_SU_KEY&client=AQUI_SU_CLIENT&template=AQUI_EL_NOMBRE_DE_LA_PLANTILLA',
'headers': {
'Content-Type': 'application/json'
},
// body: JSON.stringify({
// "phone": "+573201234567",
// "body": [
// "Parametro1",
// "Parametro2"
// ]
// })
body: JSON.stringify('AQUI_EL_JSON_CON_LOS_VALORES_PARA_LA_PLANTILLA')
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
//Para este codigo se uso jdk 11
import java.io.IOException;
import java.net.URI;
import java.net.URLEncoder;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
public class WhatsAppShopifyOrder {
public static void main(String[] args) throws IOException, InterruptedException {
// TODO Auto-generated method stub
String clientId = "AQUI_SU_CLIENT";
String key = "AQUI_SU_KEY";
String template = "AQUI_EL_NOMBRE_DE_LA_PLANTILLA";
var httpClient = HttpClient.newHttpClient();
var request = HttpRequest.newBuilder()
.POST(HttpRequest.BodyPublishers.ofString("AQUI_EL_JSON_CON_LOS_VALORES_PARA_LA_PLANTILLA"))
.uri(URI.create("https://www.onurix.com/api/v1/whatsapp/shopify/order?client=" + clientId + "&key=" + key + "&template=" + template))
.header("Content-Type", "application/json")
.build();
var response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
POST /whatsapp/shopify/order
Body parameter
client:0
key: stringstri
phone: stringstri
name: string
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
» template | body | string | true | El nombre de la plantilla a usar |
» key | body | string | true | Key de la cuenta Onurix |
» client | body | integer(int64) | true | El Id del cliente |
» content | body | json | true | Los valores con los cuales se va a llenar la plantilla |
Example responses
200 Response
{
"id":"string",
"status":"string",
"phone":"string",
"name":"string"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Operación exitosa | ResponseSucces |
520 | Unknown | Parametros invalidos | ErrorResponse |
WhatsApp 2FA
Envía un mensaje de texto con un código de verificación mediante WhatsApp, no requiere una plantilla personalizada para funcionar.
Enviar un mensaje de WhatsApp con un código de verificación
Code samples
curl -X POST "https://www.onurix.com/api/v1/2fa/send-whatsapp" -d key="AQUI_SU_KEY" -d client="AQUI_SU_CLIENT" -d phone="AQUI_EL_NUMERO_DE_CELULAR" -d app-name="AQUI_NOMBRE_APP" -d country-code="CO" -H 'Content-Type: application/x-www-form-urlencoded' -H 'Accept: application/json'
<?php
// Ejecutar: composer require guzzlehttp/guzzle:*
require'vendor/autoload.php';
$headers=array(
'Content-Type'=>'application/x-www-form-urlencoded',
'Accept'=>'application/json',
);
$client= new \GuzzleHttp\Client();
// Define la matriz del cuerpo de la solicitud.
$request_body = array(
"client"=>"AQUI_SU_CLIENT",
"key"=>"AQUI_SU_KEY",
"phone"=>"AQUI_EL_NUMERO_DE_CELULAR",
"app-name"=>"AQUI_NOMBRE_APP",
"country-code"=>"CO");
try{
$response=$client->request('POST','https://www.onurix.com/api/v1/2fa/send-whatsapp',array(
'headers'=>$headers,
'form_params'=>$request_body,
)
);
print_r($response->getBody()->getContents());
}
catch(\GuzzleHttp\Exception\BadResponseException $e){
// Manejar excepciones o errores de API
print_r($e->getMessage());
}
import requests
headers ={
'Content-Type':'application/x-www-form-urlencoded',
'Accept':'application/json'
}
data = {
'client':'AQUI_SU_CLIENT',
'key':'AQUI_SU_KEY',
'phone':'AQUI_EL_NUMERO_DE_CELULAR',
'app-name':'AQUI_NOMBRE_APP',
'country-code':'CO'
}
r = requests.post('https://www.onurix.com/api/v1/2fa/send-whatsapp', headers = headers, data = data)
print(r.json())
//Este codigo fue hecho en .net 6
namespace PruebaOnurix
{
public class Program
{
public static void Main(string[] args)
{
Dictionary<string, string> parameters = new()
{
{ "client", "AQUI_SU_CLIENT"},
{ "key", "AQUI_SU_KEY"},
{ "phone", "AQUI_EL_NUMERO_DE_CELULAR"},
{ "app-name","AQUI_NOMBRE_APP"},
{ "country-code","CO"}
};
SendSMS2FA(parameters);
}
public static void SendSMS2FA(Dictionary<string,string> parameters)
{
using var httpClient = new HttpClient()
{
BaseAddress = new Uri("https://www.onurix.com"),
};
HttpResponseMessage request = httpClient.PostAsync("/api/v1/2fa/send-whatsapp", new FormUrlEncodedContent(parameters)).Result;
string responseString = request.Content.ReadAsStringAsync().Result;
}
}
}
package main
import (
"fmt"
"io/ioutil"
"net/http"
"strings"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/x-www-form-urlencoded"},
"Accept": []string{"application/json"},
}
data := strings.NewReader("client=AQUI_SU_CLIENT&key=AQUI_SU_KEY&phone=AQUI_EL_NUMERO_DE_CELULAR&app-name=AQUI_NOMBRE_APP&country-code=CO")
req, err := http.NewRequest("POST", "https://www.onurix.com/api/v1/2fa/send-whatsapp", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
// Ejecutar: npm install request --save
var requests = require("request");
var options = {
method: 'POST',
url: 'https://www.onurix.com/api/v1/2fa/send-whatsapp',
headers: { 'content-type': 'application/x-www-form-urlencoded'},
formData: {
key:'AQUI_SU_KEY',
client:'AQUI_SU_CLIENT',
phone:'AQUI_EL_NUMERO_DE_CELULAR',
'app-name':'AQUI_NOMBRE_APP',
'country-code':'CO'
}
};
var test = requests(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
//Para este codigo se uso jdk 11
import java.io.IOException;
import java.net.URI;
import java.net.URLEncoder;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
public class SendSMS2FA {
public static void main(String[] args) throws IOException, InterruptedException {
// TODO Auto-generated method stub
Map<String,String> parameters = new HashMap<>();
parameters.put("client", "AQUI_SU_CLIENT");
parameters.put("key", "AQUI_SU_KEY");
parameters.put("phone", "AQUI_EL_NUMERO_DE_CELULAR");
parameters.put("app-name", "AQUI_NOMBRE_APP");
parameters.put("country-code", "CO");
var httpClient = HttpClient.newHttpClient();
var request = HttpRequest.newBuilder()
.POST(ofFormData(parameters))
.uri(URI.create("https://www.onurix.com/api/v1/2fa/send-whatsapp"))
.header("Content-Type", "application/x-www-form-urlencoded")
.build();
var response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
//System.out.println(response.body());
}
public static HttpRequest.BodyPublisher ofFormData(Map<String, String> parameters) {
var builder = new StringBuilder();
for (Entry<String, String> entry : parameters.entrySet()) {
if (builder.length() > 0) {
builder.append("&");
}
builder.append(URLEncoder.encode(entry.getKey().toString(), StandardCharsets.UTF_8));
builder.append("=");
builder.append(URLEncoder.encode(entry.getValue().toString(), StandardCharsets.UTF_8));
}
return HttpRequest.BodyPublishers.ofString(builder.toString());
}
}
POST /2fa/send-whatsapp
Body parameter
client:0
key: stringstri
phone: stringstri
name: string
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
» key | body | string | true | Key de la cuenta Onurix |
» client | body | integer(int64) | true | El Id del cliente |
» phone | body | string | true | Numero de telefono, ejemplo “573150123456” |
» app-name | body | string | true | Nombre de la app que va a ser usada para generar el codigo |
» country-code | body | string | false | Codigo ISO 3166, para Colombia enviar “CO” |
» template | body | string | false | El nombre de la plantilla a usar |
Example responses
200 Response
{
"id":"string",
"status":"string",
"phone":"string",
"name":"string"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Operación exitosa | ResponseSucces |
520 | Unknown | Parametros invalidos | ErrorResponse |
Schemas
ResponseBalance
{
"status":0
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
status | integer(int64) | false | none | none |
ErrorResponseBalance
{
"error":"string",
"msg":"string"
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
error | string | false | none | none |
msg | string | false | none | none |
ResponseSucces
{
"status":"string"
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
status | string | false | none | none |
ResponseSMS
{
"id":"string",
"status":0,
"data":[
{
"id":"string",
"status":"string",
"credits":0,
"sms":"string",
"phone":"string"
}
]
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
id | string | false | none | none |
status | integer(int64) | false | none | none |
data | [object] | false | none | Detalle por numero telefonico |
» id | string | false | none | none |
» status | string | false | none | none |
» credits | integer | false | none | none |
» sms | string | false | none | none |
» phone | string | false | none | none |
ResponseCall
{
"status":"string",
"id":"string",
"data":[
{
"id":"string",
"state":"string",
"credits":0,
"message":"string",
"phone":"string",
"voice":"string"
}
]
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
status | string | false | none | none |
id | string | false | none | none |
data | [object] | false | none | Detalle por numero telefonico |
» id | string | false | none | none |
» state | string | false | none | none |
» credits | integer | false | none | none |
» message | string | false | none | none |
» phone | string | false | none | none |
» voice | string | false | none | none |
ResponseStatusSMS
{
"state":"string",
"credits":0,
"phone":0,
"created":"string",
"sms":"string",
"dispatch_id":"string",
"id":"string"
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
state | string | false | none | none |
credits | integer(int64) | false | none | none |
phone | integer(int64) | false | none | none |
created | string | false | none | none |
sms | string | false | none | none |
dispatch_id | string | false | none | none |
id | string | false | none | none |
ResponseSMS2fa
{
"id":"string",
"status":"string",
"minutes_to_expire":0,
"data":[
{
"id":"string",
"status":"string",
"credits":0,
"sms":"string",
"phone":"string"
}
]
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
id | string | false | none | none |
status | string | false | none | none |
minutes_to_expire | integer(int64) | false | none | none |
data | [object] | false | none | Detalle por numero telefonico |
» id | string | false | none | none |
» status | string | false | none | none |
» credits | integer | false | none | none |
» sms | string | false | none | none |
» phone | string | false | none | none |
ResponseURLShort
{
"urlShort":"string",
"urlLong":"string",
"msg":"string"
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
urlShort | string | false | none | none |
urlLong | string | false | none | none |
msg | string | false | none | none |
ResponseStatistic
{
"urlShort":"string",
"urlLong":"string",
"clicksNumber":0,
"metrics":[
{
"date":{
"property":"string",
"clicks":0
},
"hour":{
"property":"string",
"clicks":0,
"date":"string"
},
"country":{
"property":"string",
"clicks":0
},
"region":{
"property":"string",
"clicks":0
},
"city":{
"property":"string",
"clicks":0,
"countryIsoCode":"string",
"region":"string",
"percent":0
},
"device":{
"property":"string",
"clicks":0
},
"brand":{
"property":"string",
"clicks":0,
"percent":0
},
"model":{
"property":"string",
"clicks":0,
"percent":0
},
"operatingSystem":{
"property":"string",
"clicks":0
},
"browser":{
"property":"string",
"clicks":0
},
"lang":{
"property":"string",
"clicks":0
}
}
]
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
urlShort | string | false | none | none |
urlLong | string | false | none | none |
clicksNumber | integer | false | none | none |
metrics | [object] | false | none | Estadísticas completas de una URL Premium |
» date | object | false | none | none |
»» property | string | false | none | none |
»» clicks | integer | false | none | none |
» hour | object | false | none | none |
»» property | string | false | none | none |
»» clicks | integer | false | none | none |
»» date | string | false | none | none |
» country | object | false | none | none |
»» property | string | false | none | none |
»» clicks | integer | false | none | none |
» region | object | false | none | none |
»» property | string | false | none | none |
»» clicks | integer | false | none | none |
» city | object | false | none | none |
»» property | string | false | none | none |
»» clicks | integer | false | none | none |
»» countryIsoCode | string | false | none | none |
»» region | string | false | none | none |
»» percent | integer(double) | false | none | none |
» device | object | false | none | none |
»» property | string | false | none | none |
»» clicks | integer | false | none | none |
» brand | object | false | none | none |
»» property | string | false | none | none |
»» clicks | integer | false | none | none |
»» percent | integer(double) | false | none | none |
» model | object | false | none | none |
»» property | string | false | none | none |
»» clicks | integer | false | none | none |
»» percent | integer(double) | false | none | none |
» operatingSystem | object | false | none | none |
»» property | string | false | none | none |
»» clicks | integer | false | none | none |
» browser | object | false | none | none |
»» property | string | false | none | none |
»» clicks | integer | false | none | none |
» lang | object | false | none | none |
»» property | string | false | none | none |
»» clicks | integer | false | none | none |
ErrorResponse
{
"error":"string",
"msg":"string"
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
error | string | false | none | none |
msg | string | false | none | none |
ErrorResponseCall
{
"error":"string",
"msg":"string"
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
error | string | false | none | none |
msg | string | false | none | none |
ResponseSecurity
{
"id":"string",
"status":"string",
"phone":"string",
"name":"string"
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
id | string | false | none | none |
status | string | false | none | none |
phone | string | false | none | none |
name | string | false | none | none |
ErrorResponseSecurity
{
"error":"string",
"msg":"string"
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
error | string | false | none | none |
msg | string | false | none | none |