the hard way manually
Upgrading a room 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.
- 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
. - 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:
See also: https://matrix.org/docs/spec/client_server/unstable.html#post-matrix-client-r0-createroomcurl -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
- Remembering the
room_id
of the new room, send a tombstone event into the old room.
See also: https://matrix.org/docs/spec/client_server/unstable.html#m-room-tombstonecurl -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'
- Point room aliases at the new room and set up any integrations.
The script that partially automates things (requires
$ACCESS_TOKEN
environment variable, the rest is passed in parameters):