一、钉钉自定义机器人介绍
==========================
钉钉机器人是钉钉群的一个高级扩展功能,但使用起来却非常简单,只需要注册一个钉钉账号,就可以将第三方服务信息聚合到钉钉群中,实现信息的自动同步。
常见的使用场景:
1、聚合Github、Gitlab等源码管理服务,实现源码更新同步;
2、聚合Trello、JIRA等项目协调服务,实现项目信息同步;
3、机器人支持Webhook自定义接入,就可以实现更多可能性,例如:将运维报警、产品数据、自动化测试报告、工作&生活日程安排(上班打卡、下班吃饭、健身、读书、生日、纪念日...)的提醒;
目前自定义机器人支持文本(text)、链接(link)、markdown三种消息格式,五种消息类型,详细信息请参考\ `自定义机器人官方文档 <https://open.dingtalk.com/document/group/custom-robot-access>`__
二、安装使用
============
这么好用的功能,只要在钉钉群中添加机器人,得到Webhoo地址即可。接下来,我们先在命令行终端一睹为快吧:
::
curl 'https://oapi.dingtalk.com/robot/send?access_token=xxxxxxxx' \
-H 'Content-Type: application/json' \
-d '
{"msgtype": "text",
"text": {
"content": "我就是我, 是不一样的烟火"
}
}'
由于各种消息调用,官方只提供Java语言的封装,平时使用Python比较多,为了更方便平时自动化项目的使用,周末花了点时间用Python语言对各种消息类型进行了一一封装,代码已开源在GitHub上,同时也上传了PyPI。
| 1、项目源码地址如下:\ `DingtalkChatbot <https://github.com/zhuifengshen/DingtalkChatbot>`__
| 2、安装和更新命令如下:
::
pip install DingtalkChatbot
pip install -U DingtalkChatbot
3、支持功能如下:
- 支持Text消息;
- 支持Link消息;
- 支持image表情消息;
- 支持Markdown消息;
- 支持ActionCard消息;
- 支持消息发送失败时自动通知(默认fail_notice=False不通知,开发者可直接根据返回的消息发送结果自行处理)
- 支持设置消息链接打开方式(默认pc_slide=False跳转至浏览器打开;pc_slide=True则在PC端侧边栏打开)
- 支持钉钉官方消息发送频率限制,即每个机器人每分钟最多发送20条,不用担心触发限流;
- 支持新版钉钉机器人加密设置;
- 支持Python2、Python3;
- 支持钉钉企业内部机器人\ `即outgoing机器人的消息发送 <https://open.dingtalk.com/document/group/enterprise-created-chatbot>`__;
三、各消息类型使用示例
======================
|image0|
.. code:: python
from dingtalkchatbot.chatbot import DingtalkChatbot, ActionCard, CardItem
# WebHook地址
webhook = 'https://oapi.dingtalk.com/robot/send?access_token=这里填写自己钉钉群自定义机器人的token'
secret = 'SEC11b9...这里填写自己的加密设置密钥' # 可选:创建机器人勾选“加签”选项时使用
# 初始化机器人小丁
xiaoding = DingtalkChatbot(webhook) # 方式一:通常初始化方式
xiaoding = DingtalkChatbot(webhook, secret=secret) # 方式二:勾选“加签”选项时使用(v1.5以上新功能)
xiaoding = DingtalkChatbot(webhook, pc_slide=True) # 方式三:设置消息链接在PC端侧边栏打开(v1.5以上新功能)
# Text消息@所有人
xiaoding.send_text(msg='我就是小丁,小丁就是我!', is_at_all=True)
|image1|
.. code:: python
# Text消息之@指定用户
at_mobiles = ['这里填写需要提醒的用户的手机号码,字符串或数字都可以']
xiaoding.send_text(msg='我就是小丁,小丁就是我!', at_mobiles=at_mobiles)
|image9|
.. code:: python
# image表情消息
xiaoding.send_image(pic_url='http://uc-test-manage-00.umlife.net/jenkins/pic/flake8.png')
|image2|
.. code:: python
# Link消息
xiaoding.send_link(title='万万没想到,李小璐竟然...', text='故事是这样子的...', message_url='http://www.kwongwah.com.my/?p=454748", pic_url="https://pbs.twimg.com/media/CEwj7EDWgAE5eIF.jpg')
|image3|
.. code:: python
# Markdown消息@所有人
xiaoding.send_markdown(title='氧气文字', text='#### 广州天气\n'
'> 9度,西北风1级,空气良89,相对温度73%\n\n'
'> ![美景](http://www.sinaimg.cn/dy/slidenews/5_img/2013_28/453_28488_469248.jpg)\n'
'> ###### 10点20分发布 [天气](http://www.thinkpage.cn/) \n',
is_at_all=True)
|image4|
.. code:: python
# Markdown消息@指定用户
xiaoding.send_markdown(title='氧气文字', text='#### 广州天气 @1882516xxxx\n'
'> 9度,西北风1级,空气良89,相对温度73%\n\n'
'> ![美景](http://www.sinaimg.cn/dy/slidenews/5_img/2013_28/453_28488_469248.jpg)\n'
'> ###### 10点20分发布 [天气](http://www.thinkpage.cn/) \n',
at_mobiles=at_mobiles)
|image5|
.. code:: python
# FeedCard消息类型(注意:当发送FeedCard时,pic_url需要传入参数值,必选)
card1 = CardItem(title="氧气美女", url="https://www.dingtalk.com/", pic_url="https://unzippedtv.com/wp-content/uploads/sites/28/2016/02/asian.jpg")
card2 = CardItem(title="氧眼美女", url="https://www.dingtalk.com/", pic_url="https://unzippedtv.com/wp-content/uploads/sites/28/2016/02/asian.jpg")
card3 = CardItem(title="氧神美女", url="https://www.dingtalk.com/", pic_url="https://unzippedtv.com/wp-content/uploads/sites/28/2016/02/asian.jpg")
cards = [card1, card2, card3]
xiaoding.send_feed_card(cards)
|image6|
.. code:: python
# ActionCard整体跳转消息类型
btns1 = [CardItem(title="查看详情", url="https://www.dingtalk.com/")]
actioncard1 = ActionCard(title='万万没想到,竟然...',
text='![选择](http://www.songshan.es/wp-content/uploads/2016/01/Yin-Yang.png) \n### 故事是这样子的...',
btns=btns1,
btn_orientation=1,
hide_avatar=1)
xiaoding.send_action_card(actioncard1)
|image7|
.. code:: python
# ActionCard独立跳转消息类型(双选项)
btns2 = [CardItem(title="支持", url="https://www.dingtalk.com/"), CardItem(title="反对", url="https://www.dingtalk.com/")]
actioncard2 = ActionCard(title='万万没想到,竟然...',
text='![选择](http://www.songshan.es/wp-content/uploads/2016/01/Yin-Yang.png) \n### 故事是这样子的...',
btns=btns2,
btn_orientation=1,
hide_avatar=1)
xiaoding.send_action_card(actioncard2)
|image8|
.. code:: python
# ActionCard独立跳转消息类型(列表选项)
btns3 = [CardItem(title="支持", url="https://www.dingtalk.com/"), CardItem(title="中立", url="https://www.dingtalk.com/"), CardItem(title="反对", url="https://www.dingtalk.com/")]
actioncard3 = ActionCard(title='万万没想到,竟然...',
text='![选择](http://www.songshan.es/wp-content/uploads/2016/01/Yin-Yang.png) \n### 故事是这样子的...',
btns=btns3,
btn_orientation=1,
hide_avatar=1)
xiaoding.send_action_card(actioncard3)
四、常见注意事项
===========================
- 1、at_mobiles列表上的手机号默认自动添加到消息文本末尾,才有@的效果,如需自定义在消息文本@的位置,可将参数is_auto_at设置为False即可,同时支持@多个手机号;
- 2、如果钉钉机器人消息中的图片链接使用Http协议,可以在钉钉客户端正常加载显示,但无法在钉钉网页版显示,需要更改为Https协议;
- 3、钉钉机器人消息中的链接默认跳转至浏览器打开(即:pc_slide=False),如果需要直接在客户端侧边栏打开,设置pc_slide为True即可;
- 4、当前钉钉自定义机器人官方尚不支持应答机制(即在群里成员在聊天@机器人),此功能需要使用钉钉企业内部开发机器人实现(即Outgoing机器人;
**哥们,更多使用场景,现在尽情展开想象吧...**
(如果对你有帮助的话,欢迎**star**)
.. |image0| image:: https://raw.githubusercontent.com/zhuifengshen/DingtalkChatbot/master/img/text_at_all.png
.. |image1| image:: https://raw.githubusercontent.com/zhuifengshen/DingtalkChatbot/master/img/text_at_one.png
.. |image2| image:: https://raw.githubusercontent.com/zhuifengshen/DingtalkChatbot/master/img/link.png
.. |image3| image:: https://raw.githubusercontent.com/zhuifengshen/DingtalkChatbot/master/img/markdown_at_all.png
.. |image4| image:: https://raw.githubusercontent.com/zhuifengshen/DingtalkChatbot/master/img/markdown_at_one.png
.. |image5| image:: https://raw.githubusercontent.com/zhuifengshen/DingtalkChatbot/master/img/feedcard.png
.. |image6| image:: https://raw.githubusercontent.com/zhuifengshen/DingtalkChatbot/master/img/global_actioncard.png
.. |image7| image:: https://raw.githubusercontent.com/zhuifengshen/DingtalkChatbot/master/img/select_actioncard.png
.. |image8| image:: https://raw.githubusercontent.com/zhuifengshen/DingtalkChatbot/master/img/multi_actioncard.png
.. |image9| image:: https://raw.githubusercontent.com/zhuifengshen/DingtalkChatbot/master/img/image_msg.png
Raw data
{
"_id": null,
"home_page": "https://github.com/zhuifengshen/DingtalkChatbot",
"name": "DingtalkChatbot",
"maintainer": "",
"docs_url": null,
"requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4",
"maintainer_email": "",
"keywords": "\u9489\u9489 \u673a\u5668\u4eba dingtalk chatbot robot bot",
"author": "devin",
"author_email": "1324556701@qq.com",
"download_url": "https://files.pythonhosted.org/packages/b1/8b/52243aed0a1a449ef2fedc42607b5ce9bdaa2f771ef9c7b8c1675141c8d6/DingtalkChatbot-1.5.7.tar.gz",
"platform": null,
"description": "\u4e00\u3001\u9489\u9489\u81ea\u5b9a\u4e49\u673a\u5668\u4eba\u4ecb\u7ecd\n==========================\n\n\u9489\u9489\u673a\u5668\u4eba\u662f\u9489\u9489\u7fa4\u7684\u4e00\u4e2a\u9ad8\u7ea7\u6269\u5c55\u529f\u80fd\uff0c\u4f46\u4f7f\u7528\u8d77\u6765\u5374\u975e\u5e38\u7b80\u5355\uff0c\u53ea\u9700\u8981\u6ce8\u518c\u4e00\u4e2a\u9489\u9489\u8d26\u53f7\uff0c\u5c31\u53ef\u4ee5\u5c06\u7b2c\u4e09\u65b9\u670d\u52a1\u4fe1\u606f\u805a\u5408\u5230\u9489\u9489\u7fa4\u4e2d\uff0c\u5b9e\u73b0\u4fe1\u606f\u7684\u81ea\u52a8\u540c\u6b65\u3002\n\n\u5e38\u89c1\u7684\u4f7f\u7528\u573a\u666f\uff1a\n\n1\u3001\u805a\u5408Github\u3001Gitlab\u7b49\u6e90\u7801\u7ba1\u7406\u670d\u52a1\uff0c\u5b9e\u73b0\u6e90\u7801\u66f4\u65b0\u540c\u6b65\uff1b\n\n2\u3001\u805a\u5408Trello\u3001JIRA\u7b49\u9879\u76ee\u534f\u8c03\u670d\u52a1\uff0c\u5b9e\u73b0\u9879\u76ee\u4fe1\u606f\u540c\u6b65\uff1b\n\n3\u3001\u673a\u5668\u4eba\u652f\u6301Webhook\u81ea\u5b9a\u4e49\u63a5\u5165\uff0c\u5c31\u53ef\u4ee5\u5b9e\u73b0\u66f4\u591a\u53ef\u80fd\u6027\uff0c\u4f8b\u5982\uff1a\u5c06\u8fd0\u7ef4\u62a5\u8b66\u3001\u4ea7\u54c1\u6570\u636e\u3001\u81ea\u52a8\u5316\u6d4b\u8bd5\u62a5\u544a\u3001\u5de5\u4f5c&\u751f\u6d3b\u65e5\u7a0b\u5b89\u6392\uff08\u4e0a\u73ed\u6253\u5361\u3001\u4e0b\u73ed\u5403\u996d\u3001\u5065\u8eab\u3001\u8bfb\u4e66\u3001\u751f\u65e5\u3001\u7eaa\u5ff5\u65e5...\uff09\u7684\u63d0\u9192\uff1b\n\n\u76ee\u524d\u81ea\u5b9a\u4e49\u673a\u5668\u4eba\u652f\u6301\u6587\u672c\uff08text\uff09\u3001\u94fe\u63a5\uff08link\uff09\u3001markdown\u4e09\u79cd\u6d88\u606f\u683c\u5f0f\uff0c\u4e94\u79cd\u6d88\u606f\u7c7b\u578b\uff0c\u8be6\u7ec6\u4fe1\u606f\u8bf7\u53c2\u8003\\ `\u81ea\u5b9a\u4e49\u673a\u5668\u4eba\u5b98\u65b9\u6587\u6863 <https://open.dingtalk.com/document/group/custom-robot-access>`__\n\n\u4e8c\u3001\u5b89\u88c5\u4f7f\u7528\n============\n\n\u8fd9\u4e48\u597d\u7528\u7684\u529f\u80fd\uff0c\u53ea\u8981\u5728\u9489\u9489\u7fa4\u4e2d\u6dfb\u52a0\u673a\u5668\u4eba\uff0c\u5f97\u5230Webhoo\u5730\u5740\u5373\u53ef\u3002\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5148\u5728\u547d\u4ee4\u884c\u7ec8\u7aef\u4e00\u7779\u4e3a\u5feb\u5427\uff1a\n\n::\n\n curl 'https://oapi.dingtalk.com/robot/send?access_token=xxxxxxxx' \\\n \u00a0\u00a0\u00a0-H 'Content-Type: application/json' \\\n \u00a0\u00a0\u00a0-d '\n \u00a0\u00a0{\"msgtype\": \"text\",\n \u00a0\u00a0\u00a0\u00a0\"text\": {\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"content\": \"\u6211\u5c31\u662f\u6211, \u662f\u4e0d\u4e00\u6837\u7684\u70df\u706b\"\n \u00a0\u00a0\u00a0\u00a0\u00a0}\n \u00a0\u00a0}'\n\n\u7531\u4e8e\u5404\u79cd\u6d88\u606f\u8c03\u7528\uff0c\u5b98\u65b9\u53ea\u63d0\u4f9bJava\u8bed\u8a00\u7684\u5c01\u88c5\uff0c\u5e73\u65f6\u4f7f\u7528Python\u6bd4\u8f83\u591a\uff0c\u4e3a\u4e86\u66f4\u65b9\u4fbf\u5e73\u65f6\u81ea\u52a8\u5316\u9879\u76ee\u7684\u4f7f\u7528\uff0c\u5468\u672b\u82b1\u4e86\u70b9\u65f6\u95f4\u7528Python\u8bed\u8a00\u5bf9\u5404\u79cd\u6d88\u606f\u7c7b\u578b\u8fdb\u884c\u4e86\u4e00\u4e00\u5c01\u88c5\uff0c\u4ee3\u7801\u5df2\u5f00\u6e90\u5728GitHub\u4e0a\uff0c\u540c\u65f6\u4e5f\u4e0a\u4f20\u4e86PyPI\u3002\n\n| 1\u3001\u9879\u76ee\u6e90\u7801\u5730\u5740\u5982\u4e0b\uff1a\\ `DingtalkChatbot <https://github.com/zhuifengshen/DingtalkChatbot>`__\n| 2\u3001\u5b89\u88c5\u548c\u66f4\u65b0\u547d\u4ee4\u5982\u4e0b\uff1a\n\n::\n\n pip install DingtalkChatbot\n pip install -U DingtalkChatbot\n\n3\u3001\u652f\u6301\u529f\u80fd\u5982\u4e0b\uff1a\n\n- \u652f\u6301Text\u6d88\u606f\uff1b\n- \u652f\u6301Link\u6d88\u606f\uff1b\n- \u652f\u6301image\u8868\u60c5\u6d88\u606f\uff1b\n- \u652f\u6301Markdown\u6d88\u606f\uff1b\n- \u652f\u6301ActionCard\u6d88\u606f\uff1b\n- \u652f\u6301\u6d88\u606f\u53d1\u9001\u5931\u8d25\u65f6\u81ea\u52a8\u901a\u77e5\uff08\u9ed8\u8ba4fail_notice=False\u4e0d\u901a\u77e5\uff0c\u5f00\u53d1\u8005\u53ef\u76f4\u63a5\u6839\u636e\u8fd4\u56de\u7684\u6d88\u606f\u53d1\u9001\u7ed3\u679c\u81ea\u884c\u5904\u7406\uff09\n- \u652f\u6301\u8bbe\u7f6e\u6d88\u606f\u94fe\u63a5\u6253\u5f00\u65b9\u5f0f\uff08\u9ed8\u8ba4pc_slide=False\u8df3\u8f6c\u81f3\u6d4f\u89c8\u5668\u6253\u5f00\uff1bpc_slide=True\u5219\u5728PC\u7aef\u4fa7\u8fb9\u680f\u6253\u5f00\uff09\n- \u652f\u6301\u9489\u9489\u5b98\u65b9\u6d88\u606f\u53d1\u9001\u9891\u7387\u9650\u5236\uff0c\u5373\u6bcf\u4e2a\u673a\u5668\u4eba\u6bcf\u5206\u949f\u6700\u591a\u53d1\u900120\u6761\uff0c\u4e0d\u7528\u62c5\u5fc3\u89e6\u53d1\u9650\u6d41\uff1b\n- \u652f\u6301\u65b0\u7248\u9489\u9489\u673a\u5668\u4eba\u52a0\u5bc6\u8bbe\u7f6e\uff1b\n- \u652f\u6301Python2\u3001Python3\uff1b\n- \u652f\u6301\u9489\u9489\u4f01\u4e1a\u5185\u90e8\u673a\u5668\u4eba\\ `\u5373outgoing\u673a\u5668\u4eba\u7684\u6d88\u606f\u53d1\u9001 <https://open.dingtalk.com/document/group/enterprise-created-chatbot>`__\uff1b\n\n\n\u4e09\u3001\u5404\u6d88\u606f\u7c7b\u578b\u4f7f\u7528\u793a\u4f8b\n======================\n\n|image0|\n\n.. code:: python\n\n from dingtalkchatbot.chatbot import DingtalkChatbot, ActionCard, CardItem\n # WebHook\u5730\u5740\n webhook = 'https://oapi.dingtalk.com/robot/send?access_token=\u8fd9\u91cc\u586b\u5199\u81ea\u5df1\u9489\u9489\u7fa4\u81ea\u5b9a\u4e49\u673a\u5668\u4eba\u7684token'\n secret = 'SEC11b9...\u8fd9\u91cc\u586b\u5199\u81ea\u5df1\u7684\u52a0\u5bc6\u8bbe\u7f6e\u5bc6\u94a5' # \u53ef\u9009\uff1a\u521b\u5efa\u673a\u5668\u4eba\u52fe\u9009\u201c\u52a0\u7b7e\u201d\u9009\u9879\u65f6\u4f7f\u7528\n # \u521d\u59cb\u5316\u673a\u5668\u4eba\u5c0f\u4e01\n xiaoding = DingtalkChatbot(webhook) # \u65b9\u5f0f\u4e00\uff1a\u901a\u5e38\u521d\u59cb\u5316\u65b9\u5f0f\n xiaoding = DingtalkChatbot(webhook, secret=secret) # \u65b9\u5f0f\u4e8c\uff1a\u52fe\u9009\u201c\u52a0\u7b7e\u201d\u9009\u9879\u65f6\u4f7f\u7528\uff08v1.5\u4ee5\u4e0a\u65b0\u529f\u80fd\uff09\n xiaoding = DingtalkChatbot(webhook, pc_slide=True) # \u65b9\u5f0f\u4e09\uff1a\u8bbe\u7f6e\u6d88\u606f\u94fe\u63a5\u5728PC\u7aef\u4fa7\u8fb9\u680f\u6253\u5f00\uff08v1.5\u4ee5\u4e0a\u65b0\u529f\u80fd\uff09\n # Text\u6d88\u606f@\u6240\u6709\u4eba\n xiaoding.send_text(msg='\u6211\u5c31\u662f\u5c0f\u4e01\uff0c\u5c0f\u4e01\u5c31\u662f\u6211\uff01', is_at_all=True)\n\n|image1|\n\n.. code:: python\n\n # Text\u6d88\u606f\u4e4b@\u6307\u5b9a\u7528\u6237\n at_mobiles = ['\u8fd9\u91cc\u586b\u5199\u9700\u8981\u63d0\u9192\u7684\u7528\u6237\u7684\u624b\u673a\u53f7\u7801\uff0c\u5b57\u7b26\u4e32\u6216\u6570\u5b57\u90fd\u53ef\u4ee5']\n xiaoding.send_text(msg='\u6211\u5c31\u662f\u5c0f\u4e01\uff0c\u5c0f\u4e01\u5c31\u662f\u6211\uff01', at_mobiles=at_mobiles)\n\n\n|image9|\n\n.. code:: python\n\n # image\u8868\u60c5\u6d88\u606f\n xiaoding.send_image(pic_url='http://uc-test-manage-00.umlife.net/jenkins/pic/flake8.png')\n\n\n|image2|\n\n.. code:: python\n\n # Link\u6d88\u606f\n xiaoding.send_link(title='\u4e07\u4e07\u6ca1\u60f3\u5230\uff0c\u674e\u5c0f\u7490\u7adf\u7136...', text='\u6545\u4e8b\u662f\u8fd9\u6837\u5b50\u7684...', message_url='http://www.kwongwah.com.my/?p=454748\", pic_url=\"https://pbs.twimg.com/media/CEwj7EDWgAE5eIF.jpg')\n\n|image3|\n\n.. code:: python\n\n # Markdown\u6d88\u606f@\u6240\u6709\u4eba\n xiaoding.send_markdown(title='\u6c27\u6c14\u6587\u5b57', text='#### \u5e7f\u5dde\u5929\u6c14\\n'\n '> 9\u5ea6\uff0c\u897f\u5317\u98ce1\u7ea7\uff0c\u7a7a\u6c14\u826f89\uff0c\u76f8\u5bf9\u6e29\u5ea673%\\n\\n'\n '> ![\u7f8e\u666f](http://www.sinaimg.cn/dy/slidenews/5_img/2013_28/453_28488_469248.jpg)\\n'\n '> ###### 10\u70b920\u5206\u53d1\u5e03 [\u5929\u6c14](http://www.thinkpage.cn/) \\n',\n is_at_all=True)\n\n|image4|\n\n.. code:: python\n\n # Markdown\u6d88\u606f@\u6307\u5b9a\u7528\u6237\n xiaoding.send_markdown(title='\u6c27\u6c14\u6587\u5b57', text='#### \u5e7f\u5dde\u5929\u6c14 @1882516xxxx\\n'\n '> 9\u5ea6\uff0c\u897f\u5317\u98ce1\u7ea7\uff0c\u7a7a\u6c14\u826f89\uff0c\u76f8\u5bf9\u6e29\u5ea673%\\n\\n'\n '> ![\u7f8e\u666f](http://www.sinaimg.cn/dy/slidenews/5_img/2013_28/453_28488_469248.jpg)\\n'\n '> ###### 10\u70b920\u5206\u53d1\u5e03 [\u5929\u6c14](http://www.thinkpage.cn/) \\n',\n at_mobiles=at_mobiles)\n\n|image5|\n\n.. code:: python\n\n # FeedCard\u6d88\u606f\u7c7b\u578b\uff08\u6ce8\u610f\uff1a\u5f53\u53d1\u9001FeedCard\u65f6\uff0cpic_url\u9700\u8981\u4f20\u5165\u53c2\u6570\u503c\uff0c\u5fc5\u9009\uff09\n card1 = CardItem(title=\"\u6c27\u6c14\u7f8e\u5973\", url=\"https://www.dingtalk.com/\", pic_url=\"https://unzippedtv.com/wp-content/uploads/sites/28/2016/02/asian.jpg\")\n card2 = CardItem(title=\"\u6c27\u773c\u7f8e\u5973\", url=\"https://www.dingtalk.com/\", pic_url=\"https://unzippedtv.com/wp-content/uploads/sites/28/2016/02/asian.jpg\")\n card3 = CardItem(title=\"\u6c27\u795e\u7f8e\u5973\", url=\"https://www.dingtalk.com/\", pic_url=\"https://unzippedtv.com/wp-content/uploads/sites/28/2016/02/asian.jpg\")\n cards = [card1, card2, card3]\n xiaoding.send_feed_card(cards)\n\n|image6|\n\n.. code:: python\n\n # ActionCard\u6574\u4f53\u8df3\u8f6c\u6d88\u606f\u7c7b\u578b\n btns1 = [CardItem(title=\"\u67e5\u770b\u8be6\u60c5\", url=\"https://www.dingtalk.com/\")]\n actioncard1 = ActionCard(title='\u4e07\u4e07\u6ca1\u60f3\u5230\uff0c\u7adf\u7136...',\n text='![\u9009\u62e9](http://www.songshan.es/wp-content/uploads/2016/01/Yin-Yang.png) \\n### \u6545\u4e8b\u662f\u8fd9\u6837\u5b50\u7684...',\n btns=btns1,\n btn_orientation=1,\n hide_avatar=1)\n xiaoding.send_action_card(actioncard1)\n\n|image7|\n\n.. code:: python\n\n # ActionCard\u72ec\u7acb\u8df3\u8f6c\u6d88\u606f\u7c7b\u578b\uff08\u53cc\u9009\u9879\uff09\n btns2 = [CardItem(title=\"\u652f\u6301\", url=\"https://www.dingtalk.com/\"), CardItem(title=\"\u53cd\u5bf9\", url=\"https://www.dingtalk.com/\")]\n actioncard2 = ActionCard(title='\u4e07\u4e07\u6ca1\u60f3\u5230\uff0c\u7adf\u7136...',\n text='![\u9009\u62e9](http://www.songshan.es/wp-content/uploads/2016/01/Yin-Yang.png) \\n### \u6545\u4e8b\u662f\u8fd9\u6837\u5b50\u7684...',\n btns=btns2,\n btn_orientation=1,\n hide_avatar=1)\n xiaoding.send_action_card(actioncard2)\n\n|image8|\n\n.. code:: python\n\n # ActionCard\u72ec\u7acb\u8df3\u8f6c\u6d88\u606f\u7c7b\u578b\uff08\u5217\u8868\u9009\u9879\uff09\n btns3 = [CardItem(title=\"\u652f\u6301\", url=\"https://www.dingtalk.com/\"), CardItem(title=\"\u4e2d\u7acb\", url=\"https://www.dingtalk.com/\"), CardItem(title=\"\u53cd\u5bf9\", url=\"https://www.dingtalk.com/\")]\n actioncard3 = ActionCard(title='\u4e07\u4e07\u6ca1\u60f3\u5230\uff0c\u7adf\u7136...',\n text='![\u9009\u62e9](http://www.songshan.es/wp-content/uploads/2016/01/Yin-Yang.png) \\n### \u6545\u4e8b\u662f\u8fd9\u6837\u5b50\u7684...',\n btns=btns3,\n btn_orientation=1,\n hide_avatar=1)\n xiaoding.send_action_card(actioncard3)\n\n\n\u56db\u3001\u5e38\u89c1\u6ce8\u610f\u4e8b\u9879\n===========================\n\n- 1\u3001at_mobiles\u5217\u8868\u4e0a\u7684\u624b\u673a\u53f7\u9ed8\u8ba4\u81ea\u52a8\u6dfb\u52a0\u5230\u6d88\u606f\u6587\u672c\u672b\u5c3e\uff0c\u624d\u6709@\u7684\u6548\u679c\uff0c\u5982\u9700\u81ea\u5b9a\u4e49\u5728\u6d88\u606f\u6587\u672c@\u7684\u4f4d\u7f6e\uff0c\u53ef\u5c06\u53c2\u6570is_auto_at\u8bbe\u7f6e\u4e3aFalse\u5373\u53ef\uff0c\u540c\u65f6\u652f\u6301@\u591a\u4e2a\u624b\u673a\u53f7\uff1b\n- 2\u3001\u5982\u679c\u9489\u9489\u673a\u5668\u4eba\u6d88\u606f\u4e2d\u7684\u56fe\u7247\u94fe\u63a5\u4f7f\u7528Http\u534f\u8bae\uff0c\u53ef\u4ee5\u5728\u9489\u9489\u5ba2\u6237\u7aef\u6b63\u5e38\u52a0\u8f7d\u663e\u793a\uff0c\u4f46\u65e0\u6cd5\u5728\u9489\u9489\u7f51\u9875\u7248\u663e\u793a\uff0c\u9700\u8981\u66f4\u6539\u4e3aHttps\u534f\u8bae\uff1b\n- 3\u3001\u9489\u9489\u673a\u5668\u4eba\u6d88\u606f\u4e2d\u7684\u94fe\u63a5\u9ed8\u8ba4\u8df3\u8f6c\u81f3\u6d4f\u89c8\u5668\u6253\u5f00\uff08\u5373\uff1apc_slide=False\uff09\uff0c\u5982\u679c\u9700\u8981\u76f4\u63a5\u5728\u5ba2\u6237\u7aef\u4fa7\u8fb9\u680f\u6253\u5f00\uff0c\u8bbe\u7f6epc_slide\u4e3aTrue\u5373\u53ef\uff1b\n- 4\u3001\u5f53\u524d\u9489\u9489\u81ea\u5b9a\u4e49\u673a\u5668\u4eba\u5b98\u65b9\u5c1a\u4e0d\u652f\u6301\u5e94\u7b54\u673a\u5236\uff08\u5373\u5728\u7fa4\u91cc\u6210\u5458\u5728\u804a\u5929@\u673a\u5668\u4eba\uff09\uff0c\u6b64\u529f\u80fd\u9700\u8981\u4f7f\u7528\u9489\u9489\u4f01\u4e1a\u5185\u90e8\u5f00\u53d1\u673a\u5668\u4eba\u5b9e\u73b0\uff08\u5373Outgoing\u673a\u5668\u4eba\uff1b\n\n\n\n**\u54e5\u4eec\uff0c\u66f4\u591a\u4f7f\u7528\u573a\u666f\uff0c\u73b0\u5728\u5c3d\u60c5\u5c55\u5f00\u60f3\u8c61\u5427...**\n\n\uff08\u5982\u679c\u5bf9\u4f60\u6709\u5e2e\u52a9\u7684\u8bdd\uff0c\u6b22\u8fce**star**\uff09\n\n.. |image0| image:: https://raw.githubusercontent.com/zhuifengshen/DingtalkChatbot/master/img/text_at_all.png\n.. |image1| image:: https://raw.githubusercontent.com/zhuifengshen/DingtalkChatbot/master/img/text_at_one.png\n.. |image2| image:: https://raw.githubusercontent.com/zhuifengshen/DingtalkChatbot/master/img/link.png\n.. |image3| image:: https://raw.githubusercontent.com/zhuifengshen/DingtalkChatbot/master/img/markdown_at_all.png\n.. |image4| image:: https://raw.githubusercontent.com/zhuifengshen/DingtalkChatbot/master/img/markdown_at_one.png\n.. |image5| image:: https://raw.githubusercontent.com/zhuifengshen/DingtalkChatbot/master/img/feedcard.png\n.. |image6| image:: https://raw.githubusercontent.com/zhuifengshen/DingtalkChatbot/master/img/global_actioncard.png\n.. |image7| image:: https://raw.githubusercontent.com/zhuifengshen/DingtalkChatbot/master/img/select_actioncard.png\n.. |image8| image:: https://raw.githubusercontent.com/zhuifengshen/DingtalkChatbot/master/img/multi_actioncard.png\n.. |image9| image:: https://raw.githubusercontent.com/zhuifengshen/DingtalkChatbot/master/img/image_msg.png\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "\u4e00\u4e2a\u9489\u9489\u81ea\u5b9a\u4e49\u673a\u5668\u4eba\u6d88\u606f\u7684Python\u5c01\u88c5\u5e93",
"version": "1.5.7",
"split_keywords": [
"\u9489\u9489",
"\u673a\u5668\u4eba",
"dingtalk",
"chatbot",
"robot",
"bot"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "6777d2c49433974b5a2ad1d407e1264b",
"sha256": "9658281e84bd07e6481544e1362687397343a88f375e47042472cb5e2c9f51d8"
},
"downloads": -1,
"filename": "DingtalkChatbot-1.5.7-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "6777d2c49433974b5a2ad1d407e1264b",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4",
"size": 15664,
"upload_time": "2022-12-07T10:16:44",
"upload_time_iso_8601": "2022-12-07T10:16:44.408677Z",
"url": "https://files.pythonhosted.org/packages/79/46/0961f961b64d432973663417857e8434f7267281ac80dda8a4a34c218e8a/DingtalkChatbot-1.5.7-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "9e0bb67afa88d1770bf9dd889d6207dd",
"sha256": "74b392af656e86b64065e47d30fe1ad47e334b98073b8e2b253559e5b9c65bd1"
},
"downloads": -1,
"filename": "DingtalkChatbot-1.5.7.tar.gz",
"has_sig": false,
"md5_digest": "9e0bb67afa88d1770bf9dd889d6207dd",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4",
"size": 14152,
"upload_time": "2022-12-07T10:16:46",
"upload_time_iso_8601": "2022-12-07T10:16:46.765863Z",
"url": "https://files.pythonhosted.org/packages/b1/8b/52243aed0a1a449ef2fedc42607b5ce9bdaa2f771ef9c7b8c1675141c8d6/DingtalkChatbot-1.5.7.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-12-07 10:16:46",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "zhuifengshen",
"github_project": "DingtalkChatbot",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "dingtalkchatbot"
}