Making requests

To start making requests to our API, you need to know how, and that's easy!.

Before starting, check at our knowledge bar the API URL. Right there you have our API URLs to make the request, just append the endpoint and follow the steps:

First, you need to know that we control every HTTP method on every different endpoint, for example, is not the same to create a request to /wab/sendmessage using PUT than using POST.

With that in mind, we need 2 basic headers and the body in our POST request (or any request):

The first one needs the Content-Type , we allow ONLY two Content-Type :

  • application/json (recomendada)
  • x-www-form-urlencoded

After that, we need the Auth header, for that we use Basic as authentication, for these you need the follow:

Authorization: Basic {your_auth_code}

How do you use it?, is pretty simple, just append that header to your request headers replacing {your_auth_code} with your auth code, but how do you replace that?, keep reading...

To create your auth code string, you need your API Key and your API Secret.

Then, you need to concatenate them using a semicolon in the middle ( : ) so you get something like this:

api_key:api_secret

After that, there is only one more step, you need to encode the string to base64, so, let's think you have the API Key: 123abc, and the API Secret: 456def.

With that in mind we concatenate them:

123abc:456def

And finally we encode them to base64, so we get:

MTIzYWJjOjQ1NmRlZg==

Using that, we get our final auth header:

Authorization: Basic MTIzYWJjOjQ1NmRlZg==

And that's it...you have your two headers. Now there is only one step more:

We need the Body in the request to match with the Content-Type. We are using Content-Type: application/json in this case, so we use the Body in a JSON format.

WIn the /wab/sendmessage endpoint we need two params, the number the message and the agent.

The first one is the phone number in the e164 format, and the second one the message. So we get the body (remember to replace PHONE_NUMBER with your e.164 phone number):

{"number": "PHONE_NUMBER", "message": "Su OTP para transferencia de fondos es 127317. Esto es válido para 10 minutos.", "agent" : "your_agent" }

And we combine them and the magic happens!.

We support the HTTP/2 protocol in our API so if you want a faster connection and response, please use it.

Responses

All the responses are in JSON format. So you can parse them in your programming language more easily.

Check the knowledge bar for a response example of the /wab/sendmessage endpoint using POST.

In every endpoint here in the docs, you have the response in the knowledge bar.

API URL

The API URL is where you are going to make your requests.

  • https://api.quiubas.com/wab/sendmessage

Final request format

Here is the final request format for a POST request.

Header: Authorization: Basic MTIzYWJjOjQ1NmRlZg==

Header: Content-Type: application/json

Body: { "number": "PHONE_NUMBER", "message": "you_message", "agent": "your_agent" }