Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSC4139: Bot buttons & conversations #4139

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

turt2live
Copy link
Member

Rendered

In line with matrix-org/matrix-spec#1700, the following disclosure applies:

I am Director of Standards Development at The Matrix.org Foundation C.I.C., Matrix Spec Core Team (SCT) member, employed by Element, and operate the t2bot.io service. This proposal is written and published as operator/developer at t2bot.io.


Fixes matrix-org/matrix-spec#232
See also matrix-org/matrix-spec#1651

@turt2live turt2live changed the title MSC: Bot buttons & conversations MSC4139: Bot buttons & conversations May 6, 2024
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementation requirements:

  • Client rendering prompts
  • Bot sending prompts

Note that there is a prerequisite on Extensible Events which needs to be unpicked.

@turt2live turt2live added proposal A matrix spec change proposal client-server Client-Server API kind:feature MSC for not-core and not-maintenance stuff needs-implementation This MSC does not have a qualifying implementation for the SCT to review. The MSC cannot enter FCP. labels May 6, 2024
// `type` is the prompt type: "preset" (show a button) or "input" (shown below)
"type": "preset",
// `id` is used by the bot to figure out what prompt the user picked. It is an opaque ID.
"id": "1d6",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to indicate that interactions are stateful?

I'd been thinking about a similar-ish system, but making the client just send a m.interaction event with a bot-defined content (possibly as a sub-key?)

eg. a bot would define something like

// other content stuffs ...
"interactions": [
  {
    "type": "command",
    "metadata": {
      "action": "roll",
      "dice_type": "1d6"
    }
]

When a user clicks this command button, the client sends an event:

{
  "type": "m.interaction",
  "content": {
     "metadata": {
        "action": "roll",
        "dice_type": "1d6"
     }, 
     // reply stuff
  }
}

I think, personally, I'd love to see a system that sticks more to existing interaction systems in order to avoid extra maintenance burden, and to make it easier to onboard clients.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bots can GET the previous event if they don't keep state themselves.

Comment on lines +55 to +62
// These are the users who should see the `prompts`. Other users may see something like "you
// do not have permission to reply to this message" instead of prompts. `scope` is optional:
// when not supplied, all users who can see the message can respond. When an empty array, no
// one can respond. Clients SHOULD NOT show prompts to users who are descoped.
"scope": [
"@alice:example.org",
"@bob:example.org",
],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed but it would be really nice to generalise this with a whisper MSC.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intent here is to very much ensure interactions are visible to the room. Bots looking to whisper the user can utilize DMs for now.

Comment on lines +128 to +129
The user is then able to click on one of the buttons or submit text through the `input` option. That
reply looks as follows:
Copy link
Contributor

@Gnuxie Gnuxie May 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about if there was just a generic button type that if you clicked, would send an event?

Even better, why can't other things be clicked as a conversation reply (or an argument to a slash command), such as another user, or another event in the room timeline, or another button from another event in the timeline.

Being able to select another button in the timeline as a conversation reply or command argument would unlock a huge door, bots would be able to represent output as different button types. For example, Draupnir would be able to render each individual policy in the response to the equivalent of !rules matching @spam:example.com as a button, that could be selected as an argument in future commands or interactions.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of this sounds wonderful and very much needed indeed, though the scope for the MSC needs to end somewhere. Expansion is possible through other MSCs currently, and as this one progresses maybe it brings concepts into it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, it's my opinion that this would reduce the scope of this MSC and future ones by being able to express them using the "button type primitive" (alternatively presentation type). But I do understand how that can be seen differently.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I'm following the suggestion in that case, sorry. I understood your comment to mean supporting different types of input, not reusing buttons for everything (which I'm not sure how that'd even work).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client-server Client-Server API kind:feature MSC for not-core and not-maintenance stuff needs-implementation This MSC does not have a qualifying implementation for the SCT to review. The MSC cannot enter FCP. proposal A matrix spec change proposal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Selectable replies to messages sent by bots [canned responses]
3 participants