XEP-0444: Message Reactions

Abstract
This specification defines a way for adding reactions to a message.
Authors
  • Natalie Wirth
  • Marvin Wissfeld
Copyright
© 2019 – 2024 XMPP Standards Foundation. SEE LEGAL NOTICES.
Status

Experimental

WARNING: This Standards-Track document is Experimental. Publication as an XMPP Extension Protocol does not imply approval of this proposal by the XMPP Standards Foundation. Implementation of the protocol described herein is encouraged in exploratory implementations, but production systems are advised to carefully consider whether it is appropriate to deploy implementations of this protocol before it advances to a status of Draft.
Type
Standards Track
Version
0.2.1 (2024-04-15)
Document Lifecycle
  1. Experimental
  2. Proposed
  3. Stable
  4. Final

1. Introduction

Message reactions allow to express an opinion or feeling towards a message in a quick and light-weight way. Reactions are described in the form of emojis and can enhance communication especially when chatting with multiple parties. Other possible uses include voting and checking to-do list items.

Reactions are typically displayed in a summarized fashion visually attached to the message they belong to.

Related work has been done in Message Attaching (XEP-0367) [1]. However, it can't be used for reactions, as it would cause difficulties with non-supporting clients, is not tailored to emojis and does not specify removal of reactions. To solve these issues, this XEP introduces a separate XML element for reactions.

2. Discovering support

2.1 Basic support

If a client implements message reactions, it MUST specify the 'urn:xmpp:reactions:0' feature in its service discovery information features as specified in Service Discovery (XEP-0030) [2] and the Entity Capabilities profile specified in Entity Capabilities (XEP-0115) [3].

Example 1. Client requests information about a chat partner's client
<iq type='get'
    to='romeo@montague.lit/orchard'
    from='juliet@capulet.lit/balcony'
    id='info1'>
  <query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>
Example 2. Partner's client advertises support for reactions
<iq type='result'
    to='juliet@capulet.lit/balcony'
    from='romeo@montague.lit/orchard'
    id='info1'>
  <query xmlns='http://jabber.org/protocol/disco#info'>
...
    <feature var='urn:xmpp:reactions:0'/>
...
  </query>
  </iq>

2.2 Restricted reactions

In some cases, only a limited number and/or subset of emojis are allowed to react to a message. This is particularly useful in the context of gateways to other chat networks that are not as permissive about which and how many emojis can be used for message reactions. MUC components may also allow room admins to restrict the subset and/or number of emojis per message.

To allow clients to adapt their UIs, entities that have such restrictions in place SHOULD advertise it with Service Discovery Extensions (XEP-0128) [4] in a Data Forms (XEP-0004) [5] using the 'urn:xmpp:reactions:0:restrictions' namespace as FORM_TYPE.

Example 3. Entities advertises support for restricted reactions
<iq type='result'
    to='juliet@capulet.lit/balcony'
    from='romeo@montague.lit/orchard'
    id='info1'>
  <query xmlns='http://jabber.org/protocol/disco#info'>
  ...
    <feature var='urn:xmpp:reactions:0'/>
    <x xmlns='jabber:x:data' type='result'>
      <field var='FORM_TYPE' type='hidden'>
        <value>urn:xmpp:reactions:0:restrictions</value>
      </field>
      <field var='max_reactions_per_user'>
        <value>1</value>
      </field>
      <field var='allowlist'>
        <value>💘</value>
        <value>❤️</value>
        <value>💜</value>
      </field>
    </x> 
  ...
  </query>
</iq>

3. Use Cases

3.1 Sending reactions to a message

When a user chooses to react to a message with a certain emoji, the client sends a <message> stanza containing a <reactions> element. The chosen emoji is included in a <reaction> element within the <reactions> element. The message is referred to by including its ID or in MUCs its stanza-id as defined in Unique and Stable Stanza IDs (XEP-0359) [6] in the 'id' attribute of the <reactions> element.

Example 4. Romeo sends a message
<message to='juliet@capulet.net/balcony' id='744f6e18-a57a-11e9-a656-4889e7820c76' type='chat'>
  <body>Hello, world!</body>
