Skip to content

Latest commit

 

History

History
84 lines (55 loc) · 2.51 KB

pm_bot.md

File metadata and controls

84 lines (55 loc) · 2.51 KB

如何在钉钉群里添加“项目管理机器人”

推动别人太麻烦了,交给机器人去做吧!

“项目管理机器人”可以定时在群里发消息,使用场景包括:

  • 开周会前,自动询问当事人进展
  • 写周报前,自动询问当事人进展

welcome

下面介绍配置方法

0. 前置条件

本地安装好了 git 和 nodejs

1. 在钉钉群里添加机器人

在钉钉群里,群设置 -> 智能群助手

image image

选这个机器人:

image

一路按提示操作。安全设置可以选择“自定义关键词”,意思是发的消息必须带有这个关键词,不带的话就会被拒绝。

image

创建成功后,把 webhook 地址记录下来:

image

这个新加的机器人不会说话,只是对外暴露了一个接口。下面我们要下载项目,去定时调这个接口。

2. 下载项目

git clone https://github.com/layotto/github-growth-hack.git

进项目目录下:

npm install

修改配置文件 src/notify.js,具体看注释 :

image

3. 发一条消息测试一下

在项目目录下敲命令:

npm run notify

如果一切正常,钉钉机器人会说话

4. 配置定时任务

crontab -e

配 crontab 表达式,比如:

(记得把这下面例子里的项目路径改成你的项目路径)

# Wednesday morning 10:30
30 10 * * 3  cd /Users/qunli/projects/github-weekly-statistics && npm run notify

# Friday 15:33
33 15 * * 5  cd /Users/qunli/projects/github-weekly-statistics && npm run notify

或者这样写:

# Friday 15:33
33 15 * * 5  node /Users/qunli/projects/github-weekly-statistics/src/notify.js

写完之后保存退出。

到此,定时发消息的机器人就配置好了。