Constants

GET

GET = 'get'

POST

POST = 'post'

JSON

JSON = 'json'

API_LISTS

API_LISTS = 'https://api.weixin.qq.com/cgi-bin/customservice/getkflist'

API_ONLINE

API_ONLINE = 'https://api.weixin.qq.com/cgi-bin/customservice/getonlinekflist'

API_DELETE

API_DELETE = 'https://api.weixin.qq.com/customservice/kfaccount/del'

API_UPDATE

API_UPDATE = 'https://api.weixin.qq.com/customservice/kfaccount/update'

API_CREATE

API_CREATE = 'https://api.weixin.qq.com/customservice/kfaccount/add'

API_INVITE_BIND

API_INVITE_BIND = 'https://api.weixin.qq.com/customservice/kfaccount/inviteworker'

API_MESSAGE_SEND

API_MESSAGE_SEND = 'https://api.weixin.qq.com/cgi-bin/message/custom/send'

API_AVATAR_UPLOAD

API_AVATAR_UPLOAD = 'https://api.weixin.qq.com/customservice/kfaccount/uploadheadimg'

API_RECORDS

API_RECORDS = 'https://api.weixin.qq.com/customservice/msgrecord/getrecord'

API_MSG_LIST

API_MSG_LIST = 'https://api.weixin.qq.com/customservice/msgrecord/getmsglist'

Properties

$maxRetries

$maxRetries : integer

Type

integer

Methods

setHttp()

setHttp(\EasyWeChat\Core\Http  $http) : $this

Set the http instance.

Parameters

\EasyWeChat\Core\Http $http

Returns

$this

setAccessToken()

setAccessToken(\EasyWeChat\Core\AccessToken  $accessToken) : $this

Set the request token.

Parameters

\EasyWeChat\Core\AccessToken $accessToken

Returns

$this

maxRetries()

maxRetries(integer  $retries) 

Parameters

integer $retries

parseJSON()

parseJSON(string  $method, array  $args) : \EasyWeChat\Support\Collection

Parse JSON from response and check error.

Parameters

string $method
array $args

Throws

\EasyWeChat\Core\Exceptions\HttpException

Returns

\EasyWeChat\Support\Collection

| null

create()

create(string  $account, string  $nickname) : \EasyWeChat\Support\Collection

Create a staff.

Parameters

string $account
string $nickname

Returns

\EasyWeChat\Support\Collection

update()

update(string  $account, string  $nickname) : \EasyWeChat\Support\Collection

Update a staff.

Parameters

string $account
string $nickname

Returns

\EasyWeChat\Support\Collection

invite()

invite(string  $account, string  $wechatId) : \EasyWeChat\Support\Collection

Invite a staff.

Parameters

string $account
string $wechatId

Returns

\EasyWeChat\Support\Collection

avatar()

avatar(string  $account, string  $path) : \EasyWeChat\Support\Collection

Set staff avatar.

Parameters

string $account
string $path

Returns

\EasyWeChat\Support\Collection

send()

send(string|array  $message) : \EasyWeChat\Support\Collection

Send a message.

Parameters

string|array $message

Returns

\EasyWeChat\Support\Collection

records()

records(integer  $startTime, integer  $endTime, integer  $page = 1, integer  $pageSize = 10) : \EasyWeChat\Support\Collection

Get staff session history.

Parameters

integer $startTime
integer $endTime
integer $page
integer $pageSize

Returns

\EasyWeChat\Support\Collection

messages()

messages(integer  $startTime, integer  $endTime, integer  $msgId = 1, integer  $number = 10000) : \EasyWeChat\Support\Collection

获取聊天记录.

Parameters

integer $startTime
integer $endTime
integer $msgId
integer $number

Returns

\EasyWeChat\Support\Collection

registerHttpMiddlewares()

registerHttpMiddlewares() 

Register Guzzle middlewares.

accessTokenMiddleware()

accessTokenMiddleware() : \Closure

Attache access token to request query.

Returns

\Closure

logMiddleware()

logMiddleware() : \Closure

Log the request.

Returns

\Closure

retryMiddleware()

retryMiddleware() : \Closure

Return retry middleware.

Returns

\Closure

checkAndThrow()

checkAndThrow(array  $contents) 

Check the array data errors, and Throw exception when the contents contains error.

Parameters

array $contents

Throws

\EasyWeChat\Core\Exceptions\HttpException