</message>
Example 5. Juliet sends a 👋 reaction to the message
<message to='romeo@capulet.net/orchard' id='7fdd29fa-a57a-11e9-b04a-4889e7820c76' type='chat'>
  <reactions id='744f6e18-a57a-11e9-a656-4889e7820c76' xmlns='urn:xmpp:reactions:0'>
    <reaction>👋</reaction>
  </reactions>
  <store xmlns="urn:xmpp:hints"/>
</message>

3.2 Updating reactions to a message

If the user chooses to remove reactions from or add reactions to a message they have already reacted to, the client sends a <message> with all <reaction> elements that are (still or newly) applicable to that message.

Example 6. Juliet adds a 🐢 reaction to the message
<message to='romeo@capulet.net/orchard' id='96d73204-a57a-11e9-88b8-4889e7820c76' type='chat'>
  <reactions id='744f6e18-a57a-11e9-a656-4889e7820c76' xmlns='urn:xmpp:reactions:0'>
    <reaction>👋</reaction>
    <reaction>🐢</reaction>
  </reactions>
  <store xmlns="urn:xmpp:hints"/>
</message>

In order to remove all reactions from a message, an empty <reactions> element is sent.

Example 7. Juliet removes all reactions from the message
<message to='romeo@capulet.net/orchard' id='973c9d2e-a57a-11e9-af82-4889e7820c76' type='chat'>
  <reactions id='744f6e18-a57a-11e9-a656-4889e7820c76' xmlns='urn:xmpp:reactions:0'/>
  <store xmlns="urn:xmpp:hints"/>
</message>

3.3 Rejecting a reaction

Entities implementing reaction restrictions MUST reply to invalid reactions payloads with a message type="error" containing a 'not-acceptable' error. The error payload SHOULD contain a human-readable text message explaining the reaction rules.

Example 8. Romeo sends a message
<message from="romeo@legacy-love-network.capulet.net"
        to='juliet@capulet.net'
        id='restricted-reactions-1'
        type='chat'>
  <body>I shall only accept heart emojis as reactions</body>
</message>
Example 9. Juliet reacts with both a 💘 and a 💜
<message from="juliet@capulet.net"
        to='romeo@legacy-love-network.capulet.net'
        id='will-be-rejected1'
        type='chat'>
  <reactions id='restricted-reactions-1' xmlns='urn:xmpp:reactions:0'>
    <reaction>💘</reaction>
    <reaction>💜</reaction>
  </reactions>
  <store xmlns="urn:xmpp:hints"/>
</message>
Example 10. Romeo rejects the reactions
<message from="romeo@legacy-love-network.capulet.net"
        to="juliet@capulet.net"
        type="error"
        id="will-be-rejected1">
  <error xmlns="jabber:client" type="modify">
    <not-acceptable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
    <text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">
      Only 💘, ❤️ and 💜 are allowed as reactions on this legacy IM network,
      and you can only use a single emoji at once.
    </text>
  </error>
</message>

When receiving this error message, the reaction-sending entity MUST revert the "message reactions" to its previous state in its user interface.

4. Business Rules

Messages MUST NOT contain more than one <reactions> element

A message containing a <reactions> element SHOULD be of type 'chat' or 'groupchat'.

A <reaction> element SHOULD only contain Unicode codepoints that can be displayed as a single emoji, as specified in the latest revision of the Unicode® Technical Standard #51 [7]. Receiving entities MAY ignore <reaction> elements that do not comply with this specification.

A receiving client SHOULD show reactions attached to the message they were in response to. Reactions MAY be displayed in a summarized fashion.

A <reactions> element MUST NOT contain the same reaction more than once. A receiving entity SHOULD ignore duplicate reactions inside a <reactions> element.

The sending entity SHOULD add a <store/> hint, as defined in Message Processing Hints (XEP-0334) [8], if the message being reacted to does not carry a <no-store/> hint.

If a message is updated using Last Message Correction (XEP-0308) [9], the 'id' attribute of the <reactions> element SHOULD reference the original message ID. A receiving entity SHOULD accept messages with a <reactions> element referencing a message correction and SHOULD handle such elements as if it was using the message ID of the original message.

4.1 Acceptable reactions

In direct conversations, a reaction MUST only be accepted if the sender's bare JID matches the bare JID of any of the two involved parties.

