Whisper帖子使用的Webhook

是否有一个 webhook 可以在有人创建 Whisper 帖子时触发?我猜没有,但以防万一,我还是问一下。

我不认为可以配置一个 webhook,使其仅在创建耳语帖子时触发,但你可以创建一个帖子事件 webhook,然后在接收 webhook 的代码中过滤耳语帖子。

耳语帖子的 payload 将会把 post_type 字段设置为 4。例如:

{
  "post": {
    "id": 740,
    "name": null,
    "username": "scossar",
    "avatar_template": "/letter_avatar_proxy/v4/letter/s/b77776/{size}.png",
    "created_at": "2024-10-18T17:00:36.065Z",
    "cooked": "<p>testing whispers and webhooks</p>",
    "post_number": 5,
    "post_type": 4,
    ...

post_type 字段的可能值为:

[2] pry(main)=> Post.types
=> {:regular=>1,
 :moderator_action=>2,
 :small_action=>3,
 :whisper=>4}
4 个赞

非常感谢 @simon

这比我想象的要简单。我没有意识到/看到 4 是 whisper 的代码。

Rene

1 个赞

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.