mirror of
https://github.com/w7corp/easywechat.git
synced 2025-01-22 11:32:08 +00:00
群发消息文档
parent
82c4f4e6e6
commit
3f94f67e6f
38
群发消息.md
Normal file
38
群发消息.md
Normal file
@ -0,0 +1,38 @@
|
||||
微信的群发消息接口有各种乱七八糟的注意事项及限制,具体请阅读微信官方文档:http://mp.weixin.qq.com/wiki/15/5380a4e6f02f2ffdc7981a8ed7a40753.html
|
||||
|
||||
本 SDK 由 `Overtrue\Wechat\Broadcast` 提供微信群发相关服务。
|
||||
|
||||
### 获取实例
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
use Overtrue\Wechat\Broadcast;
|
||||
|
||||
$appId = 'wx3cf0f39249eb0e60';
|
||||
$secret = 'f1c242f4f28f735d4687abb469072a29';
|
||||
|
||||
$broadcast = new Broadcast($appId, $secret);
|
||||
```
|
||||
|
||||
### API
|
||||
|
||||
+ `$broadcast->send($message)->to();` 群发消息给所有粉丝
|
||||
+ `$broadcast->send($message)->to($groupId);` 群发消息给指定组
|
||||
+ `$broadcast->send($message)->to(array($openId1, $openId2));` 群发消息给指定用户,可以是一个用户,也可以使多个用户,但必须是数组
|
||||
+ `$broadcast->send($message)->preview($groupId);` 发送预览群发消息给指定的openid用户
|
||||
+ `$broadcast->send($message)->preview($wxname, Broadcast::PREVIEW_BY_WXH);` 发送预览群发消息给指定的微信号用户
|
||||
+ `$broadcast->delete($msgId);` 删除群发消息
|
||||
+ `$broadcast->status($msgId);` 查询群发消息发送状态
|
||||
|
||||
这里的 `$message` 可以是:
|
||||
|
||||
+ `$message = Message::make('mp_news')->media_id('123dsdajkasd231jhksad');` 图文
|
||||
+ `$message = Message::make('text')->content('CONTENT');` 文本
|
||||
+ `$message = Message::make('voice')->media_id('123dsdajkasd231jhksad');` 语音
|
||||
+ `$message = Message::make('image')->media_id('123dsdajkasd231jhksad');` 图片
|
||||
+ `$message = Message::make('mp_video')->media_id('IhdaAQXuvJtGzwwc0abfXnzeezfO0NgPK6AQYShD8RQYMTtfzbLdBIQkQziv2XJc');` 群发视频消息给组或预览群发视频消息给用户
|
||||
+ `$message = Message::make('video')->media_id('123dsdajkasd231jhksad')->title('TITLE')->description('DESCRIPTION');` 群发视频消息给指定用户
|
||||
+ `$message = Message::make('wxcard')->card_id('123dsdajkasd231jhksad');` 卡券
|
||||
|
||||
有关群发信息的更多细节请参考微信官方文档:http://mp.weixin.qq.com/wiki/15/5380a4e6f02f2ffdc7981a8ed7a40753.html
|
Loading…
Reference in New Issue
Block a user