1
0
mirror of https://github.com/moparisthebest/xeps synced 2024-11-15 22:05:01 -05:00
xeps/inbox/quick-response.xml

186 lines
10 KiB
XML
Raw Normal View History

2020-04-20 13:25:44 -04:00
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE xep SYSTEM 'xep.dtd' [
<!ENTITY % ents SYSTEM "xep.ent">
<!ENTITY ns "urn:xmpp:tmp:quick-response">
<!ENTITY xepname "Quick Response">
%ents;
]>
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
<xep>
<header>
<title>&xepname;</title>
<abstract>Quickly respond to automated messages.</abstract>
&LEGALNOTICE;
<number>xxxx</number>
<status>ProtoXEP</status>
<type>Standards Track</type>
<sig>Standards</sig>
<dependencies>
<spec>XMPP Core</spec>
</dependencies>
<supersedes/>
<supersededby/>
<shortname>NOT_YET_ASSIGNED</shortname>
<author>
<firstname>Tim</firstname>
<surname>Henkes</surname>
<email>me@syndace.dev</email>
</author>
<revision>
2020-05-03 06:43:57 -04:00
<version>0.0.1</version>
2020-04-20 13:25:44 -04:00
<date>2020-04-20</date>
<initials>th</initials>
<remark>Initial version</remark>
</revision>
</header>
<section1 anchor="intro" topic="Introduction">
2020-04-20 17:51:09 -04:00
<p>Interactions with bots often require sending one of multiple predefined (plaintext) messages. This specification offers a way for XMPP entities to list possible responses to a message, so that entities that receive such a list can offer convenient UI to quickly respond with one of them. Additionally, this specification provides a way for entities to provide generic actions in similar fashion to quick responses.</p>
2020-04-20 13:25:44 -04:00
</section1>
<section1 anchor="reqs" topic="Requirements">
<ul>
2020-04-20 17:51:09 -04:00
<li>Offer a simple way to list possible responses to a message.</li>
2020-04-20 13:25:44 -04:00
<li>Offer a solution that doesn't rely on the receiving device to support &xepname;.</li>
</ul>
</section1>
<section1 anchor="usecases" topic="Use Cases">
2020-04-20 17:51:09 -04:00
<p>A chat bot wants to provide a list of possible responses to a message it sends.</p>
2020-04-20 13:25:44 -04:00
<p>A chat bot wants to provide quick access to certain actions for convenience.</p>
</section1>
<section1 anchor="elements" topic="Elements">
2020-04-20 17:51:09 -04:00
<section2 anchor="response-element" topic="Response">
<p>Each possible response is represented by a &lt;response&gt; element in the <tt>&ns;</tt> namespace.</p>
2020-04-20 13:25:44 -04:00
2020-04-20 17:51:09 -04:00
<example><![CDATA[<response xmlns="]]>&ns;<![CDATA[" xml:lang="en" value="yes" label="Yes!" />]]></example>
2020-04-20 13:25:44 -04:00
<dl>
<di>
2020-04-20 17:51:09 -04:00
<dt>value</dt>
<dd>The <tt>value</tt> is the internationalized textual payload to put into the &lt;body&gt; of the message stanza that is sent when this response is selected.</dd>
</di>
<di>
<dt>label</dt>
<dd>The <tt>label</tt> is an optional internationalized textual label for this response. Clients that offer UI for quick selection of one of the possible responses MAY refer to this response by label instead of value. Topic for discussion: are labels required or should UIs just show the value? Are labels maybe even harmful because they could show something totally different than the value?</dd>
</di>
<di>
<dt>xml:lang</dt>
<dd>The <tt>xml:lang</tt> set on this element MUST mirror the <tt>xml:lang</tt> of the &lt;body&gt; included in the message stanza next to the &lt;response&gt; element. Refer to the <link url="#i18n">Internationalization Considerations</link> for details. This includes not setting an <tt>xml:lang</tt> at all if not present on the &lt;body&gt;.</dd>
2020-04-20 13:25:44 -04:00
</di>
</dl>
</section2>
2020-04-20 17:51:09 -04:00
<section2 anchor="action-element" topic="Action">
<p>Each available action is represented by an &lt;action&gt; element in the <tt>&ns;</tt> namespace.</p>
2020-04-20 13:25:44 -04:00
2020-04-20 17:51:09 -04:00
<example><![CDATA[<action xmlns="]]>&ns;<![CDATA[" xml:lang="en" id="merge" label="Merge Now!" />]]></example>
2020-04-20 13:25:44 -04:00
<dl>
2020-04-20 17:51:09 -04:00
<di><dt>id</dt><dd>A string identifying the action. When selected, this id is sent in an &lt;action-selected&gt; element as part of a message stanza without any &lt;body&gt; elements.</dd></di>
<di><dt>label</dt><dd>Internationalized textual label for this action. The <tt>xml:lang</tt> attribute and the language of the label should mirror those of the &lt;body&gt; element included in this &lt;message&gt;.</dd></di>
<di>
<dt>xml:lang</dt>
<dd>The <tt>xml:lang</tt> set on this element MUST mirror the <tt>xml:lang</tt> of the &lt;body&gt; included in the message stanza next to the &lt;action&gt; element. Refer to the <link url="#i18n">Internationalization Considerations</link> for details. This includes not setting an <tt>xml:lang</tt> at all if not present on the &lt;body&gt;.</dd>
</di>
2020-04-20 13:25:44 -04:00
</dl>
</section2>
<section2 anchor="action-selected-element" topic="Action Selection">
2020-04-20 17:51:09 -04:00
<p>A selected action is represented by an &lt;action-selected&gt; element in the <tt>&ns;</tt> namespace.</p>
2020-04-20 13:25:44 -04:00
<example><![CDATA[<action-selected xmlns="]]>&ns;<![CDATA[" id="merge" />]]></example>
<dl>
2020-04-20 17:51:09 -04:00
<di><dt>id</dt><dd>The id of the selected action, as defined in the selected &lt;action&gt;.</dd></di>
2020-04-20 13:25:44 -04:00
</dl>
</section2>
</section1>
<section1 anchor="protocol" topic="Protocol">
2020-04-20 17:51:09 -04:00
<section2 anchor="sending-possible-responses" topic="Sending a Set of Possible Responses">
<p>A message with possible responses is sent by including one or more &lt;response&gt; elements with distinct values.</p>
2020-04-20 13:25:44 -04:00
<example><![CDATA[<message from="rootbot@example.com">
<body xml:lang="en">Execute `rm -rf /`? (yes/no)</body>
2020-04-20 17:51:09 -04:00
<response xmlns="]]>&ns;<![CDATA[" xml:lang="en" value="yes" label="Sure!" />
<response xmlns="]]>&ns;<![CDATA[" xml:lang="en" value="no" label="Uuuuuuh..." />
2020-04-20 13:25:44 -04:00
</message>]]></example>
2020-04-20 17:51:09 -04:00
<p>A single message MUST NOT contain multiple &lt;response&gt; elements with the same values for the <tt>value</tt> or the <tt>label</tt> attributes.</p>
<p>Clients that receive a message containing possible responses MAY offer UI to quickly and conveniently select one of the responses. Clients MUST NOT limit the allowed responses to only these responses: the sending entity could accept responses that are not explicitly listed, for example free text responses in addition to a few fixed possibilities.</p>
2020-04-20 13:25:44 -04:00
</section2>
<section2 anchor="selecting-a-response" topic="Selecting a Response">
2020-04-20 17:51:09 -04:00
<p>When the user selects a response, their client sends a plaintext message body containing the <tt>value</tt> as &lt;body&gt; text, also copying the <tt>xml:lang</tt> of the &lt;response&gt; to the &lt;body&gt;.</p>
2020-04-20 13:25:44 -04:00
<example><![CDATA[<message to="rootbot@example.com">
<body xml:lang="en">no</body>
</message>]]></example>
2020-04-20 17:51:09 -04:00
<p>The sender of the original message, in this example <tt>rootbot@example.com</tt>, checks incoming messages for a &lt;body&gt; that only contains the <tt>value</tt> of a &lt;response&gt; and matches in <tt>xml:lang</tt> to see if a response was selected. In this example, the &lt;body&gt; matches the <tt>value</tt> of the English translation for the response "No".</p>
2020-04-20 13:25:44 -04:00
</section2>
<section2 anchor="sending-available-actions" topic="Sending a Set of Available Actions">
2020-04-20 17:51:09 -04:00
<p>A message with available actions is sent by including one or more &lt;action&gt; elements with distinct <tt>id</tt>s.</p>
2020-04-20 13:25:44 -04:00
<example><![CDATA[<message to="gitbot@example.com">
2020-04-20 17:51:09 -04:00
<body>New merge request opened by ExampleUser: https://git.example.com/example/mrs/3/</body>
<action xmlns="]]>&ns;<![CDATA[" id="merge-32643" label="Merge Now" />
2020-04-20 13:25:44 -04:00
</message>]]></example>
2020-04-20 17:51:09 -04:00
<p>A single message MUST NOT contain multiple &lt;action&gt; elements with the same values for the <tt>id</tt> or <tt>label</tt> attributes.</p>
2020-04-20 13:25:44 -04:00
<p>Clients that receive a message containing available actions SHOULD offer UI to select one of the actions.</p>
</section2>
<section2 anchor="selecting-an-action" topic="Selecting an Action">
2020-04-20 17:51:09 -04:00
<p>When the user selects an action, their client sends a message containing an &lt;action-selected&gt; element which identifies the selected action. The message does not contain a &lt;body&gt;.</p>
2020-04-20 13:25:44 -04:00
<example><![CDATA[<message to="gitbot@example.com">
2020-04-20 17:51:09 -04:00
<action-selected xmlns="]]>&ns;<![CDATA[" id="merge-32643" />
2020-04-20 13:25:44 -04:00
</message>]]></example>
</section2>
</section1>
<section1 anchor="rules" topic="Business Rules">
2020-04-20 17:51:09 -04:00
<p>All message bodies SHOULD always list the (internationalized) possible responses too, so that users of clients that don't support &xepname; can still know what the possible responses are.</p>
2020-04-20 13:25:44 -04:00
<p>Actions SHOULD only be a quicker way to access a feature that could also be accessed using information in the message body. For example, a bot that notifies about a new merge request includes in its notification message body a link to the web interface where manual merging is possible. An action could offer a more convenient way to merge, without taking the route via the web interface. In summary, users of clients that don't support &xepname; SHOULD still have a way to manually trigger the action.</p>
<p>Clients MUST only provide quick responses for the most recently received message that contains text content.</p>
2020-04-20 17:51:09 -04:00
<p>Clients SHOULD provide actions not only for the most recently received message that contains actions, but also for previous messages with actions. Sending clients MUST keep in mind that they have to choose/generate <tt>id</tt>s for each &lt;action&gt; accordingly, if they need to differentiate between messages.</p>
2020-04-20 13:25:44 -04:00
</section1>
<section1 anchor="access" topic="Accessibility Considerations">
<p>The elements introduced in this specification carry clear semantics that allow clients to implement UI flexibly for their target user group and hardware platform capabilites.</p>
</section1>
<section1 anchor="i18n" topic="Internationalization Considerations">
2020-04-20 17:51:09 -04:00
<p>While it is generally possible to include multiple &lt;body&gt; elements with different <tt>xml:lang</tt>s in a single message stanza, this is intentionally not supported by this specification. Message stanzas that also contain elements in the <tt>&ns;</tt> namespace MUST NOT contain more than one &lt;body&gt; element.</p>
2020-04-20 13:25:44 -04:00
</section1>
<section1 anchor="security" topic="Security Considerations">
<p>This specification only adds quicker/more convenient access to features that are accessible anyway.</p>
</section1>
<section1 anchor="iana" topic="IANA Considerations">
<p>This document requires no interaction with the Internet Assigned Numbers Authority (IANA).</p>
</section1>
<section1 anchor="registrar" topic="XMPP Registrar Considerations">
<section2 anchor="namespaces" topic="Protocol Namespaces">
<p>This specification defines the following XMPP namespaces:</p>
<ul>
<li>&ns;</li>
</ul>
</section2>
<section2 anchor="versioning" topic="Protocol Versioning">
&NSVER;
</section2>
</section1>
<section1 anchor="schema" topic="XML Schema">
<code>TODO</code>
</section1>
</xep>