1. 获取通知设置
接口地址: /merchantapi/user/notifysettings/getSettings
响应示例:
json
{
"code": 1,
"msg": "获取成功",
"data": {
"webhook_url": "https://example.com/webhook", // Webhook推送地址
"webhook_secret": "secret_key", // Webhook密钥
"platform_type": "custom", // 平台类型:custom=自定义,telegram=Telegram,wechat=企业微信,dingtalk=钉钉,feishu=飞书
"chat_id": "", // 聊天ID(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
请求参数:
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| webhook_url | string | 否 | Webhook推送地址 |
| webhook_secret | string | 否 | Webhook密钥,自定义 飞书 钉钉需要 |
| platform_type | string | 否 | 平台类型 |
| chat_id | string | 否 | 聊天ID ,telegram 时使用 |
| 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": "保存成功"
}错误响应:
json
{
"code": 0,
"msg": "Webhook地址格式不正确"
}4.3 测试Webhook推送
- 推送过去json数据即表示为成功推送。测试消息用于测试。
接口地址: /merchantapi/user/notifysettings/testWebhook
请求方式: POST
请求参数:
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| webhook_url | string | 是 | Webhook推送地址 |
| webhook_secret | string | 否 | Webhook密钥 |
| platform_type | string | 否 | 平台类型 |
| chat_id | string | 否 | 聊天ID |
响应示例:
json
{
"code": 1,
"msg": "测试推送成功"
}错误响应:
json
{
"code": 0,
"msg": "推送失败:连接超时"
}4.4 生成并推送当日报表
接口地址: /merchantapi/user/notifysettings/sendDailyReport
响应示例:
json
{
"code": 1,
"msg": "报表已推送",
"data": {
...
}
}说明:
- 无需关注已经适配的非自定义的数据格式,已经适配过,接口不在表达 用 ... 表示