7 Replies Latest reply on Dec 19, 2012 10:54 AM by Powell

    'intercepting' invite to group


      Hi all,

      I need to 'intercept' when invitation/approvals for an invitation to a group (private and secret), and do something something custom.

      Like so:  User clicks invite others to group->normal form appears, invitees selected->click send invitations->NORMAL FUNCTION, plus custom code.


      What is the correct way to do this?


      Thank you!


        • Re: 'intercepting' invite to group

          Hmmm.... Very interesting. I'd like to learn more about what you need to do b/c maybe there is a generic "hook" we can provide in the platform. As of now, I believe (and will ask Ryan Rutan to validate) the only way to do this would be to write a plugin. Of course, following this strategy comes with all the pros and cons of a plugin. Also, plugins are not available in Jive Cloud (a.k.a. Jiveon), so we'd have to explore an alternate approach of some kind.

            • Re: 'intercepting' invite to group

              Mark is correct, currently the only way to do something like this would be to make a plugin.  Depending on whether you want to "intercept" or "listen" the solution changes quite a bit.  IMO, I'm a fan of using Listeners to implement business rules, letting the core product do it's thing and then layering in some additional business logic when certain criteria are met.  Check out the Do you know Jive-Fu? post and code base and see if that helps.


              Otherwise, perhaps you could share some more details on the types of actions you are looking to take and/or why intercept is preferred over a passive listener?  Hope this helps.

              1 person found this helpful
                • Re: 'intercepting' invite to group

                  Thank you Mark and Ryan,

                  I fully understand I need to write a plugin, just trying to find out more about what I the plugin needs to do, namely how to 'hook' onto an 'event' in this case.  I will check the Jive Fu post, in the mean time here is more detail on what I am trying to do.

                  The purpose of this is that we want to apply some approval process to adding people to groups (secret and private) outside fof Jive. 

                  When an user is invited to, or asked to join  a private or gets invited to a secret group, I need to invoke a webservice and send the user id.   An approval/workflow app will process the approval, on completion, calls a custom webservice that adds the user to the group or notifies of rejection.


                  So something like this:


                  When Invite user or Ask to join invoked

                  run custom code that does the following:

                  is group private or secret

                  call custom webservice pass id of invitee (loop as neccessary if more than one invitee)


                  if group NOT private or secret

                  continue as normal


                  Any additional guidance, much appreciated!



                  • Re: 'intercepting' invite to group

                    Thankyou Ryan,

                    We were able to hook some logic to the invite-join action so that is sorted!

                    Follow up, we need to do the same for "ask to join" a group, but it doesnt seem to be an action for that.

                    How is it possible then to attach custom logic to ask to join?

                    *I am writing up a feasbility study for this for my management, and have to finish before I can leave for the holidays, any help greatly appreciated!!!



                    Thank you,


                      • Re: 'intercepting' invite to group

                        Not to sound like a broken record here, but it sounds like a listener might be the best item here.  Is the item really needed to track invites, or just that someone joins?  For example, you can use a simple EventListener<SocialGroupEvent> implementation ... listen only for MEMBER_ADDED which says that a person has been authorized into the group.  At that time, you have the current group, the user that was approved, and you can load full versions of those objects to get access to any of that data.  From there, its simple packaging to call your web service. 


                        Based on the results, you can execute code to remove the person from the group if they are "not allowed" which would mean the user would be an approved user for less than a few seconds in most cases.  The code to do all of this would be easier and more upgrade safe.  Completely done on the back-end, and would let the system work as-is with bolted on-top business rules?  Does this help?

                        public class YourSocialGroupEventListener implements EventListener<SocialGroupEvent> {


                        public void setSocialGroupManager(SocialGroupManager socialGroupManager) {

                             this.socialGroupManager = socialGroupManager;



                        public void handle(SocialGroupEvent event) {

                             if (event.getType().equals(SocialGroupEvent.Type.MEMBER_ADDED)) {

                                  /*** LOAD THE USER OBJECT FOR THE ADDED USER ***/

                                  User addedUser = (User)event.getParams().get(SocialGroupEvent.PARAM_USER);


                                  SocialGroup group = socialGroupManager.getSocialGroup(event.getPayload().getID());


                                  SocialGroupMember member = (SocialGroupMember)event.getParams().get(SocialGroupEvent.PARAM_MEMBER_DETAILS);


                             } // end if

                        } // end handle


                        } // end class

                          • Re: 'intercepting' invite to group

                            Hey Ryan,

                            I am not sure that would work for our circumstances, as we need to invoke some custom approval process BEFORE the user is added to the group.

                            Only after the custom approval process is done and the user approved (outside Jive) will we add the user to the group.  Listening for the Member_added I dont think would help with that since it is triggered after the user is added.

                            Something has to be called when 'ask to join' is clicked, I would think,  need to know how to hook to that.

                            Know what I mean?