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:
- API Version 1.1
- API v1.0
<?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);
//...
}
//...
?>
<?php
// URL of this file -> http://my-system.com/Api
// receive data from the API
$data = file_get_contents("php://input");
// transform JSON into a variable
$messages = json_decode($data);
// check if the received data is 'BULK'
// the 'BULK' option is configured directly in the instance
// if 'BULK' is DISABLED, the following code snippet is not necessary
$BULK_identifier = "BULK,";
if(substr($data, 0, strlen($BULK_identifier)) === $BULK_identifier)
{
// remove 'BULK,' from the beginning of the message
$bulk_messages = json_decode(substr($data, strlen($BULK_identifier), strlen($data)));
foreach($bulk_messages as $message)
{
// decode from base64
$decoded_message = base64_decode($message);
//...
}
}
//...
?>
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.