In MUCs and MUC PMs, the recipient SHOULD ensure that the real bare JID of the sending occupant did not already send a reaction to that message to accept it as a new reaction, e.g. by keeping track of leave/join presences since the message was sent. This implies that in semi-anonymous MUCs it MAY be impossible to attach reactions to a message received from the history. A reaction MAY still be a valid reaction update (as per the next paragraph) if it was not accepted as a new reaction.

A reaction MUST only be considered an update if it orignates from the same sender as a previous reaction message. In direct conversations, this means the bare JID MUST match the original bare JID. In MUCs and MUC PMs, the sender's full JID MAY not match the original full JID, but the recipient MUST ensure that the real bare JID of the sending occupant is the same as the real bare JID of the previous reaction message, e.g. by keeping track of leave/join presences.

If a message containing a <reactions> element arrives delayed, which means it carries a <delay/> element as defined in Delayed Delivery (XEP-0203) [10], it SHOULD only be accepted if no newer reaction from the same sender was already accepted.

4.2 Using the correct ID

For messages of type 'groupchat', the stanza's 'id' attribute MUST NOT be used for reactions. Instead, in group chat situations, the ID assigned to the stanza by the group chat itself must be used. This is discovered in a <stanza-id> element with a 'by' attribute that matches the bare JID of the group chat, as defined in Unique and Stable Stanza IDs (XEP-0359) [6].

This implies that group chat messages without a Unique and Stable Stanza IDs (XEP-0359) [6] stanza-id cannot be reacted to.

For other message types, the sender should use the 'id' from a Unique and Stable Stanza IDs (XEP-0359) [6] <origin-id> if present, or the value of the 'id' attribute on the <message> otherwise.

5. IANA Considerations

This document requires no interaction with the Internet Assigned Numbers Authority (IANA) [11].

6. XMPP Registrar Considerations

6.1 Protocol Namespaces

