Groups from external database - auto subscription of presence


I am in process of setting up chat for a website using JSJac library, website has an existing database will 1000’s of users.

Custom authentication is fine and groups integration is done.

the problem i am facing is of the subscription, if someone logs in with group “A” , system is not sending presense to all users within same group. how to setup auto presence for each user within same group? if i subscribe each user for presense then it works fine but this task is labrorious and kind of manual to also kills the usage of groups.

i am doing something wrong somewhere but unable to find so far.

please help