Skip to content

Commit

Permalink
feat: 实现服务号订阅消息, closes #632 (#634)
Browse files Browse the repository at this point in the history
  • Loading branch information
LKI committed Mar 2, 2021
1 parent 5b42fa7 commit 2dd48a8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
17 changes: 17 additions & 0 deletions wechatpy/client/api/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,23 @@ def send_subscribe_template(self, openid, template_id, scene, title, data, url=N
data=post_data,
)

def send_subscribe_message(self, openid, template_id, data, miniprogram=None, page=None):
"""
发送服务号订阅消息
详情请参考
https://developers.weixin.qq.com/doc/offiaccount/Subscription_Messages/api.html#send%E5%8F%91%E9%80%81%E8%AE%A2%E9%98%85%E9%80%9A%E7%9F%A5
备注:page 和 miniprogram 同时不填,无跳转;page 和 miniprogram 同时填写,优先跳转小程序
"""
post_data = optionaldict(
touser=openid,
template_id=template_id,
data=data,
page=page,
miniprogram=miniprogram,
)
return self._post("message/subscribe/bizsend", data=post_data)

def send_msg_menu(self, openid, msgmenu, account=None):
"""
发送菜单消息
Expand Down
2 changes: 1 addition & 1 deletion wechatpy/client/api/wxa.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def send_template_message(

def send_subscribe_message(self, user_id, template_id, data, page=None):
"""
发送订阅消息
发送小程序订阅消息
详情请参考
https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/subscribe-message/subscribeMessage.send.html
"""
Expand Down

0 comments on commit 2dd48a8

Please sign in to comment.