Skip to content

Instantly share code, notes, and snippets.

@turt2live turt2live/manual-room-upgrade.md Secret
Last active May 9, 2019

Embed
What would you like to do?

Upgrading a room the hard way manually

Disclaimer: Normally you should just use the upgrade endpoints or built-in upgrade functionality of your client. Manual upgrades are required under some circumstances, but should be used rarely. This guide assumes you have basic knowledge of Matrix as well as JSON.

Before you begin: Be sure to disconnect any bridges from the room and be prepared to have to manually reconfigure bots, bridges, and other integrations.

  1. In the room you want to upgrade, get the event ID from the most recent event in the room. In Riot, click the 3 dots to the right of the message then "View Source". The dialog should contain an event_id.
  2. Create a room which will serve as the new room. Be sure to use the right room version. Noting the strings needing to be replaced, an example curl call would be:
    curl -s -X POST -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" --data-binary '{"name":"My New Room","room_version":"3","creation_content":{"predecessor":{"room_id":"THE_OLD_ROOM_ID","event_id":"THE_LAST_EVENT_ID_IN_THE_OLD_ROOM"}}}' https://YOUR_HOMESERVER/_matrix/client/r0/createRoom
    
    See also: https://matrix.org/docs/spec/client_server/unstable.html#post-matrix-client-r0-createroom
  3. Remembering the room_id of the new room, send a tombstone event into the old room.
    curl -s -X PUT -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" --data-binary '{"replacement_room":"THE_NEW_ROOM_ID"}' 'https://YOUR_HOMESERVER/_matrix/client/r0/rooms/!OLD_ROOM_ID/state/m.room.tombstone'
    
    See also: https://matrix.org/docs/spec/client_server/unstable.html#m-room-tombstone
  4. Point room aliases at the new room and set up any integrations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.