51工具盒子

依楼听风雨
笑看云卷云舒,淡观潮起潮落

Halo插件plugin-webhook使用文档

简介 {#%E7%AE%80%E4%BB%8B}

plugin-webhook 是一个为 Halo(强大易用的开源建站工具)设计的Webhook插件。

Webhook 是一种通过 HTTP 协议实现的回调机制,允许用户在特定事件发生时(如文章发布、新评论、回复评论等事件)将数据推送到指定的 Webhook URL。这种机制使得用户可以实时地将事件通知发送到外部系统,从而实现与其他服务的集成。


2024-04-24-zrrkqrzy.png

安装 {#%E5%AE%89%E8%A3%85}

如何安装和配置plugin-webhook插件。

1. 下载,目前提供以下下载方式: {#1.-%E4%B8%8B%E8%BD%BD%EF%BC%8C%E7%9B%AE%E5%89%8D%E6%8F%90%E4%BE%9B%E4%BB%A5%E4%B8%8B%E4%B8%8B%E8%BD%BD%E6%96%B9%E5%BC%8F%EF%BC%9A}

GitHub Releases:访问 [Releases] 下载 Assets 中的 JAR 文件。

安装,插件安装和更新方式可参考:https://docs.halo.run/user-guide/plugins

安装完成之后,记得启用插件并完成相关配置。

2. Halo应用商店安装 {#2.-halo%E5%BA%94%E7%94%A8%E5%95%86%E5%BA%97%E5%AE%89%E8%A3%85}

https://www.halo.run/store/apps/app-sCQyp


事件具体说明 {#%E4%BA%8B%E4%BB%B6%E5%85%B7%E4%BD%93%E8%AF%B4%E6%98%8E}

TEST_WEBHOOK("测试webhook") {#test_webhook(%22%E6%B5%8B%E8%AF%95webhook%22)}

测试(点击插件配置中的测试按钮触发)

发送数据

{
  "eventType": "TEST_WEBHOOK",
  "eventTypeName": "测试webhook",
  "hookTime": "2024-04-24 16:16:51",
  "data": "Test webhook success"
}

NEW_POST("发布文章") {#new_post(%22%E5%8F%91%E5%B8%83%E6%96%87%E7%AB%A0%22)}

发布新的文章(点击文章发布按钮时触发)

发送数据

{
  "eventType": "NEW_POST",
  "eventTypeName": "发布文章",
  "hookTime": "2024-04-24 16:39:26",
  "data": {
    "title": "测试webhook文章",
    "slug": "1713947947650",
    "permalink": "/archives/1713947947650",
    "visible": "PUBLIC",
    "owner": "wxy",
    "createTime": "2024-04-24 16:39:23",
    "publishTime": "2024-04-24 16:39:26",
    "isPermanent": null
  }
}

DELETE_POST("删除文章") {#delete_post(%22%E5%88%A0%E9%99%A4%E6%96%87%E7%AB%A0%22)}

点击文章删除按钮 或 回收站中的永久删除按钮时触发

删除文章 发送数据

{
  "eventType": "DELETE_POST",
  "eventTypeName": "删除文章",
  "hookTime": "2024-04-24 16:42:12",
  "data": {
    "title": "测试webhook文章",
    "slug": "1713947947650",
    "permalink": "/archives/1713947947650",
    "visible": "PUBLIC",
    "owner": "wxy",
    "createTime": "2024-04-24 16:39:23",
    "publishTime": "2024-04-24 16:39:23",
    "isPermanent": false
  }
}

永久删除 发送数据

{
  "eventType": "DELETE_POST",
  "eventTypeName": "删除文章",
  "hookTime": "2024-04-24 16:43:05",
  "data": {
    "title": "测试webhook文章",
    "slug": "1713947947650",
    "permalink": "/archives/1713947947650",
    "visible": "PUBLIC",
    "owner": "wxy",
    "createTime": "2024-04-24 16:39:23",
    "publishTime": "2024-04-24 16:39:23",
    "isPermanent": true
  }
}

NEW_COMMENT("发表评论") {#new_comment(%22%E5%8F%91%E8%A1%A8%E8%AF%84%E8%AE%BA%22)}

在文章或页面发表新评论时触发

发送数据

{
  "eventType": "NEW_COMMENT",
  "eventTypeName": "发表评论",
  "hookTime": "2024-04-24 16:44:40",
  "data": {
    "owner": {
      "kind": "User",
      "name": "wxy",
      "displayName": "Administrator",
      "annotations": null
    },
    "content": "我在关于页面发布了评论",
    "createTime": "2024-04-24 16:44:40",
    "approved": true,
    "refKind": "SinglePage",
    "postData": null,
    "singlePageData": {
      "title": "关于",
      "slug": "about",
      "visible": "PUBLIC",
      "owner": "wxy",
      "createTime": "2024-04-24 09:32:20",
      "publishTime": "2024-04-24 09:32:20"
    },
    "replyComment": null
  }
}

DELETE_COMMENT("删除评论") {#delete_comment(%22%E5%88%A0%E9%99%A4%E8%AF%84%E8%AE%BA%22)}

前台界面好像不支持删除,在console删除评论时触发(删除回复不触发该事件)

发送数据

{
  "eventType": "DELETE_COMMENT",
  "eventTypeName": "删除评论",
  "hookTime": "2024-04-24 16:47:46",
  "data": {
    "owner": {
      "kind": "User",
      "name": "wxy",
      "displayName": "Administrator",
      "annotations": null
    },
    "content": "我在关于页面发布了评论",
    "createTime": "2024-04-24 16:44:40",
    "approved": true,
    "refKind": "SinglePage",
    "postData": null,
    "singlePageData": {
      "title": "关于",
      "slug": "about",
      "visible": "PUBLIC",
      "owner": "wxy",
      "createTime": "2024-04-24 09:32:20",
      "publishTime": "2024-04-24 09:32:20"
    },
    "replyComment": null
  }
}

REPLY_COMMENT("回复评论") {#reply_comment(%22%E5%9B%9E%E5%A4%8D%E8%AF%84%E8%AE%BA%22)}

在文章或页面 回复评论时触发

发送数据

{
  "eventType": "REPLY_COMMENT",
  "eventTypeName": "回复评论",
  "hookTime": "2024-04-24 16:49:37",
  "data": {
    "owner": {
      "kind": "User",
      "name": "wxy",
      "displayName": "Administrator",
      "annotations": null
    },
    "content": "我是关于页面的第一条评论",
    "createTime": "2024-04-24 16:49:30",
    "approved": true,
    "refKind": "SinglePage",
    "postData": null,
    "singlePageData": {
      "title": "关于",
      "slug": "about",
      "visible": "PUBLIC",
      "owner": "wxy",
      "createTime": "2024-04-24 09:32:20",
      "publishTime": "2024-04-24 09:32:20"
    },
    "replyComment": {
      "owner": {
        "kind": "User",
        "name": "wxy",
        "displayName": "Administrator",
        "annotations": null
      },
      "content": "我回复你一下试试",
      "createTime": "2024-04-24 16:49:37",
      "approved": true,
      "refKind": null,
      "postData": null,
      "singlePageData": null,
      "replyComment": null
    }
  }
}

DELETE_REPLY_COMMENT("删除回复") {#delete_reply_comment(%22%E5%88%A0%E9%99%A4%E5%9B%9E%E5%A4%8D%22)}

在console中删除评论回复时触发

发送数据

{
  "eventType": "DELETE_REPLY_COMMENT",
  "eventTypeName": "删除回复",
  "hookTime": "2024-04-24 16:51:04",
  "data": {
    "owner": {
      "kind": "User",
      "name": "wxy",
      "displayName": "Administrator",
      "annotations": null
    },
    "content": "我是关于页面的第一条评论",
    "createTime": "2024-04-24 16:49:30",
    "approved": true,
    "refKind": "SinglePage",
    "postData": null,
    "singlePageData": {
      "title": "关于",
      "slug": "about",
      "visible": "PUBLIC",
      "owner": "wxy",
      "createTime": "2024-04-24 09:32:20",
      "publishTime": "2024-04-24 09:32:20"
    },
    "replyComment": {
      "owner": {
        "kind": "User",
        "name": "wxy",
        "displayName": "Administrator",
        "annotations": null
      },
      "content": "我回复你一下试试",
      "createTime": "2024-04-24 16:49:37",
      "approved": true,
      "refKind": null,
      "postData": null,
      "singlePageData": null,
      "replyComment": null
    }
  }
}

如使用中遇到任何问题或有好的建议都可以在该文章下评论 {#%E5%A6%82%E4%BD%BF%E7%94%A8%E4%B8%AD%E9%81%87%E5%88%B0%E4%BB%BB%E4%BD%95%E9%97%AE%E9%A2%98%E6%88%96%E6%9C%89%E5%A5%BD%E7%9A%84%E5%BB%BA%E8%AE%AE%E9%83%BD%E5%8F%AF%E4%BB%A5%E5%9C%A8%E8%AF%A5%E6%96%87%E7%AB%A0%E4%B8%8B%E8%AF%84%E8%AE%BA}


赞(0)
未经允许不得转载:工具盒子 » Halo插件plugin-webhook使用文档