The XMPP Registrar [12] includes 'urn:xmpp:reactions:0' in its registry of protocol namespaces (see <https://xmpp.org/registrar/namespaces.html>).

7. XML Schema

7.1 urn:xmpp:reactions:0

<?xml version='1.0' encoding='UTF-8'?>

<xs:schema
    xmlns:xs='http://www.w3.org/2001/XMLSchema'
    targetNamespace='urn:xmpp:reactions:0'
    xmlns='urn:xmpp:reactions:0'
    elementFormDefault='qualified'>

  <xs:element name='reactions'>
    <xs:complexType>
      <xs:sequence minOccurs='0' maxOccurs='unbounded'>
        <xs:element name='reaction' type='xs:string'/>
      </xs:sequence>
      <xs:attribute name='id' type='xs:string' use='required'/>
    </xs:complexType>
  </xs:element>

</xs:schema>

Appendices

Appendix A: Document Information

Series
XEP
Number
0444
Publisher
XMPP Standards Foundation
Status
Experimental
Type
Standards Track
Version
0.2.1
Last Updated
2024-04-15
Approving Body
XMPP Council
Dependencies
XMPP Core, XEP-0001, XEP-0030, XEP-0115, XEP-0203, XEP-0334, XEP-0359
Supersedes
None
Superseded By
None
Short Name
reactions
Source Control
HTML

This document in other formats: XML  PDF

Appendix B: Author Information

Natalie Wirth
Email
xsf@larma.de
Marvin Wissfeld
Email
xsf@larma.de
JabberID
jabber@larma.de

Copyright

This XMPP Extension Protocol is copyright © 1999 – 2024 by the XMPP Standards Foundation (XSF).

Permissions

Permission is hereby granted, free of charge, to any person obtaining a copy of this specification (the "Specification"), to make use of the Specification without restriction, including without limitation the rights to implement the Specification in a software program, deploy the Specification in a network service, and copy, modify, merge, publish, translate, distribute, sublicense, or sell copies of the Specification, and to permit persons to whom the Specification is furnished to do so, subject to the condition that the foregoing copyright notice and this permission notice shall be included in all copies or substantial portions of the Specification. Unless separate permission is granted, modified works that are redistributed shall not contain misleading information regarding the authors, title, number, or publisher of the Specification, and shall not claim endorsement of the modified works by the authors, any organization or project to which the authors belong, or the XMPP Standards Foundation.

Disclaimer of Warranty

## NOTE WELL: This Specification is provided on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. ##

Limitation of Liability

In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall the XMPP Standards Foundation or any author of this Specification be liable for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising from, out of, or in connection with the Specification or the implementation, deployment, or other use of the Specification (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if the XMPP Standards Foundation or such author has been advised of the possibility of such damages.

IPR Conformance

This XMPP Extension Protocol has been contributed in full conformance with the XSF's Intellectual Property Rights Policy (a copy of which can be found at <https://xmpp.org/about/xsf/ipr-policy> or obtained by writing to XMPP Standards Foundation, P.O. Box 787, Parker, CO 80134 USA).

Visual Presentation

The HTML representation (you are looking at) is maintained by the XSF. It is based on the YAML CSS Framework, which is licensed under the terms of the CC-BY-SA 2.0 license.

Appendix D: Relation to XMPP

The Extensible Messaging and Presence Protocol (XMPP) is defined in the XMPP Core (RFC 6120) and XMPP IM (RFC 6121) specifications contributed by the XMPP Standards Foundation to the Internet Standards Process, which is managed by the Internet Engineering Task Force in accordance with RFC 2026. Any protocol defined in this document has been developed outside the Internet Standards Process and is to be understood as an extension to XMPP rather than as an evolution, development, or modification of XMPP itself.

Appendix E: Discussion Venue

The primary venue for discussion of XMPP Extension Protocols is the <standards@xmpp.org> discussion list.

Discussion on other xmpp.org discussion lists might also be appropriate; see <https://xmpp.org/community/> for a complete list.

Errata can be sent to <editor@xmpp.org>.

Appendix F: Requirements Conformance

The following requirements keywords as used in this document are to be interpreted as described in RFC 2119: "MUST", "SHALL", "REQUIRED"; "MUST NOT", "SHALL NOT"; "SHOULD", "RECOMMENDED"; "SHOULD NOT", "NOT RECOMMENDED"; "MAY", "OPTIONAL".

Appendix G: Notes

1. XEP-0367: Message Attaching <https://xmpp.org/extensions/xep-0367.html>.

2. XEP-0030: Service Discovery <https://xmpp.org/extensions/xep-0030.html>.

3. XEP-0115: Entity Capabilities <https://xmpp.org/extensions/xep-0115.html>.

4. XEP-0128: Service Discovery Extensions <https://xmpp.org/extensions/xep-0128.html>.

5. XEP-0004: Data Forms <https://xmpp.org/extensions/xep-0004.html>.

6. XEP-0359: Unique and Stable Stanza IDs <https://xmpp.org/extensions/xep-0359.html>.

7. Unicode® Technical Standard #51 <http://www.unicode.org/reports/tr51/>.

8. XEP-0334: Message Processing Hints <https://xmpp.org/extensions/xep-0334.html>.

9. XEP-0308: Last Message Correction <https://xmpp.org/extensions/xep-0308.html>.

10. XEP-0203: Delayed Delivery <https://xmpp.org/extensions/xep-0203.html>.

11. The Internet Assigned Numbers Authority (IANA) is the central coordinator for the assignment of unique parameter values for Internet protocols, such as port numbers and URI schemes. For further information, see <http://www.iana.org/>.

12. The XMPP Registrar maintains a list of reserved protocol namespaces as well as registries of parameters used in the context of XMPP extension protocols approved by the XMPP Standards Foundation. For further information, see <https://xmpp.org/registrar/>.

Appendix H: Revision History

Note: Older versions of this specification might be available at https://xmpp.org/extensions/attic/

  1. Version 0.2.1 (2024-04-15)
    fix grammar and spelling
    wb
  2. Version 0.2.0 (2022-12-30)
    Add emoji rejection mechanism.
    NC
  3. Version 0.1.1 (2022-12-30)
    Add the XML Schema
    egp
  4. Version 0.1.0 (2020-10-13)
    Accepted by vote of Council on 2020-10-07.
    XEP Editor (jsc)
  5. Version 0.0.1 (2019-07-14)

    First draft.

    nw/mw

Appendix I: Bib(La)TeX Entry

@report{wirth2019reactions,
  title = {Message Reactions},
  author = {Wirth, Natalie and Wissfeld, Marvin},
  type = {XEP},
  number = {0444},
  version = {0.2.1},
  institution = {XMPP Standards Foundation},
  url = {https://xmpp.org/extensions/xep-0444.html},
  date = {2019-07-14/2024-04-15},
}

END