php [freshdesk php]客户服务#customer
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php [freshdesk php]客户服务#customer相关的知识,希望对你有一定的参考价值。
<?php
/*
{
"require": {
"mpclarkson/freshdesk-php-sdk": "dev-master"
}
}
*/
use \Freshdesk\Api;
$api = new Api("xxx", "hoangweb");
/**---------------------------------------------------------------------------------------------------
Tickets
*/
//get all tickets
$all = $api->tickets->all(); #$first = $all[0];
$some = $api->tickets->all(['page' => 2]); //next page
//create ticket
$new = $api->tickets->create($data);
//update ticket
$updated = $api->tickets->update($data);
//delete ticket
$api->tickets->delete($id);
//view ticket
$existing = $api->tickets->view('1042');
//Responses are simple arrays, e.g.:
$id = $existing['id'];
print_r($existing);
//Tickets for a specific customer
$tickets = $this->tickets->view(['company_id' => $companyId]);
/**---------------------------------------------------------------------------------------------------
contacts
*/
/*
Array
(
[active] => 1
[address] => Bách Khoa, Hà Nội
[company_id] =>
[description] =>
[email] => duybac2001@gmail.com
[id] => 13012771887
[job_title] =>
[language] => vi
[mobile] => 0987934568
[name] => BHEDU
[phone] =>
[time_zone] => Hanoi
[twitter_id] =>
[custom_fields] => Array
(
)
[created_at] => 2017-09-19T03:09:04Z
[updated_at] => 2017-09-19T04:23:07Z
)
*/
//create contact
$data = array(
//'id'=> '',
'address'=> 'Address 1',
'email'=> 'contact2@mail.com',
//'language'=> 'vi',
'mobile'=> '0123456789',
'phone'=> '0123456789',
'name'=> 'Contact 2',
//'time_zone'=> 'Hanoi',
);
$result = $api->contacts->create($data);
print_r($result);
# get all
$contacts = $api->contacts->all();
# get contact info
$contact = $api->contacts->view($contactId);
$contacts = $api->contacts->all(['email' => 'trancongh@gmail.com']);
/**---------------------------------------------------------------------------------------------------
Agents
*/
$me = $api->agents->current();
/**---------------------------------------------------------------------------------------------------
companies
*/
$company = $api->companies->create($data);
/**---------------------------------------------------------------------------------------------------
Groups
*/
//Groups
$deleted = $api->groups->delete($groupId);
/**---------------------------------------------------------------------------------------------------
Forum
*/
//Page 2 with 50 results per page
$page2 = $this->forums->all(['page' => 2, 'per_page' => 50]);
以上是关于php [freshdesk php]客户服务#customer的主要内容,如果未能解决你的问题,请参考以下文章
python [freshdesk - python]客户服务#customer
从 SQL Server 触发器调用 Freshdesk API
javascript [freshdesk节点核心] freshdesk nodejs纯#customer
使用 Swift 2.2 中的 Freshdesk API
javascript [freshdesk节点] #customer
html [freshdesk jquery] #customer