jb_007
jb_007

Reputation: 1

How to get all chats in website using zendesk chat api

There is any way to get all chats from zendesk to website. I am using zendesk api for get all chats: curl https://www.zopim.com/api/v2/chats \ -v -u {email_address}:{password}

Here Is my code :

public function getChat_messages(){
    $sUrl = "https://www.zopim.com/api/v2/chats";
    $authorization = "Authorization: Bearer a362fb582520105c720000631000d6f6f81111f0c95489b9673e722f5c59bf0";
    $key= "-v -u email:password";
    if (is_resource($rCh = curl_init($sUrl))) {
        curl_setopt($rCh, CURLOPT_HTTPHEADER, array('Content-Type: application/json' , 'Authorization: Bearer a362fb582520105c720000631000d6f6f81111f0c95489b9673e722f5c59bf0',
            '-v -u email:password',
    ));
        curl_setopt($rCh, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($rCh, CURLOPT_TIMEOUT, 3); 
        $arrResult = curl_exec($rCh); 
        $arrResult = explode("\n", $arrResult);
        $response = curl_exec($rCh);
        $err = curl_error($rCh);
        curl_close($rCh);
    }
    print_r($response);
}

Help will be appreciated..

Thanks.. :)

Upvotes: 0

Views: 914

Answers (1)

Adam Strauss
Adam Strauss

Reputation: 1999

You did well but there is a little mistake.

$sUrl = "https://www.{your_domain_name}.com/api/v2/chats";

You just copy and paste the line that is why you are getting error.

zopim is not your domain name use your domain name instead of zopim

Upvotes: 0

Related Questions