Skip to content

Commit

Permalink
feat: 入群欢迎语素材管理
Browse files Browse the repository at this point in the history
  • Loading branch information
huimingz authored and messense committed Jan 2, 2021
1 parent b749988 commit 5fa03c2
Show file tree
Hide file tree
Showing 6 changed files with 245 additions and 70 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"errcode": 0,
"errmsg": "ok",
"template_id": "msgXXXXXX"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"errcode": 0,
"errmsg": "ok"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"errcode": 0,
"errmsg": "ok"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"errcode": 0,
"errmsg": "ok",
"text":
{
"content":"文本消息内容"
},
"image":
{
"pic_url": "http://p.qpic.cn/pic_wework/XXXXX"
},
"link":
{
"title": "消息标题",
"picurl": "https://example.pic.com/path",
"desc": "消息描述",
"url": "https://example.link.com/path"
},
"miniprogram":
{
"title": "消息标题",
"pic_media_id": "MEDIA_ID",
"appid": "wx8bd80126147df384",
"page": "/path/index"
}
}
60 changes: 60 additions & 0 deletions tests/test_work_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,66 @@ def test_external_contact_get_group_chat_info(self):
res = self.client.external_contact.get_group_chat_info(chat_id="wrOgQhDgAAMYQiS5ol9G7gK9JVAAAA")
self.assertEqual(0, res["errcode"])

def test_external_contact_add_group_welcome_template(self):
with HTTMock(wechat_api_mock):
template = {
"text": {"content": "亲爱的%NICKNAME%用户,你好"},
"image": {
"media_id": "MEDIA_ID",
"pic_url": "http://p.qpic.cn/pic_wework/3474110808/7a6344sdadfwehe42060/0",
},
"link": {
"title": "消息标题",
"picurl": "https://example.pic.com/path",
"desc": "消息描述",
"url": "https://example.link.com/path",
},
"miniprogram": {
"title": "消息标题",
"pic_media_id": "MEDIA_ID",
"appid": "wx8bd80126147dfAAA",
"page": "/path/index",
},
}
res = self.client.external_contact.add_group_welcome_template(template=template, agentid=1000014,)
self.assertEqual(0, res["errcode"])

def test_external_contact_update_group_welcome_template(self):
with HTTMock(wechat_api_mock):
template = {
"text": {"content": "文本消息内容"},
"image": {
"media_id": "MEDIA_ID",
"pic_url": "http://p.qpic.cn/pic_wework/3474110808/7a6344sdadfwehe42060/0",
},
"link": {
"title": "消息标题",
"picurl": "https://example.pic.com/path",
"desc": "消息描述",
"url": "https://example.link.com/path",
},
"miniprogram": {
"title": "消息标题",
"pic_media_id": "MEDIA_ID",
"appid": "wx8bd80126147df384",
"page": "/path/index",
},
}
res = self.client.external_contact.update_group_welcome_template(
template=template, template_id="msgXXXXXXX", agentid=1000014,
)
self.assertEqual(0, res["errcode"])

def test_external_contact_get_group_welcome_template(self):
with HTTMock(wechat_api_mock):
res = self.client.external_contact.get_group_welcome_template(template_id="msgXXXXXXX")
self.assertEqual(0, res["errcode"])

def test_external_contact_del_group_welcome_template(self):
with HTTMock(wechat_api_mock):
res = self.client.external_contact.del_group_welcome_template(template_id="msgXXXXXXX", agentid=1000014)
self.assertEqual(0, res["errcode"])

def test_oa_get_dial_record(self):
with HTTMock(wechat_api_mock):
res = self.client.oa.get_dial_record(start_time=1536508800, end_time=1536940800, offset=0, limit=100)
Expand Down

0 comments on commit 5fa03c2

Please sign in to comment.