Using Metadata field for Comments & Comments for specific user

To create comment, theses parameters are required

  • referenceType - values can be post or content
  • referenceId - value will be postId or contentId

Our project is using referenceType = ‘content’, Which mean user can make comment to specific content.

Questions are

  1. We’re going to have more type of comment, It’ll show comment and amount of donate money. So we planned to store donated amount in meatadata field. That should be fine right?

  2. We just got requirement like, user can comment at specific profile not just specific content. Do you have any suggestion for this use case? Because as I saw referenceType could be only ‘post’ or ‘content’

Here are example result that we want

Hi @tlezip

  1. That’s ok - however please note that the comment json size cannot exceed 100kb in size.
  2. You can tie comments to any external object - if you have to tie to both content and user profile you may distinguish by using prefix - e.g. content-A101 and user-153493 so the application knows how to retrieve the comments data when rendering the content / user profile

This content-A101 and user-153493 will be value for referenceType right? or referenceId?

value for referenceId

Ah, so we could use like this right?
referenceType: ‘content’
referenceId: ‘user-12345’

yes - and when you’re loading user / content data you can retrieve related comments by generating that referenceId

2 - You can tie comments to any external object - if you have to tie to both content and user profile you may distinguish by using prefix - e.g. content-A101 and user-153493 so the application knows how to retrieve the comments data when rendering the content / user profile

@touchaponk Is it possible to tie one comment to two objects?

Example use-case:

  • User A leaves a paid comment into an Article of author X
  • That paid comment shows up on that Article page
  • That same paid comment also shows up on Profile page of author X

Maybe there’s some way to use comment parentId for this kind of feature?

Hi @Juho - if Author X created 2 paid comments on 2 different posts - do those 2 also need to appear on the profile page?

@touchaponk Yes, our end goal is that on profile page we show:

  • All paid comments given for the Author directly
  • All paid comments given in any of the Author’s articles

What you can do here is, when rendering the User Profile page of a User-5837, for example, send requests to get comments with referenceId is User-5837 and all comments where referenceId is [Article-1, Article-2] where you get the list from list of articles of the user.

@touchaponk Thank you for the suggestion. Is there a limit on how many referenceId can be added to the comment request? In some cases the Author can have hundreds of articles.

That might be an issue since you can only request for 1 post comments per 1 call and you might run into rate limit if there are alot of articles.

The other way is to duplicate all paid comment into User-5837 - so you’ll be creating 2 comment object per each paid comment. You can then query only from User-5837. However of course this means you’ll need to make sure comments are in sync in terms of edit and delete