Problem
Send an email notification to the site owner whenever a new comment is created on any document in that site.
Solution
We already have comment events in the activity feed API. From those we can fetch the comment object, which includes a targetAccount CID and a targetPath. Is the targetAccount itself the site’s owning account? hm://z6MkgisVMELvqnsCo3dYmtVpy8PiqPGMVwfAyBWFn84vebq4 hm://z6MkrbYsRzKb1VABdvhsDSAk6JK8fAszKsyHhcaZigYeWCou hm://z6Mkvz9TgGtv9zsGsdrksfNk1ajbFancgHREJEz3Y2HsAVdk
If that’s correct, then the flow would be:
On each new comment event, fetch the comment.
Resolve the site owner from targetAccount
Skip notifications if the site owner is also the comment author.
Check the owner’s notification preferences to see if email is enabled.
If enabled, send a notification with the email url.
One question that I have is: can a single account own multiple sites? If yes, we probably need to add notification settings per site?
Do you like what you are reading? Subscribe to receive updates.
Unsubscribe anytime