2

I am trying to get only unread messages list (not count) from a dialog. There is no such request in the documentation of QuickBlox. This is my function but it returns nothing:

function getUnreadMessages($login, $password, $dialogId, $userId) {
    $session = quickCreateSession($login, $password);
    $token = $session->token;
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, 'https://api.quickblox.com/chat/Message.json?chat_dialog_id=' . $dialogId . '&read_ids[nin]=' . $userId );
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($curl, CURLOPT_HTTPHEADER, array(
      'Content-Type: application/json',
      'QuickBlox-REST-API-Version: 0.1.0',
      'QB-Token: ' . $token
    ));
    $response = curl_exec($curl);
    if ($response) {
        return @iconv("ISO-8859-9//TRANSLIT", "UTF-8", $response);
    } else {
        return false;
    }
    @curl_close($curl);
}
baturalpdincdari
  • 362
  • 1
  • 3
  • 15

1 Answers1

2

You can get all the message from QuickBlox ,where you get read and unread status of the message and which can be easily managed.I hope this will help you ....

Govinda Yadav
  • 539
  • 4
  • 14