Events

From Matrix Wiki
Jump to navigation Jump to search

An event is a set of properties, defining how a given action or content is handled or attributed.

State Events[edit]

m.room.aliases[edit]

Sets a list of room aliases which resolve into a room ID and can be used to access a room.

  • aliases (required) contains an array with room aliases.
    • string, case-sensitive, must not exceed 255 bytes.
{
  "content": {
    "aliases": [
      "#apple:example.org",
      "#banana:example.org",
      "#cherry:example.org"
    ]
  },
  "event_id": "$155934897110542PieWn:example.org",
  "origin_server_ts": 1577836800000,
  "room_id": "!yNaeAYXXLCFZcXvzXn:example.org",
  "sender": "@alice:example.org",
  "state_key": "example.org",
  "type": "m.room.aliases"
}

m.room.canonical_alias[edit]

Sets the canonical alias for a room which should be used as a replacement name if no other name is set.

  • alias (required) contains the canonical alias as string.
    • string, case-sensitive, must not exceed 255 bytes.
{
  "content": {
    "alias": "#apple:example.org"
  },
  "event_id": "$1559348959248100MUgCE:example.org",
  "origin_server_ts": 1577836800000,
  "room_id": "!yNaeAYXXLCFZcXvzXn:example.org",
  "sender": "@alice:example.org",
  "state_key": "",
  "type": "m.room.canonical_alias"
}

m.room.create[edit]

Sets the first event of a room which is used as root by other events.

  • creator (required): The user ID of the room creator.
    • string, must contain an user ID.
  • m.federate (optional): Defines whether users on other homeservers can join the room.
    • boolean, default: true.
  • room_version (optional): The room version of the room.
    • string, must contain a valid room version, default: "1".
{
  "content": {
    "room_version": "1",
    "creator": "@alice:example.org"
  },
  "event_id": "$155934894210534djDos:example.org",
  "origin_server_ts": 1577836800000,
  "room_id": "!yNaeAYXXLCFZcXvzXn:example.org",
  "sender": "@alice:example.org",
  "state_key": "",
  "type": "m.room.create"
}

m.room.guest_access[edit]

Sets whether guests can or can not access a room.

  • guest_access (required) contains one of
    • can_join: Guests can access the room.
    • forbidden: Guests can not access the room.
{
  "content": {
    "guest_access": "can_join"
  },
  "event_id": "$155939317826772abJuG:example.org",
  "origin_server_ts": 1577836800000,
  "room_id": "!yNaeAYXXLCFZcXvzXn:example.org",
  "sender": "@alice:example.org",
  "state_key": "",
  "type": "m.room.guest_access"
}

m.room.history_visibility[edit]

Sets the visibility of events in a room history. Changes are only applied to future events, the visibility of existing events will be unchanged.

  • history_visibility (required) contains one of
    • invited: Members can view the room history since they were invited.
    • joined: Members can view the room history since they joined.
    • shared: Members can view the room history since the point of time this option was set.
    • world_readable: Everybody can view the room history.
{
  "content": {
    "history_visibility": "invited"
  },
  "event_id": "$155939317926779Faasb:example.org",
  "origin_server_ts": 1577836800000,
  "room_id": "!yNaeAYXXLCFZcXvzXn:example.org",
  "sender": "@alice:example.org",
  "state_key": "",
  "type": "m.room.history_visibility"
}

m.room.join_rules[edit]

Sets who can join a room.

  • join_rule (required) contains one of
    • invite: Invited users can join.
    • knock: Not implemented yet.
    • private: Not implemented yet.
    • public: Everybody can join.
{
  "content": {
    "join_rule": "invite"
  },
  "event_id": "$155939317826773OGOIM:example.org",
  "origin_server_ts": 1577836800000,
  "room_id": "!yNaeAYXXLCFZcXvzXn:example.org",
  "sender": "@alice:example.org",
  "state_key": "",
  "type": "m.room.join_rules"
}

m.room.member[edit]

Sets membership properties of a user in a room.

  • membership (required) contains one of
    • ban: User was banned from the room.
    • invite: User was invited to the room.
    • join: User has joined the room.
    • knock: Not implemented yet.
    • leave: User has left the room.
{
  "content": {
    "membership": "join"
  },
  "event_id": "$155934894210535syqYn:example.org",
  "origin_server_ts": 1577836800000,
  "room_id": "!yNaeAYXXLCFZcXvzXn:example.org",
  "sender": "@alice:example.org",
  "state_key": "@alice:example.org",
  "type": "m.room.member"
}

m.room.name[edit]

Sets a room name.

  • name: Room name.
    • string, case-sensitive, must not exceed 255 bytes.
{
  "content": {
    "name": "Example"
  },
  "event_id": "$155934894310540bpEei:example.org",
  "origin_server_ts": 1577836800000,
  "room_id": "!yNaeAYXXLCFZcXvzXn:example.org",
  "sender": "@alice:example.org",
  "state_key": "",
  "type": "m.room.name"
}

m.room.power_levels[edit]

  • ban (optional): Power level required to ban a user.
    • integer, default: 50.
  • invite (optional): Power level required to invite a user.
    • integer, default 50.
  • kick (optional): power level required to kick a user.
    • integer, default: 50.
  • redact (optional): Power level required to redact events.
    • integer, default: 50.
  • state_default (optional): Default power level required to send a state event.
    • integer, default: 50.
  • events (optional): Sets the power level of a specific event.
  • events_default (optional): Default power level required to send a message event, unless set in events.
    • integer, default: 0.
  • users (optional): Sets the power level of a specific user.
  • users_default (optional): Default power level of a user, unless set in users.
    • integer, default: 0.
{
  "content": {
    "ban": 50,
    "invite": 50,
    "kick": 50,
    "redact": 50,
    "state_default": 50,
    "events": {
      "m.room.avatar": 100,
      "m.room.name": 100,
      "m.room.history_visibility": 100,
      "m.room.power_levels": 100,
      "m.room.topic": 100
    },
    "events_default": 0,
    "users": {
      "@alice:example.org": 100,
      "@bob:example.org": 50,
      "@charlie:example.org": 50
    },
    "users_default": 0
  },
  "event_id": "$155934894210536QncFs:example.org",
  "origin_server_ts": 1577836800000,
  "room_id": "!yNaeAYXXLCFZcXvzXn:example.org",
  "sender": "@alice:example.org",
  "state_key": "",
  "type": "m.room.power_levels"
}

m.room.topic[edit]

Sets a room topic.

  • topic (required): Room topic.
    • string, case-sensitive.
{
  "content": {
    "topic": "This is an example."
  },
  "event_id": "$1559426272156309wWvxG:example.org",
  "origin_server_ts": 1577836800000,
  "room_id": "!yNaeAYXXLCFZcXvzXn:example.org",
  "sender": "@alice:example.org",
  "state_key": "",
  "type": "m.room.topic"
}

Message Events[edit]

m.room.message[edit]

m.audio[edit]

m.emote[edit]

m.file[edit]

m.image[edit]

m.location[edit]

m.notice[edit]

m.text[edit]

m.video[edit]

m.room.redaction[edit]