API for Category based notification level update

Dear Discourse Team,

I was looking for the API to add certain Categories to user’s Watching/Tracking list, however I could get only ‘SQL/Launcher’ based insertion ideas from here.

My purpose is that, we have 50K+ users, who will be assigned to different groups based on their subscription in our non Discourse platform and in the forum we will have different Categories named similar as Group name to make it more meaningful. When a user is created, by default user has 0 notification settings, and they can opt for Category notification from our non Discourse platform.

Or have to install this plugin in order to achieve my purpose.

Then I looked at the network requests happening here, http://exampleforum.com//u/{username}/preferences/categories
On saving the form its doing a PUT method call to http://exampleforum.com/u/{username}.json

with following parameters,


Then I’ve tried the same with API key & API Username, and it worked as expected, I could make a user add/remove watching a group through the API call, with category ID(s); which I got through categories list API. With this option, a user can subscribe to any Categories of his/her choice!!

My worry or question is, as it is not documented at the moment, will this feature get removed in future? Or will this be documented in the API docs?

Sorry, if I have duplicated it, couldn’t get a resource with the searches I did. Thank you! :slight_smile:


I’d suggest using discourse-watch-category. It works beautifully and no fuss. Only that it doesn’t allow the user to un-watch the specified categories.

1 Like

Sorry, I am basically new to this, not sure how to implement this in the forum. Where can I set this feature? Is it common for all users or I can set it for a Group? If I can set for a Group, I can add users to certain Groups when they login through SSO.

And, As mentioned, I would like to have, subscribe/unsubscribe categories of user’s choice.

It is based on groups. You can choose to enforce Watching for certain categories for different groups.

What you need to do is to:

  1. Fork the repo on Github
  2. Modify plugin.rb with your own settings
  3. Install the plugin
  4. ./launcher rebuild app

Now beware that rule you put in here will be enforced, meaning that the user CANNOT override it. He/she can remove a category from watching, and it will be added back to him/her again.


OK, this is the same plugin I have mentioned above. That does not serve my purpose.

  1. An API is required, so that I can have this feature in our platform.

  2. I want user’s to update their category subscription when and then they wanted from our platform, just like how they do in Forum preferences.

Best Regards,
Vaishak Kallore

@codinghorror Could you please confirm, whether this is something missing from documentation or this is a glitch? Can I go ahead assuming that this will not be removed in future?

There’s no guarantee that specific things will not be moved or redesigned, but category watching is sure to stay in some form.

If the format of the API changes, use this to figure it out again:

Also try using that with updating your notification level from the category topic list pages, because it seems like your primary operation is delta updates, not overrides (which is what the above mentioned plugin is best for).


Thanks for the info, I understand about the JSON API concept.

But I am not sure, what you meant by delta updates, however I would like to rephrase/repeat my primary operation as I’m not sure whether I had confused you,

  1. Users log in to forum through SSO, where SSO server is our platform.
  2. Users can see/edit/reply any category by default
  3. Based on user’s access to the products they purchased, we may force the user to subscribe for category notification by default, through API call
  4. Users can subscribe/unsubscribe category notifications any time they wanted from Forum/Our platform
  5. Purpose of placing subscription options on our platform is, users might not be able to figure out how to subscribe/unsubscribe a category from forum, as our users are not tech savvy or we assume that they might not explore forum much. We can show them the subscription options in an ideal location on our platform.

Does this make sense? As told above, I understand that the plugin doesn’t allow ‘unsubscription’. Please advise if I am wrong. Thanks.

This is what I’m talking about - you can use the “update notification level for category $X” when someone wants to subscribe or unsubscribe via your platform.

This is instead of doing a read-modify-write of everything in the user preferences (which you can do on sign up). Much easier for you to code.

Firstly, As I’m going with SSO, asking their preference doesn’t go good for me.

Secondly, mostly there will be ‘watching’ or ‘normal’ updates will be there. If user has already subscribed to a category, I’ll remain it as it is. Still it is doing a Read-modify-delete of everything?