NAV Navigation
CurlPHPPythonC#GONodeJava

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

URL

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

NameInTypeRequiredDescription
bodybodyobjecttruenone
» clientbodyinteger(int64)trueEl Id del cliente
» keybodystringtrueKey de la cuenta Onurix

Example responses

200 Response

{
"status":0
}

Responses

StatusMeaningDescriptionSchema
200OKOperación exitosaResponseBalance
520UnknownParametros invalidosErrorResponseBalance

Security

Bloquea un numero de telefono para que el sistema no envie mensajes de texto SMS

URL

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

NameInTypeRequiredDescription
bodybodyobjecttruenone
» clientbodyinteger(int64)trueEl Id del cliente
» keybodystringtrueKey de la cuenta Onurix
» phonebodystringtrueNumero de telefono a bloquear
» namebodystringfalseNombre del contacto a bloquear

Example responses

200 Response

{
"id":"string",
"status":"string",
"phone":"string",
"name":"string"
}

Responses

StatusMeaningDescriptionSchema
200OKOperación exitosaResponseSecurity
520UnknownParametros invalidosErrorResponseSecurity

SMS

Envia un mensaje SMS a cada numero de telefono suministrado

URL

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

NameInTypeRequiredDescription
bodybodyobjecttruenone
» clientbodyinteger(int64)trueEl Id del cliente
» keybodystringtrueKey de la cuenta Onurix
» country-codebodystringfalseCodigo ISO 3166, para Colombia enviar “CO”
» phonebodystringtrueNumero o numeros de telefono separados por coma ejemplo “573150123456” ó “573150123456,573150012345”
» smsbodystringtrueMensaje 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

StatusMeaningDescriptionSchema
200OKOperación exitosaResponseSMS
520UnknownParametros invalidosErrorResponse

Call

Genera una llamada con cada numero de telefono proporcionado

URL

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

NameInTypeRequiredDescription
bodybodyobjecttruenone
» clientbodyinteger(int64)trueEl Id del cliente
» keybodystringtrueKey de la cuenta Onurix
» phonebodystringtrueNumero o numeros de telefono separados por coma ejemplo “573150123456” ó “573150123456,573150012345”
» messagebodystringfalseMensaje para reproducir al iniciar la llamar. Este parámetro es requerido si no se usa el parámetro audio-code
» voicebodystringfalseVoz 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
» retriesbodystringfalseNumero de intentos de la llamada, maximo 3
» leave-voicemailbodybooleanfalseUse true para dejar mensaje en buzón de voz en caso de que la llamada no sea atendida
» country-codebodystringfalseCodigo ISO 3166, para Colombia enviar “CO”
» audio-codebodystringfalseId ú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

StatusMeaningDescriptionSchema
200OKOperación exitosaResponseCall
520UnknownParametros invalidosErrorResponseCall

MessageState

Consulta el estado de envio de los mensajes SMS y CALL.

URL

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

NameInTypeRequiredDescription
bodybodyobjecttruenone
» clientbodyinteger(int64)trueEl Id del cliente
» keybodystringtrueKey de la cuenta Onurix
» idbodystringtrueKey de la cuenta Onurix

Example responses

200 Response

{
"state":"string",
"credits":0,
"phone":0,
"created":"string",
"sms":"string",
"dispatch_id":"string",
"id":"string"
}

Responses

StatusMeaningDescriptionSchema
200OKOperación exitosaResponseStatusSMS
520UnknownParametros invalidosErrorResponseBalance

APP2faSendSMS

Envia un mensaje de texto con un codigo de verificacion

URL

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

NameInTypeRequiredDescription
bodybodyobjecttruenone
» clientbodyinteger(int64)trueEl Id del cliente
» keybodystringtrueKey de la cuenta Onurix
» phonebodystringtrueNumero de telefono, ejemplo “57573150123456”
» app-namebodystringtrueNombre de la app que va a ser usada para generar el codigo
» country-codebodystringfalseCodigo 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

StatusMeaningDescriptionSchema
200OKRespuesta exitosa de la operacionResponseSMS2fa
520UnknownParametros invalidosErrorResponse

APP2faSendCALL

Entrega un codigo a través de llamada

URL

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

NameInTypeRequiredDescription
bodybodyobjecttruenone
» clientbodyinteger(int64)trueEl Id del cliente
» keybodystringtrueKey de la cuenta Onurix
» voicebodystringtrueVoz a usar en la llamada, puede escoger entre Mariana, Penelope, Conchita, Mia, Lucia, Enrique, Miguel
» app-namebodystringtrueNombre de la app que va a ser usada para generar el codigo
» retriesbodystringtrueNumero de telefono, ejemplo “573150123456”
» phonebodystringtrueNumero de telefono, ejemplo “573150123456”
» country-codebodystringfalseCodigo 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

StatusMeaningDescriptionSchema
200OKRespuesta exitosa de la operacionResponseCALL2fa
520UnknownParametros invalidosErrorResponseCall

APP2fa

Realiza la verificación del codigo

