누군가가 Whisper 게시물을 생성할 때 실행되는 웹훅이 있을까요? 아마 없을 것 같지만, 혹시 모르니 물어봅니다.
웹훅을 whisper 게시물이 생성될 때만 트리거되도록 설정하는 것은 불가능하다고 생각합니다. 대신 Post Events 웹훅을 생성한 후, 웹훅을 수신하는 코드에서 whisper 게시물을 필터링하는 방식으로 처리할 수 있습니다.
whisper 게시물의 페이로드에는 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}