<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
<xep xmlns="">
<header>
  <title>Chat notification settings</title>
  <abstract>This document defines an XMPP protocol extension to synchronise per-chat notification settings across different clients.</abstract>
  
<legal>
<copyright>This XMPP Extension Protocol is copyright © 1999 – 2024 by the <link url="https://xmpp.org/">XMPP Standards Foundation</link> (XSF).</copyright>
<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.</permissions>
<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. ##</warranty>
<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.</liability>
<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 &lt;<link url="https://xmpp.org/about/xsf/ipr-policy">https://xmpp.org/about/xsf/ipr-policy</link>&gt; or obtained by writing to XMPP Standards Foundation, P.O. Box 787, Parker, CO 80134 USA).</conformance>
</legal>
  <number>0492</number>
  <status>Experimental</status>
  <type>Standards Track</type>
  <sig>Standards</sig>
  <approver>Council</approver>
  <dependencies>
    <spec>XMPP Core</spec>
    <spec>XMPP IM</spec>
    <spec>XEP-0402</spec>
  </dependencies>
  <supersedes/>
  <supersededby/>
  <shortname>notification-settings</shortname>
  
  <author>
    <firstname>Nicolas</firstname>
    <surname>Cedilnik</surname>
    <email>nicoco@nicoco.fr</email>
    <jid>nicoco@nicoco.fr</jid>
  </author>

  
  <author>
    <firstname>Thilo</firstname>
    <surname>Molitor</surname>
    <email>thilo+xmpp@eightysoft.de</email>
    <jid>thilo.molitor@juforum.de</jid>
  </author>

  <revision>
    <version>0.2.0</version>
    <date>2025-10-25</date>
    <initials>tm</initials>
    <remark>
      <ul>
        <li>Rework the spec to use more of the Service Discovery Identities registry</li>
        <li>Fix the XML schema</li>
        <li>Move the &lt;advanced/&gt; element into the notification setting element</li>
        <li>Bump the namespace</li>
      </ul>
    </remark>
  </revision>
  <revision>
    <version>0.1.0</version>
    <date>2024-07-01</date>
    <initials>XEP Editor: dg</initials>
    <remark>
      <ul>
        <li>Promoted to Experimental</li>
      </ul>
    </remark>
  </revision>
  <revision>
    <version>0.0.2</version>
    <date>2024-06-08</date>
    <initials>nc</initials>
    <remark><p>Update after discussions on the standards@ mailing list.</p></remark>
  </revision>
  <revision>
    <version>0.0.1</version>
    <date>2024-06-06</date>
    <initials>nc</initials>
    <remark><p>Initial version.</p></remark>
  </revision>
</header>
<section1 topic="Introduction" anchor="intro">
  <p>"Notifications" are (usually) pop-up windows that appear in a visible area of the screen even when the emitting application is in the background, often triggering a sound alert. <em>Instant</em> messaging clients expectedly use notifications to inform users when they receive a message.</p>
  <p>Users may want to customise which conversations should trigger notifications and under which conditions. In practice, this is already implemented in many instant messaging clients, including XMPP clients. This specification proposes a mechanism to synchronise per-discussion notification settings across different XMPP clients and other XMPP based applications.</p>
</section1>
<section1 topic="Protocol" anchor="protocol">
  <section2 topic="The notify element" anchor="notify">
  <p>Notification settings are represented by the &lt;notify&gt; element. This element MUST be a child of an element identifying a specific chat by its JID, such as a <span class="ref"><link url="https://xmpp.org/extensions/xep-0402.html">PEP Native Bookmarks (XEP-0402)</link></span> <note>XEP-0402: PEP Native Bookmarks &lt;<link url="https://xmpp.org/extensions/xep-0402.html">https://xmpp.org/extensions/xep-0402.html</link>&gt;.</note> &lt;extensions&gt;.</p>
  <p>This protocol specifies three notification elements as children for the &lt;notify&gt; element, each corresponding to a notification setting: &lt;always&gt; &lt;on-mention&gt; and &lt;never&gt;. A notification element without attributes is called a "fallback element".</p>
