From c09bf67b9185ea67175bdea5b2408bf6a4e03b2c Mon Sep 17 00:00:00 2001 From: Tim Henkes Date: Mon, 20 Apr 2020 19:25:44 +0200 Subject: [PATCH 1/3] new/reworked protoXEP Quick Response --- inbox/buttons.xml | 168 ------------------------------- inbox/quick-response.xml | 212 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 212 insertions(+), 168 deletions(-) delete mode 100644 inbox/buttons.xml create mode 100644 inbox/quick-response.xml diff --git a/inbox/buttons.xml b/inbox/buttons.xml deleted file mode 100644 index 84108283..00000000 --- a/inbox/buttons.xml +++ /dev/null @@ -1,168 +0,0 @@ - - -%ents; -]> - -
-Simple Buttons -This specification provides a way to send simple buttons. -&LEGALNOTICE; -xxxx -ProtoXEP -Standards Track -Standards - -XMPP Core - - - -NOT_YET_ASSIGNED - -Kim -Alvefur -zash@zash.se -zash@zash.se - - -0.0.2 -2018-09-30 -ka -Polishing preparing for submission - - -0.0.1 -2018-09-02 -ka -Initial version - -
- - -

Having actionable buttons in chats is apparently a fashionable thing -now. This specification defines a simple protocol for buttons and -responses.

- -
- -
    -
  • To provide a representation of a simple button or two in a chat.
  • -
- - - -
    -
  • Is "button" too UI-centric? - -
      -
    • Could base it on the <action> element from ad-hoc?
    • -
  • -
  • Styling? Maybe a few fixed styles like normal, warning, danger?
  • -
- -
- -

OPTIONAL.

- -
-
Button
-
An actionable object that can be invoked.
-
Click
-
The act of invoking the actionable object.
-
- -
- -

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.

- - - -]]> - -
-
value
-
Textual payload to be sent in a message <body> when the button is -clicked.
-
<label>
-
Text label for the button. Can be repeated per language.
-
- -
- - - -

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.

- - - Approve? (yes/no) - - -]]> - -

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.

- - - yes -]]> - -
- -

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.

- - -
-
- - diff --git a/inbox/quick-response.xml b/inbox/quick-response.xml new file mode 100644 index 00000000..19fa250e --- /dev/null +++ b/inbox/quick-response.xml @@ -0,0 +1,212 @@ + + + + +%ents; +]> + + +
+ &xepname; + Quickly respond to automated messages. + &LEGALNOTICE; + xxxx + ProtoXEP + Standards Track + Standards + + XMPP Core + + + + NOT_YET_ASSIGNED + + Kim + Alvefur + zash@zash.se + zash@zash.se + + + Tim + Henkes + me@syndace.dev + + + 0.1.0 + 2020-04-20 + th + +
    +
  • Renamed to better reflect the use-case
  • +
  • Split into two use-cases, one for textual responses and one for quick access to actions
  • +
  • Clarified i18n and general behavioral details
  • +
+
+
+ + 0.0.2 + 2018-09-30 + ka + Polishing preparing for submission + + + 0.0.1 + 2018-09-02 + ka + Initial version + +
+ + +

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.

+
+ + +
    +
  • Offer a simple way to list allowed responses to a message.
  • +
  • Offer a solution that doesn't rely on the receiving device to support &xepname;.
  • +
  • Allow internationalized 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.

+ +&ns; + + +]]> + +
+ +
<translation>
+
One for each <body> and @xml:lang included in the <message> this response is a part of. The @value is the internationalized textual payload to put into the <body> of the message stanza that is sent when this response is selected. The @label 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.
+
+
+
+ + +

Each available action is represented by an <available-action> element in the &ns; namespace.

+ +&ns; + +]]> + +
+
@id
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.
+
<label>
Internationalized textual label for this action. One with the same @xml:lang of each <body> included in this <message>.
+
+
+ + +

A selected action is represented by an <action-selected> element in the &ns; namespace.

+ +&ns;]]> + +
+
@id
The id of the selected action, as defined in the selected <available-action>.
+
+
+
+ + + +

A message with allowed responses is sent by including one or more <allowed-response> elements with distinct values.

+ + + Execute `rm -rf /`? (yes/no) + + + + + + +]]> + +

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>.

+ + + no +]]> + +

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.

+ + + New merge request opened by ExampleUser: https://git.example.com/example/mrs/3/ + + + +]]> + +

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:

+
    +
  • &ns;
  • +
+
+ + + &NSVER; + +
+ + + TODO + +
From 489f22209c158f6cac4dc08b728778fe60359c40 Mon Sep 17 00:00:00 2001 From: Tim Henkes Date: Mon, 20 Apr 2020 23:51:09 +0200 Subject: [PATCH 2/3] quite a bit of feedback incorporated --- inbox/quick-response.xml | 91 +++++++++++++++++++--------------------- 1 file changed, 44 insertions(+), 47 deletions(-) diff --git a/inbox/quick-response.xml b/inbox/quick-response.xml index 19fa250e..8da9839f 100644 --- a/inbox/quick-response.xml +++ b/inbox/quick-response.xml @@ -59,122 +59,119 @@ -

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.

+

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.

    -
  • Offer a simple way to list allowed responses to a message.
  • +
  • Offer a simple way to list possible responses to a message.
  • Offer a solution that doesn't rely on the receiving device to support &xepname;.
  • -
  • Allow internationalized responses.
-

A chat bot wants to provide a list of allowed responses to a message it sends.

+

A chat bot wants to provide a list of possible 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 possible response is represented by a <response> element in the &ns; namespace.

