Wabu APIs

 

Wabu offers a set of APIs that allow you to interact with each of the instances that are active.

Each instace can be associated with a single WhatsApp number and its onteraction and functions are independent from the rest of the instances that the account could have.

Each instance has an API key that can be found in the section "My Instances", wich must be sent in each call to an API to be autehenticated.

 

Wabu Web Hooks

 

Wabu automatically, every time it receives a WhatsApp message in an active instance, it sends a POST request to the Webhook indicated in the instance.

Each Webhook must be public over the internet and preferably through HTTPS

The format of the Request that WABU sends is like:

application/x-www-form-urlencoded

Containing the following fields:

Parameter Value
id Alphanumeric value that contains a unique value for each message received.
phone Sender's WhatsApp number.

Note: This field contains the country code concatenated to the phone number.

message Message content in clear text.

Note: In case of receiving an audio, WABU automatically transcribes the text and a second request will be obtained with the corresponding text in the "message" attribute.

html Message content in HTML format to be directly viewed on any WEB software or browser

Note: In case of receiving an audio, image or video, this field will have the necessary html tags to view it correctly in any web browser.

url In case of receiving a multimedia message, this field contains the URL from where the sent file can be downloaded.
tipo it contains information on the type of message received, wich can be this: Conversation, Audio, Image or Video.
instancia Name of the instance where the message was received.

 

Getting Conversations

 

In order to reive the lastest WhatsApp conversations from a certain instance, a request must be made with the GET method to the following end-point:

https://wabu.app/conversations/<numero_conversaciones>/<apiKey>

Wabu's response will be a JSON object with the requested information.

The parameter "numero_conversaciones" indicates the number of conversations you want to request.

The parameter "apiKey" it is the one corresponding to the Instance from where you want to send the message.

The following PHP example shows how to get the last 50 conversations of an Instance:

                    
    <?php
        //TO DO: asignar el valor correcto a la variable $apiKey
        $conversaciones = file_get_contents("https://wabu.app/conversations/50/".$apiKey);
        $resultado = json_decode($conversaciones, true);
    ?>
                    
                

 

Getting messages

 

In order to receive the last messages of a WhatsApp conversation from a certain Instance, a request must be made with the GET method to the following end-point:

https://wabu.app/messages/<jid>/<numero_mensajes>/<apiKey>

Wabu's response will be a JSON object with the requested information.

The parameter "jid"is the WhatsApp user identifier, it must have the following format:

[numero_telefonico]@s.whatsapp.net in case of being a contact or

[numero_telefonico]-[idGrupo]@g.us in case of being a group conversation

Ejemplo:

[email protected] for a contact

[email protected] for a group

The parameter "numero_mensajes" indicates the number of messages to be requested.

The parameter "apiKey" it is the one corresponding to the Instance from where you want to send the message.

The following PHP example shows how to get the last 100 messages from a conversation:

                    
    <?php
        //TO DO: asignar el valor correcto a la variable $apiKey
        $jid = '[email protected]';
        $mensajes = file_get_contents("https://wabu.app/messages/".$jid."/100/".$apiKey);
        $resultado = json_decode($conversaciones, true);
    ?>
                    
                

 

Sending text

 

In order to send a Text message to a WhatsApp number through a specific Instance, a request must be made with the POST method to the following end-point:

https://wabu.app/send

containing the following fields with content type application/x-www-form-urlencoded

Parameter Value
phone WhatsApp contact number, this must include the country code. For example: 59170000000
data Content of the message to be sent
apiKey Value of the apiKey of the instance from where you want to send the message.

The following PHP example shows how to send a text message:

                    
    <?php
        //TO DO: asignar el valor correcto a la variable $apiKey
        $url = "https://wabu.app/send";
        $data = array(
            'phone' => '59170000000',
            'data' => 'Mensaje de Prueba enviado desde la API de Wabu',
            'apiKey' => $apiKey
        );

        $options = array(
            'http' => array(
                'header'  => "Content-type: application/x-www-form-urlencoded\r\n",
                'method'  => 'POST',
                'content' => http_build_query($data)
            )
        );
        $context  = stream_context_create($options);
        $result = file_get_contents($url, false, $context);
    ?>
                    
                

 

Sending Audio

 

In order to send an Audio message to a WhatsApp number through a specific instance, a request must be made with the POST method to the following end-point:

https://wabu.app/sendAudio

containing the following fields with content type application/x-www-form-urlencoded

Parameter Value
phone WhatsApp contact number, this must include the country code. For example: 59170000000
data URL to an audio file, it can be in MP3, OGG, WAV format
apiKey Value of the apiKey of the instance from where you want to send the message.

The following PHP example shows how to send a text message:

                    
    <?php
        //TO DO: asignar el valor correcto a la variable $apiKey
        $url = "https://wabu.app/sendAudio";
        $data = array(
            'phone' => '59170000000',
            'data' => 'http://ejemplo.com/url_audio.mp3',
            'apiKey' => $apiKey
        );

        $options = array(
            'http' => array(
                'header'  => "Content-type: application/x-www-form-urlencoded\r\n",
                'method'  => 'POST',
                'content' => http_build_query($data)
            )
        );
        $context  = stream_context_create($options);
        $result = file_get_contents($url, false, $context);
    ?>
                    
                

 

Sending Images

 

In order to send an Image message to a WhatsApp number through a specific instance, a request must be made with the POST method to the following end-point:

https://wabu.app/sendPicture

containing the following fields with content type application/x-www-form-urlencoded

Parameter Value
phone WhatsApp contact number, this must include the country code. For example: 59170000000
data URL to a file of type Image
apiKey Value of the apiKey of the instance from where you want to send the message.

The following PHP example shows how to send a text message:

                    
    <?php
        //TO DO: asignar el valor correcto a la variable $apiKey
        $url = "https://wabu.app/sendAudio";
        $data = array(
            'phone' => '59170000000',
            'data' => 'http://ejemplo.com/url_imagen.jpg',
            'apiKey' => $apiKey
        );

        $options = array(
            'http' => array(
                'header'  => "Content-type: application/x-www-form-urlencoded\r\n",
                'method'  => 'POST',
                'content' => http_build_query($data)
            )
        );
        $context  = stream_context_create($options);
        $result = file_get_contents($url, false, $context);
    ?>