R語言釘釘機器人

釘釘羣機器人是什麼?

羣機器人是釘釘羣的高級擴展功能。羣機器人能夠將第三方服務的信息聚合到羣聊中,實現自動化的信息同步。例如:經過聚合GitHub,GitLab等源碼管理服務,實現源碼更新同步;經過聚合Trello,JIRA等項目協調服務,實現項目信息同步。不只如此,羣機器人支持Webhook協議的自定義接入,支持更多可能性,例如:你可將運維報警提醒經過自定義機器人聚合到釘釘羣。git

關於如何建立機器人,獲取webhook,以及其餘更多詳細信息請參考自定義機器人github

安裝

ding包的源代碼在分享在Github,jeevanyue/ding,可經過下列方式安裝。web

devtools::install_github("jeevanyue/ding")

消息類型及數據格式

配置webhook

首先配置申請的webhook。spring

webhook <- 'https://oapi.dingtalk.com/robot/send?access_token=your_token'

text類型

sendChat(
  webhook = webhook, msgtype = 'text',
  content = "妞妞最可愛",
  atMobiles = list('152****7197'))

link類型

sendChat(
  webhook = webhook, msgtype = 'link',
  title = '中"毒"已深',
  text = '有 "毒" 的 \n 運動x潮流x裝備',
  messageUrl = 'http://www.poizon.com',
  picUrl = 'https://du.hupucdn.com/news_byte1022byte_9774f29b986b8773640120bf4c07cc2e_w100h100.png')

markdown類型

sendChat(
  webhook = webhook, msgtype = 'markdown',
  title = '上海天氣',
  text = paste0(
    '#### 上海天氣\n',
    '> 14度,東北風2級,空氣良53,相對溫度48%\n\n',
    '> ![spring](http://www.ccdi.gov.cn/lswh/wenhua/wyzd/201803/W020180301632355806894.jpg)\n',
    '> ###### 10點20分發布 [天氣](https://www.seniverse.com/) \n'))

總體跳轉actionCard類型

sendChat(
  webhook = webhook, msgtype = 'actionCard',
  title = '中"毒"已深',
  text = "![Du APP](https://du.hupucdn.com/news_byte1022byte_9774f29b986b8773640120bf4c07cc2e_w100h100.png) \n ### 有 "毒" 的 運動x潮流x裝備 \n 球鞋鑑別靠譜有效,你喜歡的不容錯過,看上就買嚴格把控,志趣相投玩在一塊兒,商家入駐優惠快捷",
  singleTitle = "閱讀全文",
  singleURL = 'http://www.poizon.com/')

獨立跳轉actionCard類型

sendChat(
  webhook = webhook, msgtype = 'actionCard',
  title = '中"毒"已深',
  text = '![Du APP](https://du.hupucdn.com/news_byte1022byte_9774f29b986b8773640120bf4c07cc2e_w100h100.png) \n ### 有 "毒" 的 \n 運動x潮流x裝備',
  btns = list(
    list(title = '內容不錯', actionURL = 'http://www.poizon.com/'),
    list(title = '不感興趣', actionURL = 'http://www.poizon.com/')
  ))

feedCard類型

links <- list(
  list(title = '毒APP',
       messageURL = 'http://www.poizon.com',
       picURL = 'https://du.hupucdn.com/news_byte1022byte_9774f29b986b8773640120bf4c07cc2e_w100h100.png'),
  list(title = '中"毒"已深',
       messageURL = 'http://www.poizon.com',
       picURL = 'https://du.hupucdn.com/news_byte1022byte_9774f29b986b8773640120bf4c07cc2e_w100h100.png'))
sendChat(
  webhook = webhook, msgtype = 'feedCard',
  links = links)
相關文章
相關標籤/搜索