1. 获取通知设置
接口地址: /merchantapi/user/notifysettings/getSettings
响应示例:
json
{
"code": 1,
"msg": "获取成功",
"data": {
"telegram_bot_username": "demo_bot", // 平台配置的 Bot 用户名
"telegram_bot_link": "https://t.me/demo_bot?start=bind_xxx", // 点击跳转到 Bot 的授权链接
"telegram_configured": true, // 平台是否已完成 Telegram 配置
"telegram_authorized": false, // 当前商户是否已完成授权
"telegram_chat_id": "", // 当前已绑定的 Telegram Chat ID
"telegram_username": "demo_name", // 当前已绑定的 Telegram 用户名
"telegram_first_name": "Demo", // 当前已绑定的 Telegram 昵称
"telegram_authorized_at": 1748764800, // 当前 Telegram 授权时间戳
"stock_alert_enabled": true, // 库存预警通知:true=开启,false=关闭
"trade_notify_enabled": true, // 交易通知:true=开启,false=关闭
"aftersale_notify_enabled": true, // 售后通知:true=开启,false=关闭
"withdraw_notify_enabled": true // 提现通知:true=开启,false=关闭
}
}2. 保存通知设置
接口地址: /merchantapi/user/notifysettings/saveSettings
请求参数:
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| stock_alert_enabled | boolean | 否 | 库存预警通知:true=开启,false=关闭 |
| trade_notify_enabled | boolean | 否 | 交易通知:true=开启,false=关闭 |
| aftersale_notify_enabled | boolean | 否 | 售后通知:true=开启,false=关闭 |
| withdraw_notify_enabled | boolean | 否 | 提现通知:true=开启,false=关闭 |
响应示例:
json
{
"code": 1,
"msg": "保存成功"
}3. 解除 Telegram 授权
接口地址: /merchantapi/user/notifysettings/unbindTelegram
响应示例:
json
{
"code": 1,
"msg": "已解除 Telegram 授权"
}4. 测试 Webhook 推送
接口地址: /merchantapi/user/notifysettings/testWebhook
请求方式: POST
请求参数:
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| webhook_url | string | 是 | Webhook 地址 |
| webhook_secret | string | 否 | Webhook 密钥 |
| platform_type | string | 否 | 平台类型,默认 custom |
| chat_id | string | 否 | 接收方 Chat ID |
响应示例:
json
{
"code": 1,
"msg": "测试推送成功"
}说明:
webhook_url为空时返回“请输入Webhook地址”webhook_url格式不合法时返回“Webhook地址格式不正确”
5. 生成并推送当日报表
接口地址: /merchantapi/user/notifysettings/sendDailyReport
请求方式: POST
请求参数: 无
响应示例:
json
{
"code": 1,
"msg": "报表已推送",
"data": {}
}说明:
- 报表生成失败时返回失败原因
- 报表生成成功但推送失败时,
code仍为 1,msg为“报表生成成功,但推送失败(请检查Webhook配置)”,data返回报表内容
6. 使用说明
- 商户无需再自行填写 Webhook、Bot Token 或 Chat ID。
- 页面点击授权按钮后,会跳转到平台配置的 Telegram Bot。
- 进入 Bot 后,请点击底部
Start按钮完成授权。 - 授权完成后,返回本页会自动刷新授权状态,并显示当前绑定的 Telegram 账号信息。
- 如需更换接收账号,可先解除绑定,再重新点击授权按钮完成绑定。