<example caption="Most basic example"><![CDATA[
<notify xmlns=']]>urn:xmpp:notification-settings:1<![CDATA['>
  <never />
</notify>
]]></example>
  </section2>
  <section2 topic="Identities" anchor="identities">
    <p>Applications MAY choose different notification settings depending on their own Service Discovery Identity. In this case, the two optional attributes '<tt>identity-category</tt>' and '<tt>identity-type</tt>' MAY be added to the notification element, using values registered in the Service Discovery Identities registry at &lt;<link url="https://xmpp.org/registrar/disco-categories.html">https://xmpp.org/registrar/disco-categories.html</link>&gt;.</p>
    <p>The '<tt>identity-type</tt>' attribute MAY be omitted, if the notification setting should apply to a whole Identity Category. You MUST NOT add the '<tt>identity-type</tt>' attribute without an accompanying '<tt>identity-category</tt>' attribute.</p>
<example caption="An example of notification settings by identity"><![CDATA[
<notify xmlns=']]>urn:xmpp:notification-settings:1<![CDATA['>
  <never identity-category="client" identity-type="pc" />
  <on-mention identity-category="client" identity-type="phone" />
  <on-mention identity-category="gateway" />
  <always />
</notify>
]]></example>
  </section2>
  <section2 topic="Advanced notification settings" anchor="advanced">
  <p>Finally, clients can use this specification to synchronise finer-grained notification settings using custom namespaces in the optional &lt;advanced/&gt; child of the notification elements.</p>
  <p>The &lt;advanced/&gt; element SHOULD NOT be empty.</p>
<example caption="Complex example of finer-grained notification settings"><![CDATA[
<notify xmlns=']]>urn:xmpp:notification-settings:1<![CDATA['>
  <never identity-category="client" identity-type="pc">
    <advanced>
      <my-custom-extension xmlns="custom:ns-1">
        <when day-of-week="monday">night-time-only</day-of-week>
        ...
      </custom>
      <cool-custom-extension-2 xmlns="custom:ns-2">
        <weather>raining</weather>
        ...
      </custom>
      ...
    </advanced>
  </never>
  <on-mention identity-category="client" identity-type="phone" />
  <on-mention identity-category="gateway" />
  <always>
    <advanced>
      <better-custom-extension xmlns="custom:ns-3">
        <when day-of-week="saturday" />
        <when day-of-week="sunday" />
        ...
      </custom>
      ...
    </advanced>
  </always>
</notify>
]]></example>
  </section2>
</section1>
<section1 topic="Business Rules" anchor="rules">
  <p>Applications implementing this specification MUST NOT delete or alter the &lt;advanced /&gt; notification settings they do not support when updating the notification settings for a given conversation.</p>
  <p>When reading the notification settings for a given conversation, applications implementing this specification MUST use the element most specific to their own application identity. Sorted from high to low specifity, this is:</p>
  <ol>
    <li>Matching '<tt>identity-category</tt>' and '<tt>identity-type</tt>' attributes</li>
    <li>Matching '<tt>identity-category</tt>' attribute</li>
    <li>Fallback element without '<tt>identity-category</tt>' and '<tt>identity-type</tt>' attributes</li>
  </ol>
  <p>When writing the notification settings, applications MAY use the '<tt>identity-category</tt>' and '<tt>identity-type</tt>' attributes as described in the <link url="#identities">Identities</link> section. If a fallback element without any attributes isn't present, the application SHOULD add it with the same settings. As secondary fallback, it MAY also add a notification setting having only the '<tt>identity-category</tt>' attribute, if not already present.</p>
  <p>There SHALL NOT be more than one notification element having the same name, attributes and attribute values.</p>
  <p>Applications using the &lt;advanced/&gt; child SHOULD attempt to choose the parent notification element being the closest to what they offer as a fallback for other applications not supporting the advanced settings.</p>
  <p>In the absence of any notification settings for a given conversation, "always" SHOULD be assumed for direct chats and private group chats, and <tt>on-mention</tt> for public group chats.</p>
  <p>The "on-mention" notification MAY rely on the user's nickname being spelled out in an incoming message in a group chat, but SHOULD rely on mechanisms to explicitly "ping" the user, such as a <span class="ref"><link url="https://xmpp.org/extensions/xep-0461.html">Message Replies (XEP-0461)</link></span> <note>XEP-0461: Message Replies &lt;<link url="https://xmpp.org/extensions/xep-0461.html">https://xmpp.org/extensions/xep-0461.html</link>&gt;.</note> element referring a user's previous message or a specific mention, such as a <span class="ref"><link url="https://xmpp.org/extensions/xep-0372.html">References (XEP-0372)</link></span> <note>XEP-0372: References &lt;<link url="https://xmpp.org/extensions/xep-0372.html">https://xmpp.org/extensions/xep-0372.html</link>&gt;.</note> mention.</p>
