Skip to main content

Enabling API Usage

To use the API, first enable its usage by checking the activation box:

API Key and PostBack URL

When you enable API usage, you will have access to the API key. You can also register the URL to receive responses returned by the API (PostBack).

Example of PostBack implementation:

<?php
// URL of this file -> http://my-system.com/Api

// receive data from the API
$input = file_get_contents("php://input");

// check if the received data is 'BULK' (compressed)
// the 'BULK' option is configured directly in the instance
$BULK_identifier = "BULKGZ,";
if(substr($input, 0, strlen($BULK_identifier)) === $BULK_identifier)
{
// remove BULKGZ, from the beginning of the string
$bulk_messages = substr($input, strlen($BULK_identifier), strlen($input));
$zlib = base64_decode($bulk_messages);

// decompress using zlib
$messages = zlib_decode($zlib);

// remove UTF8-BOM (necessary in some cases)
$messages = trim($messages, "\xEF\xBB\xBF");

$messages = json_decode($messages);
foreach($messages as $message)
{
$final_message = base64_decode($message);
...
}
}
else // data received in JSON format (not 'BULK')
{
$data = json_decode($input);
//...
}
//...
?>

EndPoint

Use the following EndPoint URL to make requests:

https://api.witi.me/$command$?wid=$api_key$

$command$ - Replace with the desired command
$api_key$ - Replace with your API key provided in the instance settings

Note

The results returned by the API are in json format.