<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>
<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 <linkurl="#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><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. 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 <linkurl="#i18n">Internationalization Considerations</link> for details. This includes not setting an <tt>xml:lang</tt> at all if not present on the <body>.</dd>
<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 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>
<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>
<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>
<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>
<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>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 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>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>
<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>