Well, actually the code works and log me the ID of each group.
In my config, I have a string field in my config which basically get the groups corresponding to staff, e.g. "23,24,35". And I just want to check all the groups of all the clients to determine which clients must be notified.