green-api / issues

11 stars 0 forks source link

Q | Error won't be raised when trying to use GreenAPI.groups.addGroupParticipant #438

Closed taaaal closed 6 months ago

taaaal commented 6 months ago

[method: GreenAPI.groups.addGroupParticipant]


Hey! I'm trying to add a participant to a certain group using the mentioned method above.

try:
    GreenAPI.groups.addGroupParticipant(group_id, participant_chat_id)
except Exception as error:
    raise error

I know the code would fail cause of the participant's privacy settings for groups. But no error appeared. Looking forward for some reply/help! thanks anyways(:

kocherovv commented 6 months ago

Hello, A boolean value is passed in the body of the method response; in cases where the user could not be added, it will be false.

{ "addParticipant": false }

Reason answer False can be different:

  1. The user attempting to add a new participant to the group does not have the status of an administrator for that group.
  2. The user adding a new participant to the group does not have the participant's number saved in their phonebook.

While some numbers can be added to the group without being saved in the phonebook, it is recommended to always pre-save the participant's phone number in the contacts list to ensure successful addition to the group.

We also recommend reading the article "Why aren't members being added to the group?" for further details.

taaaal commented 6 months ago

Yeah.. as I mentioned before it'll already fall automatically cause of the participant's privacy settings for groups. I would recommend create custom exceptions for the API only. Anyways, thank you very much for the quick response 😼