mirror of
https://github.com/moparisthebest/xeps
synced 2024-11-21 16:55:07 -05:00
quite a bit of feedback incorporated
This commit is contained in:
parent
c09bf67b91
commit
489f22209c
@ -59,122 +59,119 @@
|
|||||||
</header>
|
</header>
|
||||||
|
|
||||||
<section1 anchor="intro" topic="Introduction">
|
<section1 anchor="intro" topic="Introduction">
|
||||||
<p>Interactions with bots often require sending one of multiple predefined (plaintext) messages. This specification offers a way for XMPP entities to list the accepted responses to a message, so that entities that receive such a list can offer convenient UI to quickly respond with one of the allowed responses. Additionally, this specification provides a way for entities to provide generic actions in similar fashion to quick responses.</p>
|
<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>
|
||||||
</section1>
|
</section1>
|
||||||
|
|
||||||
<section1 anchor="reqs" topic="Requirements">
|
<section1 anchor="reqs" topic="Requirements">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Offer a simple way to list allowed responses to a message.</li>
|
<li>Offer a simple way to list possible responses to a message.</li>
|
||||||
<li>Offer a solution that doesn't rely on the receiving device to support &xepname;.</li>
|
<li>Offer a solution that doesn't rely on the receiving device to support &xepname;.</li>
|
||||||
<li>Allow internationalized responses.</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</section1>
|
</section1>
|
||||||
|
|
||||||
<section1 anchor="usecases" topic="Use Cases">
|
<section1 anchor="usecases" topic="Use Cases">
|
||||||
<p>A chat bot wants to provide a list of allowed responses to a message it sends.</p>
|
<p>A chat bot wants to provide a list of possible responses to a message it sends.</p>
|
||||||
<p>A chat bot wants to provide quick access to certain actions for convenience.</p>
|
<p>A chat bot wants to provide quick access to certain actions for convenience.</p>
|
||||||
</section1>
|
</section1>
|
||||||
|
|
||||||
<section1 anchor="elements" topic="Elements">
|
<section1 anchor="elements" topic="Elements">
|
||||||
<section2 anchor="allowed-response-element" topic="Allowed Response">
|
<section2 anchor="response-element" topic="Response">
|
||||||
<p>Each allowed response is represented by an <tt><allowed-response></tt> element in the <tt>&ns;</tt> namespace.</p>
|
<p>Each possible response is represented by a <response> element in the <tt>&ns;</tt> namespace.</p>
|
||||||
|
|
||||||
<example><![CDATA[<allowed-response xmlns="]]>&ns;<![CDATA[">
|
<example><![CDATA[<response xmlns="]]>&ns;<![CDATA[" xml:lang="en" value="yes" label="Yes!" />]]></example>
|
||||||
<translation xml:lang="en" value="yes" label="Yes!" />
|
|
||||||
<translation xml:lang="sv" value="ja" label="Ja!" />
|
|
||||||
</allowed-response>]]></example>
|
|
||||||
|
|
||||||
<dl>
|
<dl>
|
||||||
<di>
|
<di>
|
||||||
<dt><translation></dt>
|
<dt>value</dt>
|
||||||
<dd>One for each <tt><body></tt> and <tt>@xml:lang</tt> included in the <tt><message></tt> this response is a part of. The <tt>@value</tt> is the internationalized textual payload to put into the <tt><body></tt> of the message stanza that is sent when this response is selected. The <tt>@label</tt> is an optional internationalized textual label for this response. Clients that offer UI for quick selection of one of the allowed responses MAY refer to this response by label instead of value.</dd>
|
<dd>The <tt>value</tt> is the internationalized textual payload to put into the <body> 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 <body> included in the message stanza next to the <response> 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 <body>.</dd>
|
||||||
</di>
|
</di>
|
||||||
</dl>
|
</dl>
|
||||||
</section2>
|
</section2>
|
||||||
|
|
||||||
<section2 anchor="available-action-element" topic="Available Action">
|
<section2 anchor="action-element" topic="Action">
|
||||||
<p>Each available action is represented by an <tt><available-action></tt> element in the <tt>&ns;</tt> namespace.</p>
|
<p>Each available action is represented by an <action> element in the <tt>&ns;</tt> namespace.</p>
|
||||||
|
|
||||||
<example><![CDATA[<available-action xmlns="]]>&ns;<![CDATA[" id="merge">
|
<example><![CDATA[<action xmlns="]]>&ns;<![CDATA[" xml:lang="en" id="merge" label="Merge Now!" />]]></example>
|
||||||
<label xml:lang="en">Merge Now!</label>
|
|
||||||
</available-action>]]></example>
|
|
||||||
|
|
||||||
<dl>
|
<dl>
|
||||||
<di><dt>@id</dt><dd>A string identifying the action. When selected, this id is sent in an <tt><action-selected></tt> element as part of a message stanza without any <tt><body></tt> elements.</dd></di>
|
<di><dt>id</dt><dd>A string identifying the action. When selected, this id is sent in an <action-selected> element as part of a message stanza without any <body> elements.</dd></di>
|
||||||
<di><dt><label></dt><dd>Internationalized textual label for this action. One with the same <tt>@xml:lang</tt> of each <tt><body></tt> included in this <tt><message></tt>.</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 <body> element included in this <message>.</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 <body> included in the message stanza next to the <action> 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 <body>.</dd>
|
||||||
|
</di>
|
||||||
</dl>
|
</dl>
|
||||||
</section2>
|
</section2>
|
||||||
|
|
||||||
<section2 anchor="action-selected-element" topic="Action Selection">
|
<section2 anchor="action-selected-element" topic="Action Selection">
|
||||||
<p>A selected action is represented by an <tt><action-selected></tt> element in the <tt>&ns;</tt> namespace.</p>
|
<p>A selected action is represented by an <action-selected> element in the <tt>&ns;</tt> namespace.</p>
|
||||||
|
|
||||||
<example><![CDATA[<action-selected xmlns="]]>&ns;<![CDATA[" id="merge" />]]></example>
|
<example><![CDATA[<action-selected xmlns="]]>&ns;<![CDATA[" id="merge" />]]></example>
|
||||||
|
|
||||||
<dl>
|
<dl>
|
||||||
<di><dt>@id</dt><dd>The id of the selected action, as defined in the selected <tt><available-action></tt>.</dd></di>
|
<di><dt>id</dt><dd>The id of the selected action, as defined in the selected <action>.</dd></di>
|
||||||
</dl>
|
</dl>
|
||||||
</section2>
|
</section2>
|
||||||
</section1>
|
</section1>
|
||||||
|
|
||||||
<section1 anchor="protocol" topic="Protocol">
|
<section1 anchor="protocol" topic="Protocol">
|
||||||
<section2 anchor="sending-allowed-responses" topic="Sending a Set of Allowed Responses">
|
<section2 anchor="sending-possible-responses" topic="Sending a Set of Possible Responses">
|
||||||
<p>A message with allowed responses is sent by including one or more <tt><allowed-response></tt> elements with distinct values.</p>
|
<p>A message with possible responses is sent by including one or more <response> elements with distinct values.</p>
|
||||||
|
|
||||||
<example><![CDATA[<message from="rootbot@example.com">
|
<example><![CDATA[<message from="rootbot@example.com">
|
||||||
<body xml:lang="en">Execute `rm -rf /`? (yes/no)</body>
|
<body xml:lang="en">Execute `rm -rf /`? (yes/no)</body>
|
||||||
<allowed-response xmlns="]]>&ns;<![CDATA[">
|
<response xmlns="]]>&ns;<![CDATA[" xml:lang="en" value="yes" label="Sure!" />
|
||||||
<translation xml:lang="en" value="yes" label="Sure!" />
|
<response xmlns="]]>&ns;<![CDATA[" xml:lang="en" value="no" label="Uuuuuuh..." />
|
||||||
</allowed-response>
|
|
||||||
<allowed-response xmlns="]]>&ns;<![CDATA[">
|
|
||||||
<translation xml:lang="en" value="no" label="Uuuuuuh..." />
|
|
||||||
</allowed-response>
|
|
||||||
</message>]]></example>
|
</message>]]></example>
|
||||||
|
|
||||||
<p>A single message MUST NOT contain multiple <tt><translation></tt> elements with the same values for both <tt>@xml:lang</tt> and <tt>@value</tt>. The same applies for the combination of <tt>@xml:lang</tt> and <tt>@label</tt>.</p>
|
<p>A single message MUST NOT contain multiple <response> elements with the same values for the <tt>value</tt> or the <tt>label</tt> attributes.</p>
|
||||||
<p>Clients that receive a message containing allowed responses can offer UI to quickly and conveniently select one of the allowed responses.</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>
|
||||||
</section2>
|
</section2>
|
||||||
|
|
||||||
<section2 anchor="selecting-a-response" topic="Selecting a Response">
|
<section2 anchor="selecting-a-response" topic="Selecting a Response">
|
||||||
<p>When the user selects a response, their client sends a plaintext message body containing the <tt>@value</tt> as <tt><body></tt> text. The client uses the <tt>@value</tt> that corresponds to the <tt><translation></tt> of the same language as the <tt><body></tt>.</p>
|
<p>When the user selects a response, their client sends a plaintext message body containing the <tt>value</tt> as <body> text, also copying the <tt>xml:lang</tt> of the <response> to the <body>.</p>
|
||||||
|
|
||||||
<example><![CDATA[<message to="rootbot@example.com">
|
<example><![CDATA[<message to="rootbot@example.com">
|
||||||
<body xml:lang="en">no</body>
|
<body xml:lang="en">no</body>
|
||||||
</message>]]></example>
|
</message>]]></example>
|
||||||
|
|
||||||
<p>The sender of the original message, in this example <tt>rootbot@example.com</tt>, checks incoming messages for a <tt><body></tt> that only contains the <tt>@value</tt> of the corresponding <tt><translation></tt> to see if a response was selected. In this example, the <tt><body></tt> matches the <tt>@value</tt> of the english translation for the response "No".</p>
|
<p>The sender of the original message, in this example <tt>rootbot@example.com</tt>, checks incoming messages for a <body> that only contains the <tt>value</tt> of a <response> and matches in <tt>xml:lang</tt> to see if a response was selected. In this example, the <body> matches the <tt>value</tt> of the English translation for the response "No".</p>
|
||||||
</section2>
|
</section2>
|
||||||
|
|
||||||
<section2 anchor="sending-available-actions" topic="Sending a Set of Available Actions">
|
<section2 anchor="sending-available-actions" topic="Sending a Set of Available Actions">
|
||||||
<p>A message with available actions is sent by including one or more <available-action> elements with distinct <tt>@id</tt>s.</p>
|
<p>A message with available actions is sent by including one or more <action> elements with distinct <tt>id</tt>s.</p>
|
||||||
|
|
||||||
<example><![CDATA[<message to="gitbot@example.com">
|
<example><![CDATA[<message to="gitbot@example.com">
|
||||||
<body xml:lang="en">New merge request opened by ExampleUser: https://git.example.com/example/mrs/3/</body>
|
<body>New merge request opened by ExampleUser: https://git.example.com/example/mrs/3/</body>
|
||||||
<available-action xmlns="]]>&ns;<![CDATA[" id="merge">
|
<action xmlns="]]>&ns;<![CDATA[" id="merge-32643" label="Merge Now" />
|
||||||
<label xml:lang="en">Merge Now</label>
|
|
||||||
</available-action>
|
|
||||||
</message>]]></example>
|
</message>]]></example>
|
||||||
|
|
||||||
<p>A single message MUST NOT contain multiple <tt><available-action></tt> elements with the same values for the <tt>@id</tt> attribute. Labels MUST be unique per id and language.</p>
|
<p>A single message MUST NOT contain multiple <action> elements with the same values for the <tt>id</tt> or <tt>label</tt> attributes.</p>
|
||||||
<p>Clients that receive a message containing available actions SHOULD offer UI to select one of the actions.</p>
|
<p>Clients that receive a message containing available actions SHOULD offer UI to select one of the actions.</p>
|
||||||
</section2>
|
</section2>
|
||||||
|
|
||||||
<section2 anchor="selecting-an-action" topic="Selecting an Action">
|
<section2 anchor="selecting-an-action" topic="Selecting an Action">
|
||||||
<p>When the user selects an action, their client sends a message containing an <tt><action-selected></tt> element which identifies the selected action. The message does not contain a <tt><body></tt>.</p>
|
<p>When the user selects an action, their client sends a message containing an <action-selected> element which identifies the selected action. The message does not contain a <body>.</p>
|
||||||
|
|
||||||
<example><![CDATA[<message to="gitbot@example.com">
|
<example><![CDATA[<message to="gitbot@example.com">
|
||||||
<action-selected xmlns="]]>&ns;<![CDATA[" id="merge" />
|
<action-selected xmlns="]]>&ns;<![CDATA[" id="merge-32643" />
|
||||||
</message>]]></example>
|
</message>]]></example>
|
||||||
</section2>
|
</section2>
|
||||||
</section1>
|
</section1>
|
||||||
|
|
||||||
<section1 anchor="rules" topic="Business Rules">
|
<section1 anchor="rules" topic="Business Rules">
|
||||||
<p>All message bodies SHOULD always list the (internationalized) allowed responses too, so that users of clients that don't support &xepname; can still know what the allowed responses are.</p>
|
<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>
|
||||||
<p>Bots or other entities that indicate allowed responses are free to accept variations of the response values for convenience, for example ignoring the casing or accepting abbreviations of response values.</p>
|
|
||||||
<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>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>
|
<p>Clients MUST only provide quick responses for the most recently received message that contains text content.</p>
|
||||||
<p>Clients MUST only provide action selection for the most recently received message that contains actions. This is slightly different than the rule for quick responses, in that the message defining the action does not have to be the most recent message with text content, but only the most recent message that contains actions.</p>
|
<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 <action> accordingly, if they need to differentiate between messages.</p>
|
||||||
<p>Clients MAY decide to not offer action selection if the message containing the action is not the most recent message with text content.</p>
|
|
||||||
<p>It is up to the client and its specific UI requirements to decide what to do if both quick responses and actions are available, potentionally coming from different messages.</p>
|
|
||||||
</section1>
|
</section1>
|
||||||
|
|
||||||
<section1 anchor="access" topic="Accessibility Considerations">
|
<section1 anchor="access" topic="Accessibility Considerations">
|
||||||
@ -182,7 +179,7 @@
|
|||||||
</section1>
|
</section1>
|
||||||
|
|
||||||
<section1 anchor="i18n" topic="Internationalization Considerations">
|
<section1 anchor="i18n" topic="Internationalization Considerations">
|
||||||
<p>All elements introduced in this specification require internationalizing plaintext content to be consistent with the language of all message <tt><body></tt> elements.</p>
|
<p>While it is generally possible to include multiple <body> 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 <body> element.</p>
|
||||||
</section1>
|
</section1>
|
||||||
|
|
||||||
<section1 anchor="security" topic="Security Considerations">
|
<section1 anchor="security" topic="Security Considerations">
|
||||||
|
Loading…
Reference in New Issue
Block a user