Having actionable buttons in chats is apparently a fashionable thing -now. This specification defines a simple protocol for buttons and -responses.
- -OPTIONAL.
- -A chat bot wants to provide fixed choice answers or commands.
- -A button is represented by a <button> element in the -urn:xmpp:tmp:buttons.
- -A message with buttons is sent by including one or more <button> -elements with distinct value attributes. At least one <label> element -MUST be included containing a textual description for the button.
- -A single message MUST NOT have multiple buttons with the same @value.
- -When the user clicks a button, their client sends a plain text message -body containing the @value as <body> text.
- -OPTIONAL. TODO.
- -OPTIONAL. TODO.
- -Accessibility for whom?
- -Multiple instances of the <label/> element MAY be included for the -purpose of providing alternate versions of the same text in different -languages, i.e. with distinct xml:lang attributes.
- -Do not press the big red button marked "Danger: Do Not Push".
- -None.
- -Register the namespace etc.
- -REQUIRED for protocol specifications.
- -
-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.
+A chat bot wants to provide a list of allowed responses to a message it sends.
+A chat bot wants to provide quick access to certain actions for convenience.
+Each allowed response is represented by an <allowed-response> element in the &ns; namespace.
+ +Each available action is represented by an <available-action> element in the &ns; namespace.
+ +A selected action is represented by an <action-selected> element in the &ns; namespace.
+ +A message with allowed responses is sent by including one or more <allowed-response> elements with distinct values.
+ +A single message MUST NOT contain multiple <translation> elements with the same values for both @xml:lang and @value. The same applies for the combination of @xml:lang and @label.
+Clients that receive a message containing allowed responses can offer UI to quickly and conveniently select one of the allowed responses.
+When the user selects a response, their client sends a plaintext message body containing the @value as <body> text. The client uses the @value that corresponds to the <translation> of the same language as the <body>.
+ +The sender of the original message, in this example rootbot@example.com, checks incoming messages for a <body> that only contains the @value of the corresponding <translation> to see if a response was selected. In this example, the <body> matches the @value of the english translation for the response "No".
+A message with available actions is sent by including one or more <available-action> elements with distinct @ids.
+ +A single message MUST NOT contain multiple <available-action> elements with the same values for the @id attribute. Labels MUST be unique per id and language.
+Clients that receive a message containing available actions SHOULD offer UI to select one of the actions.
+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>.
+ +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.
+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.
+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.
+Clients MUST only provide quick responses for the most recently received message that contains text content.
+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.
+Clients MAY decide to not offer action selection if the message containing the action is not the most recent message with text content.
+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.
+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.
+All elements introduced in this specification require internationalizing plaintext content to be consistent with the language of all message <body> elements.
+This specification only adds quicker/more convenient access to features that are accessible anyway.
+This document requires no interaction with the Internet Assigned Numbers Authority (IANA).
+This specification defines the following XMPP namespaces:
+TODO
+