PHP code example of hachi-zzq / bearychat-open-api
1. Go to this page and download the library: Download hachi-zzq/bearychat-open-api library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
hachi-zzq / bearychat-open-api example snippets
$application = new \Hachi\Bearychat\Application([
'token' => 'demo-token'
]);
/**
* 频道列表
*/
$channels = $application->channel->list();
/**
* 发送消息
*/
$message = $application->message->create([
'title' => '这个发送消息的内容',
'attachments' => [
[
'text' => '附件的标题',
'image' => [
[
'url' => 'http://image.url.com'
]
]
]
]
]);
/**
* 用户信息
*/
$me = $application->user->me();
$user = $application->user->list();
/**
* 会话
*/
$session = $application->session_channel->list();
$session = $application->session_channel->create(["=bw52O", "=bw52P"], '这个是讨论组名称');