URL

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

NameInTypeRequiredDescription
bodybodyobjecttruenone
» clientbodyinteger(int64)trueEl Id del cliente
» keybodystringtrueKey de la cuenta Onurix
» phonebodystringtrueNumero de telefono, ejemplo “573150123456”
» app-namebodystringtrueNombre de la app que fue usada para generar el codigo en sendSMS2FA
» codebodystringtruecodigo enviado en el SMS
» country-codebodystringfalseCodigo ISO 3166, para Colombia enviar “CO”

Example responses

200 Response

{
"status":"string"
}

Responses

StatusMeaningDescriptionSchema
200OKResultado de la operacionResponseSucces
520UnknownerrorErrorResponse

URLShort

Crea una URL corta a partir de una URL Larga

URL

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

NameInTypeRequiredDescription
bodybodyobjecttruenone
» clientbodyinteger(int64)trueEl Id del cliente
» keybodystringtrueKey de la cuenta Onurix
» namebodystringtrueNombre de la URL
» url-longbodystringtrueURL Larga
» aliasbodystringfalseAlias para la URL corta
» is-premiumbodybooleanfalseEs premium por defecto falso
» group-namebodystringfalseGrupo al que se desea asociar
» domain-namebodystringfalseDominio al que se desea asociar
» expiration-time-statisticsbodystringfalseExpiración de la URL en meses valores por defecto enviar 0

Example responses

200 Response

{
"urlShort":"string",
"urlLong":"string",
"msg":"string"
}

Responses

StatusMeaningDescriptionSchema
200OKRespuesta exitosa de la operacionResponseURLShort
520UnknownParametros invalidosErrorResponse

URLStatistics

Devuelve estadísticas de la URL a partir de su nombre

URL

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

NameInTypeRequiredDescription
bodybodyobjecttruenone
» clientbodyinteger(int64)trueEl Id del cliente
» keybodystringtrueKey de la cuenta Onurix
» name-urlbodystringtrueNombre de la URL corta
» sincebodystringtrueFecha inicial año-mes-dia
» untilbodystringtrueFecha hasta año-mes-dia
» categorybodystringfalseCategorí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

StatusMeaningDescriptionSchema
200OKRespuesta exitosa de la operacionResponseStatistic
520UnknownParametros invalidosErrorResponse

WhatsApp general

Envió de mensajes de texto mediante WhatsApp, no es necesario usar una plantilla personalizada.

URL

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

NameInTypeRequiredDescription
» templatebodystringtrueEl nombre de la plantilla a usar
» keybodystringtrueKey de la cuenta Onurix
» clientbodyinteger(int64)trueEl Id del cliente
» contentbodyjsontrueLos valores con los cuales se va a llenar la plantilla

Example responses

200 Response

{
"id":"string",
"status":"string",
"phone":"string",
"name":"string"
}

Responses

StatusMeaningDescriptionSchema
200OKOperación exitosaResponseSucces
520UnknownParametros invalidosErrorResponse

WhatsApp Shopify

Envió de notificaciones de Shopify mediante WhatsApp, es necesario contar con una plantilla personalizada

URL

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

NameInTypeRequiredDescription
» templatebodystringtrueEl nombre de la plantilla a usar
» keybodystringtrueKey de la cuenta Onurix
» clientbodyinteger(int64)trueEl Id del cliente
» contentbodyjsontrueLos valores con los cuales se va a llenar la plantilla

Example responses

200 Response

{
"id":"string",
"status":"string",
"phone":"string",
"name":"string"
}

Responses

StatusMeaningDescriptionSchema
200OKOperación exitosaResponseSucces
520UnknownParametros invalidosErrorResponse

WhatsApp 2FA

Envía un mensaje de texto con un código de verificación mediante WhatsApp, no requiere una plantilla personalizada para funcionar.

URL

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

NameInTypeRequiredDescription
» keybodystringtrueKey de la cuenta Onurix
» clientbodyinteger(int64)trueEl Id del cliente
» phonebodystringtrueNumero de telefono, ejemplo “573150123456”
» app-namebodystringtrueNombre de la app que va a ser usada para generar el codigo
» country-codebodystringfalseCodigo ISO 3166, para Colombia enviar “CO”
» templatebodystringfalseEl nombre de la plantilla a usar

Example responses

200 Response

{
"id":"string",
"status":"string",
"phone":"string",
"name":"string"
}

Responses

StatusMeaningDescriptionSchema
200OKOperación exitosaResponseSucces
520UnknownParametros invalidosErrorResponse

Schemas

ResponseBalance

{
"status":0
}

Properties

NameTypeRequiredRestrictionsDescription
statusinteger(int64)falsenonenone

ErrorResponseBalance

{
"error":"string",
"msg":"string"
}

Properties

NameTypeRequiredRestrictionsDescription
errorstringfalsenonenone
msgstringfalsenonenone

ResponseSucces

{
"status":"string"
}

Properties

NameTypeRequiredRestrictionsDescription
statusstringfalsenonenone