-&ns; - - -]]> +&ns;]]>
-
<translation>
-
One for each <body> and @xml:lang included in the <message> this response is a part of. The @value is the internationalized textual payload to put into the <body> of the message stanza that is sent when this response is selected. The @label 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.
+
value
+
The value is the internationalized textual payload to put into the <body> of the message stanza that is sent when this response is selected.
+
+ +
label
+
The label 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?
+
+ +
xml:lang
+
The xml:lang set on this element MUST mirror the xml:lang of the <body> included in the message stanza next to the <response> element. Refer to the Internationalization Considerations for details. This includes not setting an xml:lang at all if not present on the <body>.
- -

Each available action is represented by an <available-action> element in the &ns; namespace.

+ +

Each available action is represented by an <action> element in the &ns; namespace.

-&ns; - -]]> +&ns;]]>
-
@id
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.
-
<label>
Internationalized textual label for this action. One with the same @xml:lang of each <body> included in this <message>.
+
id
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.
+
label
Internationalized textual label for this action. The xml:lang attribute and the language of the label should mirror those of the <body> element included in this <message>.
+ +
xml:lang
+
The xml:lang set on this element MUST mirror the xml:lang of the <body> included in the message stanza next to the <action> element. Refer to the Internationalization Considerations for details. This includes not setting an xml:lang at all if not present on the <body>.
+
-

A selected action is represented by an <action-selected> element in the &ns; namespace.

+

A selected action is represented by an <action-selected> element in the &ns; namespace.

&ns;]]>
-
@id
The id of the selected action, as defined in the selected <available-action>.
+
id
The id of the selected action, as defined in the selected <action>.
- -

A message with allowed responses is sent by including one or more <allowed-response> elements with distinct values.

+ +

A message with possible responses is sent by including one or more <response> elements with distinct values.

Execute `rm -rf /`? (yes/no) - - - - - - + + ]]> -

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.

+

A single message MUST NOT contain multiple <response> elements with the same values for the value or the label attributes.

+

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.

-

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>.

+

When the user selects a response, their client sends a plaintext message body containing the value as <body> text, also copying the xml:lang of the <response> to the <body>.

no ]]> -

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".

+

The sender of the original message, in this example rootbot@example.com, checks incoming messages for a <body> that only contains the value of a <response> and matches in xml:lang 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 message with available actions is sent by including one or more <action> elements with distinct ids.

- New merge request opened by ExampleUser: https://git.example.com/example/mrs/3/ - - - + New merge request opened by ExampleUser: https://git.example.com/example/mrs/3/ + ]]> -

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.

+

A single message MUST NOT contain multiple <action> elements with the same values for the id or label attributes.

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>.

+

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.

+

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.

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.

+

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 ids for each <action> accordingly, if they need to differentiate between messages.

@@ -182,7 +179,7 @@ -

All elements introduced in this specification require internationalizing plaintext content to be consistent with the language of all message <body> elements.

+

While it is generally possible to include multiple <body> elements with different xml:langs in a single message stanza, this is intentionally not supported by this specification. Message stanzas that also contain elements in the &ns; namespace MUST NOT contain more than one <body> element.

From 44165c1869ccbd06e73509b06649f89e3b36d531 Mon Sep 17 00:00:00 2001 From: Tim Henkes Date: Tue, 21 Apr 2020 00:07:45 +0200 Subject: [PATCH 3/3] un-rm inbox/buttons.xml --- inbox/buttons.xml | 168 +++++++++++++++++++++++++++++++++++++++ inbox/quick-response.xml | 1 + 2 files changed, 169 insertions(+) create mode 100644 inbox/buttons.xml diff --git a/inbox/buttons.xml b/inbox/buttons.xml new file mode 100644 index 00000000..84108283 --- /dev/null +++ b/inbox/buttons.xml @@ -0,0 +1,168 @@ + + +%ents; +]> + +
+Simple Buttons +This specification provides a way to send simple buttons. +&LEGALNOTICE; +xxxx +ProtoXEP +Standards Track +Standards + +XMPP Core + + + +NOT_YET_ASSIGNED + +Kim +Alvefur +zash@zash.se +zash@zash.se + + +0.0.2 +2018-09-30 +ka +Polishing preparing for submission + + +0.0.1 +2018-09-02 +ka +Initial version + +
+ + +

Having actionable buttons in chats is apparently a fashionable thing +now. This specification defines a simple protocol for buttons and +responses.

+ +
+ +
    +
  • To provide a representation of a simple button or two in a chat.
  • +
+ + + +
    +
  • Is "button" too UI-centric? + +
      +
    • Could base it on the <action> element from ad-hoc?
    • +
  • +
  • Styling? Maybe a few fixed styles like normal, warning, danger?
  • +
+ +
+ +

OPTIONAL.

+ +
+
Button
+
An actionable object that can be invoked.
+
Click
+
The act of invoking the actionable object.
+
+ +
+ +

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.

+ + + +]]> + +
+
value
+
Textual payload to be sent in a message <body> when the button is +clicked.
+
<label>
+
Text label for the button. Can be repeated per language.
+
+ +
+ + + +

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.

+ + + Approve? (yes/no) + + +]]> + +

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.

+ + + yes +]]> + +
+ +

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.

+ + +
+
+ + diff --git a/inbox/quick-response.xml b/inbox/quick-response.xml index 8da9839f..75319bca 100644 --- a/inbox/quick-response.xml +++ b/inbox/quick-response.xml @@ -5,6 +5,7 @@ %ents; ]> +