The code i am using to send messages works fine. I have configured the web-hooks correctly as the clickatell server is giving a 200 response which means my system received the callback but it is not catching the information of the callback. I am still new to this so What could i possibly be doing wrong. clickatell library
CONTROLER--Send callback result via email(I am receiving the email but has no callback results)
public function callback(){
$this->load->library('clickatell_rest'); //Load Clickatell library
$this->clickatell_rest->parseStatusCallback(function ($result){
$callbackRunDate = date('Y-m-d H:i:s');
$from_email = 'admin@aaa.co.za';
$to = 'sebakets@gmail.com';
$message = $callbackRunDate.' '.print_r($result);
$subject = 'Callback Results';
$this->email->set_mailtype('html');
$this->email->from($from_email, 'Clickatell');
$this->email->to($to);
$this->email->subject($subject);
$this->email->message($message);
$this->email->send();
});
}
Clickatell Library function
public static function parseStatusCallback($callback, $file = STDIN){
$body = file_get_contents($file);
$body = json_decode($body, true);
$keys = [
'apiKey',
'messageId',
'requestId',
'clientMessageId',
'to',
'from',
'status',
'statusDescription',
'timestamp'
];
if (!array_diff($keys, array_keys($body))) {
$callback($body);
}
return;
}