ResponseSMS

{
"id":"string",
"status":0,
"data":[
{
"id":"string",
"status":"string",
"credits":0,
"sms":"string",
"phone":"string"
}
]
}

Properties

NameTypeRequiredRestrictionsDescription
idstringfalsenonenone
statusinteger(int64)falsenonenone
data[object]falsenoneDetalle por numero telefonico
» idstringfalsenonenone
» statusstringfalsenonenone
» creditsintegerfalsenonenone
» smsstringfalsenonenone
» phonestringfalsenonenone

ResponseCall

{
"status":"string",
"id":"string",
"data":[
{
"id":"string",
"state":"string",
"credits":0,
"message":"string",
"phone":"string",
"voice":"string"
}
]
}

Properties

NameTypeRequiredRestrictionsDescription
statusstringfalsenonenone
idstringfalsenonenone
data[object]falsenoneDetalle por numero telefonico
» idstringfalsenonenone
» statestringfalsenonenone
» creditsintegerfalsenonenone
» messagestringfalsenonenone
» phonestringfalsenonenone
» voicestringfalsenonenone

ResponseStatusSMS

{
"state":"string",
"credits":0,
"phone":0,
"created":"string",
"sms":"string",
"dispatch_id":"string",
"id":"string"
}

Properties

NameTypeRequiredRestrictionsDescription
statestringfalsenonenone
creditsinteger(int64)falsenonenone
phoneinteger(int64)falsenonenone
createdstringfalsenonenone
smsstringfalsenonenone
dispatch_idstringfalsenonenone
idstringfalsenonenone

ResponseSMS2fa

{
"id":"string",
"status":"string",
"minutes_to_expire":0,
"data":[
{
"id":"string",
"status":"string",
"credits":0,
"sms":"string",
"phone":"string"
}
]
}

Properties

NameTypeRequiredRestrictionsDescription
idstringfalsenonenone
statusstringfalsenonenone
minutes_to_expireinteger(int64)falsenonenone
data[object]falsenoneDetalle por numero telefonico
» idstringfalsenonenone
» statusstringfalsenonenone
» creditsintegerfalsenonenone
» smsstringfalsenonenone
» phonestringfalsenonenone

ResponseURLShort

{
"urlShort":"string",
"urlLong":"string",
"msg":"string"
}

Properties

NameTypeRequiredRestrictionsDescription
urlShortstringfalsenonenone
urlLongstringfalsenonenone
msgstringfalsenonenone

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

NameTypeRequiredRestrictionsDescription
urlShortstringfalsenonenone
urlLongstringfalsenonenone
clicksNumberintegerfalsenonenone
metrics[object]falsenoneEstadísticas completas de una URL Premium
» dateobjectfalsenonenone
»» propertystringfalsenonenone
»» clicksintegerfalsenonenone
» hourobjectfalsenonenone
»» propertystringfalsenonenone
»» clicksintegerfalsenonenone
»» datestringfalsenonenone
» countryobjectfalsenonenone
»» propertystringfalsenonenone
»» clicksintegerfalsenonenone
» regionobjectfalsenonenone
»» propertystringfalsenonenone
»» clicksintegerfalsenonenone
» cityobjectfalsenonenone
»» propertystringfalsenonenone
»» clicksintegerfalsenonenone
»» countryIsoCodestringfalsenonenone
»» regionstringfalsenonenone
»» percentinteger(double)falsenonenone
» deviceobjectfalsenonenone
»» propertystringfalsenonenone
»» clicksintegerfalsenonenone
» brandobjectfalsenonenone
»» propertystringfalsenonenone
»» clicksintegerfalsenonenone
»» percentinteger(double)falsenonenone
» modelobjectfalsenonenone
»» propertystringfalsenonenone
»» clicksintegerfalsenonenone
»» percentinteger(double)falsenonenone
» operatingSystemobjectfalsenonenone
»» propertystringfalsenonenone
»» clicksintegerfalsenonenone
» browserobjectfalsenonenone
»» propertystringfalsenonenone
»» clicksintegerfalsenonenone
» langobjectfalsenonenone
»» propertystringfalsenonenone
»» clicksintegerfalsenonenone

ErrorResponse

{
"error":"string",
"msg":"string"
}

Properties

NameTypeRequiredRestrictionsDescription
errorstringfalsenonenone
msgstringfalsenonenone

ErrorResponseCall

{
"error":"string",
"msg":"string"
}

Properties

NameTypeRequiredRestrictionsDescription
errorstringfalsenonenone
msgstringfalsenonenone

ResponseSecurity

{
"id":"string",
"status":"string",
"phone":"string",
"name":"string"
}

Properties

NameTypeRequiredRestrictionsDescription
idstringfalsenonenone
statusstringfalsenonenone
phonestringfalsenonenone
namestringfalsenonenone

ErrorResponseSecurity

{
"error":"string",
"msg":"string"
}

Properties

NameTypeRequiredRestrictionsDescription
errorstringfalsenonenone
msgstringfalsenonenone