matrix-wishlist
matrix-wishlist copied to clipboard
Matrix to Matrix bridge (room)
https://github.com/non-Jedi/matrix_relay probably will fit this description when I finally get around to working on it again.
Closing this for https://github.com/non-Jedi/matrix_relay :)
That project never actually got to a workable state, and I've moved on to other things since then. @turt2live I recommend reopening this one.
https://github.com/matrix-org/matrix-doc/pull/2923
I just wrote a small python snippets checking via cron if a secondary user was invited, joins and invites the primary user. I use it to combine several work accounts to my major account. Maybe it will help s.o.
#!/usr/bin/python3
"""adds a main (primary) user to a group where the seconday user was invited to"""
import requests
# of secondary user
homeserver_url = 'https://matrix.org' # change
# of secondary user
matrix_token = "MDabcdefghijklmnopqrstuvwA..." # change
# primary user
user_to_join = "@user:matrix.org" # change
def send_matrix_sync() :
headers = {"Authorization": f"Bearer {matrix_token}"}
response = requests.get(
f"{homeserver_url}/_matrix/client/r0/sync",
headers=headers)
response = response.json()
new_rooms = response["rooms"]['invite']
if len(new_rooms):
for room_id, val in new_rooms.items():
response = requests.post(
f"{homeserver_url}/_matrix/client/r0/rooms/{room_id}/join",
headers=headers)
joined_rooms = []
while room_id not in joined_rooms:
response = requests.get(
f"{homeserver_url}/_matrix/client/r0/joined_rooms",
headers=headers)
joined_rooms = response.json()
joined_rooms = joined_rooms['joined_rooms']
response = requests.post(
f"{homeserver_url}/_matrix/client/r0/rooms/{room_id}/invite",
headers=headers, json={"user_id": user_to_join})
if __name__ == "__main__":
send_matrix_sync()