</section1>
<section1 topic="Security Considerations" anchor="security">
  <p>See considerations in <span class="ref"><link url="https://xmpp.org/extensions/xep-0402.html">PEP Native Bookmarks (XEP-0402)</link></span> <note>XEP-0402: PEP Native Bookmarks &lt;<link url="https://xmpp.org/extensions/xep-0402.html">https://xmpp.org/extensions/xep-0402.html</link>&gt;.</note>.</p>
</section1>
<section1 topic="IANA Considerations" anchor="iana">
  <p>This document requires no interaction with the <span class="ref"><link url="http://www.iana.org/">Internet Assigned Numbers Authority (IANA)</link></span> <note>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 &lt;<link url="http://www.iana.org/">http://www.iana.org/</link>&gt;.</note>.</p>
</section1>
<section1 topic="XMPP Registrar Considerations" anchor="registrar">
  <section2 topic="Protocol Namespaces" anchor="registrar-ns">
    <p>This specification defines the following XML namespace:</p>
    <ul>
      <li>urn:xmpp:notification-settings:1</li>
    </ul>
    <p>The <span class="ref"><link url="https://xmpp.org/registrar/">XMPP Registrar</link></span> <note>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 &lt;<link url="https://xmpp.org/registrar/">https://xmpp.org/registrar/</link>&gt;.</note> includes this namespace in the registry located at &lt;<link url="https://xmpp.org/registrar/namespaces.html">https://xmpp.org/registrar/namespaces.html</link>&gt;, as described in Section 4 of <span class="ref"><link url="https://xmpp.org/extensions/xep-0053.html">XMPP Registrar Function (XEP-0053)</link></span> <note>XEP-0053: XMPP Registrar Function &lt;<link url="https://xmpp.org/extensions/xep-0053.html">https://xmpp.org/extensions/xep-0053.html</link>&gt;.</note>.</p>
  </section2>
  <section2 topic="Protocol Versioning" anchor="registrar-versioning">
    <p>If the protocol defined in this specification undergoes a revision that is not fully backwards-compatible with an older version, the XMPP Registrar shall increment the protocol version number found at the end of the XML namespaces defined herein, as described in Section 4 of <cite>XEP-0053</cite>.</p>
  </section2>
</section1>
<section1 topic="XML Schema" anchor="schema">
  <code><![CDATA[
<?xml version='1.0' encoding='UTF-8'?>

<xs:schema
    xmlns:xs='http://www.w3.org/2001/XMLSchema'
    targetNamespace=']]>urn:xmpp:notification-settings:1<![CDATA['
    xmlns=']]>urn:xmpp:notification-settings:1<![CDATA['
    elementFormDefault='qualified'>

  <xs:annotation>
    <xs:documentation>
      The protocol documented by this schema is defined in
      XEP-]]>0492<![CDATA[: http://www.xmpp.org/extensions/xep-]]>0492<![CDATA[.html
    </xs:documentation>
  </xs:annotation>

  <xs:element name='notify'>
    <xs:complexType>
      <xs:sequence>
        <xs:element name='always' type='setting' minOccurs='0' maxOccurs='unbounded'/>
        <xs:element name='on-mention' type='setting' minOccurs='0' maxOccurs='unbounded'/>
        <xs:element name='never' type='setting' minOccurs='0' maxOccurs='unbounded'/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

  <xs:complexType name="setting">
    <xs:sequence>
      <xs:element name='advanced' minOccurs='0' maxOccurs='1'>
        <xs:complexType>
          <xs:sequence>
            <xs:any namespace='##other' minOccurs='1' maxOccurs='unbounded' processContents='lax'/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
    <xs:attribute name='identity-category' type='xs:string' use='optional'/>
    <xs:attribute name='identity-type' type='xs:string' use='optional'/>
  </xs:complexType>

</xs:schema>
]]></code>
</section1>
</xep>
