phallguy
(Paul Alexander)
2019 年 9 月 19 日午後 9:45
1
ウェブフックが通知をサポートするようになったのを知り、素晴らしいと思います。本当に必要な機能です。ただし、ペイロードに重要な情報が1つ欠けています。それは、通知の対象となるユーザーです。この例のペイロードでは、通知をトリガーした投稿の著者は確認できますが、通知を受け取るべきユーザーは確認できません。
{
"notification": {
"id": 119,
"notification_type": 9,
"read": false,
"created_at": "2019-09-18T13:42:21.248Z",
"post_number": 1,
"topic_id": 75,
"fancy_title": "Phallguy should get a notice about this",
"slug": "phallguy-should-get-a-notice-about-this",
"data": {
"topic_title": "Phallguy should get a notice about this",
"original_post_id": 111,
"original_post_type": 1,
"original_username": "Paul_Alexander",
"revision_number": null,
"display_username": "Paul_Alexander"
}
}
}
通知IDから対象ユーザーを取得するためのAPIがないか探しましたが、ドキュメント化されたものは見つかりませんでした。通知ペイロードに対象ユーザー名またはIDを取得する方法はありますか?
参考までに、私たちは複数のシステムからの通知を統合し、ユーザーにとって単一の体験にまとめようとしています。
phallguy
(Paul Alexander)
2019 年 9 月 20 日午後 5:34
2
@Falco or @blake do you have any thoughts on how I can figure out which user a notification is for when received through the new notification webhook?
blake
(Blake Erickson)
2019 年 9 月 20 日午後 5:49
3
Just looked at this briefly to see if there was a quick answer, and you are right, it does not look like we have a get api endpoint for fetching an individual notification by id, but that wouldn’t be very efficient to call every time anyways.
Most likely this will require a code change to the notification serializer to include the user_id/username inside of the notification payload, so that a separate api request wouldn’t be necessary.
phallguy
(Paul Alexander)
2019 年 9 月 20 日午後 5:57
4
We’re using the hosted service at the moment otherwise I’d build my own plugin. Would you folks consider adding the user id/username to then notification payload in the webhook?
Falco
(Falco)
2019 年 9 月 20 日午後 6:25
5
Did you check the headers?
phallguy
(Paul Alexander)
2019 年 9 月 20 日午後 6:27
6
I did - hoping to find some extra meta data in there but didn’t find anything user specific.
Request URL: https://XXX
Request method: POST
Accept: */*
Connection: close
Content-Length: 420
Content-Type: application/json
Host: XXX
User-Agent: Discourse/2.4.0.beta4
X-Discourse-Instance: https://XXX
X-Discourse-Event-Id: 11
X-Discourse-Event-Type: notification
X-Discourse-Event: notification_created
X-Discourse-Event-Signature: sha256=XXX
phallguy
(Paul Alexander)
2019 年 9 月 24 日午後 10:37
7
Checking in to see if you folks have any thoughts/updates. The notification webhook without a target user isn’t really of much use.
phallguy
(Paul Alexander)
2019 年 10 月 10 日午後 5:28
8
Hey guys have you had a chance to review the issue? Is there any hope that we can get the target user id in the notification event?
blake
(Blake Erickson)
2019 年 10 月 15 日午後 9:59
9
I’ve created a pr that will add the user_id to the notification webhook json payload:
master ← notification-webhook-user-id
merged 10:24PM - 21 Oct 19 UTC
The payload when receiving a notification webhook is pointless without
knowing … which user the notification is for. This fix adds the user_id to
the notification serializer so that when you receive a notification
webhook you can properly identify which user the notification is for.
See
https://meta.discourse.org/t/getting-the-target-user-for-notification-webhook-events/129052?u=blake
for more details.
こんにちは、@blake さん。external_id も追加することは可能でしょうか?Discourse の SSO を利用しており、当社のシステムには Discourse のユーザー ID が存在しないためです。
blake
(Blake Erickson)
2020 年 7 月 13 日午後 6:16
11
こんにちは、Albert さん!
それは良いアイデアだと思います。SSO が有効になっている場合にユーザーの external_id を追加するコミットを作成しました。
committed 06:07PM - 13 Jul 20 UTC
If sso is enabled the notification payload will now include the
external_id for … the user.
This was requested on meta: https://meta.discourse.org/t/-/129052/10
これが役立つことを願っています!次回デプロイ時にあなたのサイトに追加されます。デプロイは今週中に行われる予定です。
すごい、早いですね!本当にありがとうございます、とても助かりました 変更がホストされている Discourse サーバーに反映されるまでの概算時間はご存知ですか?
あ、気にしないでください。最後の文を読みませんでした 。ありがとうございます!!