feat: add send many account mode

This commit is contained in:
engigu
2025-12-14 12:43:09 +08:00
parent 2125ddc853
commit 5e20533aa9
26 changed files with 1547 additions and 793 deletions
+46
View File
@@ -38,6 +38,7 @@ POST /api/v2/message/send
| token | string | 是 | 加密的模板 Token |
| title | string | 是 | 消息标题 |
| placeholders | object | 否 | 占位符键值对 |
| recipients | array | 条件必填 | 动态接收者列表(群发模式)🆕 |
### 参数说明
@@ -59,6 +60,19 @@ POST /api/v2/message/send
- 如果模板中定义了占位符但未传递,将使用默认值
- 如果既未传递也无默认值,占位符将保持原样
#### recipients 🆕
- 动态接收者列表,用于群发场景
- 格式为字符串数组:`["user1@example.com", "user2@example.com"]`
- **条件必填**:如果模板配置了动态接收实例,此参数为必填
- **支持的渠道**
- ✅ 邮件 - 多个收件人邮箱地址
- ✅ 微信公众号 - 多个用户 OpenID
- **使用限制**
- 一个模板只能配置一个动态接收实例
- 动态接收实例不能与固定接收实例混合使用
- 建议控制接收者数量,避免触发渠道限流
## 请求示例
### 基本示例
@@ -165,6 +179,38 @@ axios.post(url, data)
});
```
### 动态接收者示例(群发)🆕
```javascript
const axios = require('axios');
const url = 'http://your-domain/api/v2/message/send';
const data = {
token: 'a3541c2f0d3e1b4a5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b',
title: '活动通知',
placeholders: {
activity_name: '双十二大促',
start_time: '2024-12-12 00:00:00',
discount: '全场8折'
},
recipients: [
'user1@example.com',
'user2@example.com',
'user3@example.com'
]
};
axios.post(url, data)
.then(response => {
console.log(response.data);
console.log(`成功发送给 ${response.data.data.count} 个接收者`);
})
.catch(error => {
console.error('Error:', error);
});
```
### Java 示例
```java