Forum Discussion

jeffshurtliff's avatar
4 years ago

Subscribe other users to boards via API as admin user

Does anyone know if it's now possible to subscribe other users (e.g. users belonging to a specific role) to a board via the API as a user with admin privileges?

I found the two discussions below but since they were posted so long ago I'm hoping there has been an enhancement or someone has found a creative way of doing it in the interim:

I thought I'd try being clever and replace the "users/self" portion of the URL with "users/login/joeCustomer" or "users/id/1234" to see if that would work, but alas my Hail Mary attempts were in vain and returned the following response:

<response status="error">
  <error code="501">
    <message>
      Unknown path element at node 'node_subscription_context.users'.
    </message>
  </error>
</response>

Is anyone aware of another way to accomplish this?  Maybe there's an undocumented way to pass in a user object in the v2 /subscriptions endpoint or a way to leverage the "Switch User" functionality systematically?

I have already implemented a macro that registers the specific users to the boards as soon as they log in, but now I'm looking for how I can subscribe the rest of the users who haven't yet logged in since the macro was implemented.

(Context: We are contractually obligated to send certain product announcements to customers via email and we have always leveraged our community to do so via subscriptions.  Jive/JX had a News Streams functionality that made it easy to "auto-subscribe" users to boards, but I haven't yet found a comparable functionality in Khoros.)

If anyone has any thoughts on how this can be done then it would be extremely appreciated.  Thanks!

 

  • jeffshurtliff I got some information I wasn't aware of that I think should solve your use case. 

    I haven't had a chance to try this out yet, but I got the info from our Profession Services guru AdamN. Using Session Key authentication and API v1,  you should be able to pass the user.login of the  target user and an admin session key, and you will get back the session key of target user in the response. Your admin account will require the allow_switch_users permission.

    [EDIT - FOLLOW UP] We added a Create subscriptions for another user guide in the Developer Doc Portal with deeper explanations and examples.

     

    Please let me know if this works for you.

    Cheers,

    Suzie

     

  • SuzieH's avatar
    SuzieH
    Khoros Alumni (Retired)

    jeffshurtliff I got some information I wasn't aware of that I think should solve your use case. 

    I haven't had a chance to try this out yet, but I got the info from our Profession Services guru AdamN. Using Session Key authentication and API v1,  you should be able to pass the user.login of the  target user and an admin session key, and you will get back the session key of target user in the response. Your admin account will require the allow_switch_users permission.

    [EDIT - FOLLOW UP] We added a Create subscriptions for another user guide in the Developer Doc Portal with deeper explanations and examples.

     

    Please let me know if this works for you.

    Cheers,

    Suzie

     

      • SuzieH's avatar
        SuzieH
        Khoros Alumni (Retired)

        Excellent. We'll start working on some formal documentation for this.

  • jeffshurtliff,

    Currently this is still not feasible to subscribe on any board for other users by API.

    You can try using user authentication for other users with there users account and make the subscribe API call with there authentication token.

    • jeffshurtliff's avatar
      jeffshurtliff
      Boss

      Thanks Parshant.  I figured as much but was hoping that I was crossing my fingers tightly enough that it wouldn’t be the case. 

      Do you know if it’s possible to authenticate as other users (using an admin service account) without needing their actual credentials via the API, similar to the Switch User functionality?  In other words, make some kind of authentication call to retrieve a session key for another user to then use in subsequent calls?

      Thanks again!

      • SuzieH's avatar
        SuzieH
        Khoros Alumni (Retired)

        UPDATE: We do have a solution for this. Please see my first-level reply for using user.login with an administrator session key.

        Hi jeffshurtliff We have an internal method equivalent to Switch User, but it is only available to Services and Core Engineering. It's a powerful tool, so we keep that option buttoned down pretty tight via the API for security reasons.