bbernhard / signal-cli-rest-api

Dockerized Signal Messenger REST API
https://bbernhard.github.io/signal-cli-rest-api/
MIT License
1.39k stars 161 forks source link

How to remove empty members from a group #624

Open LeoWelter opened 6 days ago

LeoWelter commented 6 days ago

I'm using the following code to get group info: base="http://localhost:8080/" number=env("SIGNAL_PHONENUMBER") url=base + f"v1/groups/{number}" print(url) requests.get(url).json()

resulting in: {'name': 'XXX', 'id': 'group......=', 'internal_id': '.....=', 'members': ['+1234567890', '', '', '', ''], 'blocked': False, 'pending_invites': [], 'pending_requests': [], 'invite_link': 'https://signal.group/.....', 'admins': ['+31234567890, '']}] I want to get rid of the empty members in the group since they result in an error message when sending a message to the group `# error message: SignalCliRestApiError: Failed to send (some) messages:: Unregistered user "" (8 additional frame(s) were not displayed) `

I tried to remove them through the signal app itself, but that does not seem to work. I tried using a DELETE request as follows (probably obvious):

`data={"members": [""]}

base="http://localhost:8080/" groupid="group.VXI1ODJnY01QcnBOckZiZVhNMVNGZVArcmtpS0lyNC9yUmRBUHhFWjV3Zz0=" number=env("SIGNAL_PHONENUMBER") url=base + f"v1/groups/{number}/{groupid}/delete" print(url) result = requests.delete(url, json=data) result.text `

Any ideas?

bbernhard commented 5 days ago

Are you sure that those are empty members and not just members who have hidden their number? (see also https://github.com/bbernhard/signal-cli-rest-api/issues/611)