10 Replies Latest reply on Jan 27, 2015 9:56 AM by deirdre.yee

    Pre-Setting Custom Streams

    caldon95


      I am looking to see if anyone has attempted to or been able to successfully pre-set custom streams on behalf of users.  The intent here is to pre-populate activity streams for users outside of the inate ability that requires the user to add that stream.  We are looking to force some activity streams to all (or subset of) users that is forced based on certain attributes.  Has anyone attempted this and am interested in the complexeties involved.  Thanks.

        • Re: Pre-Setting Custom Streams
          I think Curtis Gross Can probably talk to that. I know this is something we've looked at for a bit..
          1 person found this helpful
          • Re: Pre-Setting Custom Streams
            brianulm

            We just migrated to Jive 7 and I was getting ready to investigate that functionality as well. It would have been great to have been able to launch with 1 or 2 pre-configured streams for things like company news and employee HR info for example. I know you would want to use it wisely and not overload people with too many prescriptive channels, but the ability to include some would be a very good feature.

            1 person found this helpful
            • Re: Pre-Setting Custom Streams
              whoiskevin

              The direction from Pawan is correct.  I had a previous project where we added a custom stream to each user.  Assuming you watch for a particular event via either the event mechanism via a plugin or webhooks you can modify the streams for a given user. 

               

              Some classes to help get you started (they may have changed in 7):

              com.jivesoftware.community.eae.rest.StreamConfigurationService;

              com.jivesoftware.community.eae.view.stream.configuration.StreamAssociationBean;

              com.jivesoftware.community.eae.view.stream.configuration.StreamConfigurationRequest;

              com.jivesoftware.community.eae.view.stream.configuration.StreamViewBean;

               

              Sorry I don't have that particular example and it was from a previous version so it may not help but if you search around I think you can find an example of creating the stream with either the web service call or directly via the StreamConfigurationService.

                • Re: Pre-Setting Custom Streams
                  pawans

                  Hi Dishant,

                  Here's part of my custom python code which I used to create emails watches stream for all users using rest api as a one time activity.

                          stream = '{"name":"Email Watches","source":"custom","receiveEmails":"true"}'

                              url = "http://localhost:8080/api/core/v3/people/" + user_id + "/streams"

                              header = {'content-type': 'application/json'}

                              requests.post(url, data=params, headers=header, auth=(self.username, self.password))

                   

                   

                  And then for every new / re-enabled user I have this simple node.js webhooks code which creates email watches stream.

                  You can add this to the webhooks example code

                   

                                  if(activity['verb'] === "jive:user_account_created"){

                                      var data = '{"name":"Email Watches","source":"custom","receiveEmails":"true"}'

                                      var api_url = activity['object']['id']+'/streams';

                                      var postRequest = {

                                          'authz': "signed",

                                          url: api_url,

                                          method:'POST',

                                          'auth': {

                                              "user": "",

                                              "pass": ""

                                          },

                                          body:data

                                      };

                                      request(postRequest,function(error, response, body){

                                      })