diff --git a/website/docs/advanced-usage/assets/github-integration.excalidraw.png b/website/docs/advanced-usage/assets/github-integration.excalidraw.png new file mode 100644 index 00000000..8f78dae6 Binary files /dev/null and b/website/docs/advanced-usage/assets/github-integration.excalidraw.png differ diff --git a/website/docs/advanced-usage/assets/github-new-app.png b/website/docs/advanced-usage/assets/github-new-app.png new file mode 100644 index 00000000..e049db81 Binary files /dev/null and b/website/docs/advanced-usage/assets/github-new-app.png differ diff --git a/website/docs/advanced-usage/github-integration.md b/website/docs/advanced-usage/github-integration.md new file mode 100644 index 00000000..130544fa --- /dev/null +++ b/website/docs/advanced-usage/github-integration.md @@ -0,0 +1,52 @@ +--- +sidebar_position: 2 +title: Github 集成 +--- + +![](./assets/github-integration.excalidraw.png) + +## 普通用户使用 + +### 在项目安装应用 + +地址: https://github.com/apps/tailchat + +安装到项目仓库中。 + +### 在项目中进行配置 + +在根目录创建`.tailchat/topic.json` 文件: +```json +{ + "groupId": "", + "panelId": "" +} +``` + +## 自部署配置 + + +应用启动前需要在github中注册一个应用: + +![](./assets/github-new-app.png) + +部署时需要配置以下环境变量: +- `APP_ID`: 来自github 应用设置 +- `WEBHOOK_SECRET`: 来自github 应用设置 +- `PRIVATE_KEY`: 来自github 应用设置 +- `TAILCHAT_APP_ID`: Tailchat 开放平台的id +- `TAILCHAT_APP_SECRET`: Tailchat 开放平台的秘钥 +- `TAILCHAT_API_URL`: Tailchat 后台地址 + +为获取 `TAILCHAT_APP_ID` 与 `TAILCHAT_APP_SECRET` 需要在 Tailchat 开放平台中创建一个开放平台应用 + +同时开启机器人权限,并设置消息回调地址: `https:///message/webhook` + +### 部署开放平台应用 + +> 源码: [https://github.com/msgbyte/tailchat/tree/master/apps/github-app](https://github.com/msgbyte/tailchat/tree/master/apps/github-app) + +拉取源码后部署到可供访问的线上,提供两种方式: + +- 独立应用: `npm run build` 后执行 `node lib/index.js`运行应用 +- Vercel: 直接推送到Vercel即可