Description:
Similar to what is proposed in #4762 I would propose to have an option to add/invite new registered users into a community.
Extending the feature auto_join_rooms by auto_invite_community and auto_add_community.
As a result a new user should be invited or directly be added to the supplied communities.
My workaround for now is a combination of cronjob, shell script and SQL statement that invites all new (real) users to a list of groups every five minutes - maybe that's useful to someone. But I, too, vote for this feature.
autoinvite_to_group.sh
#!/bin/sh
# Group Admin Access-Token
ACCESSTOKEN="<admin_access_token>"
for userid in $(sudo -iu postgres psql -A -t -d <db_name> < /path/to/users_to_invite_to_group.sql | perl -MURI::Escape -lne 'print uri_escape($_)')
do
curl -X PUT -H "Authorization: Bearer $ACCESSTOKEN" -H "Content-Type: application/json" -d '{}' https://<host>/_matrix/client/r0/groups/%2B<group_localpart>%3A<server_name>/admin/users/invite/$userid
done
users_to_invite_to_group.sql
SELECT name AS user_id FROM users WHERE appservice_id IS NULL AND deactivated = 0 EXCEPT SELECT user_id FROM (SELECT user_id, group_id, NULL AS is_admin FROM group_invites UNION ALL SELECT user_id, group_id, is_admin FROM group_users) AS potential_group_users WHERE group_id = '+<group_localpart>:<server_name>';
cronjob
*/5 * * * * /path/to/autoinvite_to_group.sh
hi, that script works well but i deactivated it now, because it has some problems which occure in a good practical use: If you have a lot of system/bridge users, they get invited too (SmsMatrix, mautrix-whatsapp, mautrix-telegram, ...). So you would need to write some blacklist/whitelist to ignore them.

Becaue the problem is: If you remove the invitation of a user to community, the user gets invited to it again and again and again. So there needs to be added som kind of trigger: removing the invitation of specific users to community should put that user to some black-list or so.
hi, that script works well but i deactivated it now, because it has some problems which occure in a good practical use: If you have a lot of system/bridge users, they get invited too (SmsMatrix, mautrix-whatsapp, mautrix-telegram, ...). So you would need to write some blacklist/whitelist to ignore them.
Becaue the problem is: If you remove the invitation of a user to community, the user gets invited to it again and again and again. So there needs to be added som kind of trigger: removing the invitation of specific users to community should put that user to some black-list or so.
I agree, It will be useful this way that described above
Most helpful comment
My workaround for now is a combination of cronjob, shell script and SQL statement that invites all new (real) users to a list of groups every five minutes - maybe that's useful to someone. But I, too, vote for this feature.
autoinvite_to_group.sh
users_to_invite_to_group.sql
cronjob