Forum Discussion

Mswetsky's avatar
11 years ago

I need a way to add a subription to a board for many users at once

We have private and public categories in our community. The process and behaviors are different for them as expected. Because the Public has many more potential users I can't default all users to have subscriptions. But at least 5 categories with over 5000 users want their members to be subscribed and as admin I am only able to switch user and perform this one at a time. I need a method identified to add these subscriptions. Does anyone know if there is a way, or REST api?
  • I would suggest a customization like this:

    • A user goes to the private category/board.  
    • On entering the area, we check to see if the user is already subscribed
      • If not, subscribe them and set an info message saying something like "You have been automatically subscribed to this area"
      • If so, do nothing [flag is set or subscription exists]

     

    This way you are making the subscription call as the user themselves. Beyond this, you may want to add a flag on the user saying they have been auto-subscribed the first time.  If the user goes in later and removes the subscription, we won't subscribe them again.

  • KaelaC's avatar
    KaelaC
    11 years ago

    No problem.  I was thinking of something you (or your other dev team) would do in Studio.  You would need to create a new component and place it on the private category and/or board pages.  You can use freemarker to get the user's current subscriptions for this category: http://community.lithium.com/t5/Community-API/bd-p/developers-rest-api?leaf-id=Category.subscriptions#Category.subscriptions.users.self.subscription_type.subscription_target_type

     

    If there is a subscription, move on

     

    If not you can set one with this call: http://community.lithium.com/t5/Community-API/bd-p/developers-rest-api?leaf-id=Category.subscriptions#Category.subscriptions.users.self.subscription_type.subscription_target_type

     

    Let's say you are on a category page, you can set a category subscription in freemarker like this

    ${rest("/categories/id/"+coreNode.id+"/subscriptions/users/self/add?subscription.type=email")}

     

    I would also suggest requesting a new user profile field saying this user has been auto subscribed. In that case you would also set that at the same time as adding the subscription:

    ${rest("/users/id/"+user.id+"/settings/name/[name] /set?value=[thing to set] ")}

    This way if the user goes back into managing their subscriptions and removes the auto-subscription you won't subscribe them a second time. Now if we go back to the first if statement it would look something like this:

     

    <#assign rest("/users/id/"+user.id+"/settings/name/[name]").value />

     

    <#if previousSubscription == "false">

    <#-- add the sub -->

    </#if>

     

    This is just an example, in reality I would want that flag to be more descriptive (keeps a list of categories a user has been subscribed to in case there is more than one).  You would also need to pull in the subscription lists and loop through to test which ones exist.

     

    If this is a bit too much, you can also talk to Professional Services about having it built on our side.

     

     

8 Replies

  • Evidently there are some REST calls that can be used for subscriptions. I have included the link to that developer area but I am only a novice in creating a call with php. Does anyone have experience to nudge me in the correct direction? As an example I can create a list (SQL server, Access, Excel etc) with SSO,Username,Email,ID etc and I want to make everyone on the list subscribed to board 1234 https://community.lithium.com/t5/Community-API/bd-p/developers-rest-api?branch=Subscription Any help would be appreciated.
  • YuriK's avatar
    YuriK
    Khoros Expert
    11 years ago

    Hey Mswetsky,

     

    Unfortunately we do not currently allow subscribing other people via the API. You can see a previous discussion about this at http://community.lithium.com/t5/Developers-Discussion/Can-REST-be-used-to-subscribe-a-list-of-users-to-a-board/m-p/66762/highlight/true#M2278.

     

    I will check and see if there is a workaround for this. For now, I would suggest you create an idea in the idea board: http://community.lithium.com/t5/Product-ideas/idb-p/Lithium_Ideas

     

    Thank you,

     

    Yuri

  • Hi Yuri, Thank you very much for your reply. You indicated that you do not allow when I believe you meant to say there is currently no way. It is also nice to see that others have requested this functionality and Lithium can look at the issue as more than a "one of" This is a critical task for me at this time I would like to ask that you post back when you determine there is or isn't a workaround so I can move on to next ideas but I am really hoping you are successful in your search..
  • YuriK's avatar
    YuriK
    Khoros Expert
    11 years ago

    Hey Mswetsky,

     

    You are correct, I meant there is currently no way to do this. I spoke with KaelaC and she has a suggestion that might work for you.

     

    Thank you,

     

    Yuri

  • KaelaC's avatar
    KaelaC
    Lithium Alumni (Retired)
    11 years ago

    I would suggest a customization like this:

    • A user goes to the private category/board.  
    • On entering the area, we check to see if the user is already subscribed
      • If not, subscribe them and set an info message saying something like "You have been automatically subscribed to this area"
      • If so, do nothing [flag is set or subscription exists]

     

    This way you are making the subscription call as the user themselves. Beyond this, you may want to add a flag on the user saying they have been auto-subscribed the first time.  If the user goes in later and removes the subscription, we won't subscribe them again.

  • Hello KaelaC, Your suggestion seems like a great way to get what we need accomplished. I apologize in advance for my ignorance but I am only a newbie with the REST api and worked with 2 other teammates to create our current scripts. We run REST calls scheduled independently from our own server as a REST user but was unaware that we could do that on a user forum interaction. I have programmed ASP and understand, but didn't realize that we had that ability to run scripts. I also realize that Studio has additional functionality but we have another group that does that so I am not very familiar with that. Can you help me understand the basics of what I need to do to continue and implement your suggestion? I appreciate your innovative idea and patience very much. Mitch
  • KaelaC's avatar
    KaelaC
    Lithium Alumni (Retired)
    11 years ago

    No problem.  I was thinking of something you (or your other dev team) would do in Studio.  You would need to create a new component and place it on the private category and/or board pages.  You can use freemarker to get the user's current subscriptions for this category: http://community.lithium.com/t5/Community-API/bd-p/developers-rest-api?leaf-id=Category.subscriptions#Category.subscriptions.users.self.subscription_type.subscription_target_type

     

    If there is a subscription, move on

     

    If not you can set one with this call: http://community.lithium.com/t5/Community-API/bd-p/developers-rest-api?leaf-id=Category.subscriptions#Category.subscriptions.users.self.subscription_type.subscription_target_type

     

    Let's say you are on a category page, you can set a category subscription in freemarker like this

    ${rest("/categories/id/"+coreNode.id+"/subscriptions/users/self/add?subscription.type=email")}

     

    I would also suggest requesting a new user profile field saying this user has been auto subscribed. In that case you would also set that at the same time as adding the subscription:

    ${rest("/users/id/"+user.id+"/settings/name/[name] /set?value=[thing to set] ")}

    This way if the user goes back into managing their subscriptions and removes the auto-subscription you won't subscribe them a second time. Now if we go back to the first if statement it would look something like this:

     

    <#assign rest("/users/id/"+user.id+"/settings/name/[name]").value />

     

    <#if previousSubscription == "false">

    <#-- add the sub -->

    </#if>

     

    This is just an example, in reality I would want that flag to be more descriptive (keeps a list of categories a user has been subscribed to in case there is more than one).  You would also need to pull in the subscription lists and loop through to test which ones exist.

     

    If this is a bit too much, you can also talk to Professional Services about having it built on our side.

     

     

  • KaelaC,

    I would like to get a quote on having this put in place within some categories in our community.

    We would want this implimented at the topic level in them..

    Can you provide me with a link to request this, or can you submit a request for me using your suggestion as the desired addition.