Integration managers should use the Widget API
Opened this issue · 0 comments
Your use case
Integration managers currently use the "Scalar Messaging API", a rather old and not particularly well-documented API which enables the integration manager iframe
to communicate with the client via postmessage to request specific actions like inviting a user or setting a widget.
In many ways, integration managers are very much like widgets -- external pages in an iframe
which communicate with the client via postmessage API. It follows then, that it would be a benefit in terms of flexibility and ease of client implementation for integration managers to use the Widget API instead.
Indeed there is already significant overlap in functionality of the two APIs. To the extent that, as far as I can tell the Widget API is already a superset:
Scalar API action | Purpose | Widget API replacement |
---|---|---|
close_scalar |
Closes the integration manager modal | close_modal |
get_widgets |
Gets the widgets in the room | read_events |
set_widget |
Sets a widget in the room | send_event |
join_rules_state |
Gets m.room.join_rules for the room |
read_events |
get_room_enc_state |
Gets m.room.encryption for the room |
read_events |
membership_state |
Gets m.room.member for a user in the room |
read_events |
set_bot_power |
Sets m.room.power_levels for a user in the room |
send_event |
invite |
Invites a user to the room | send_event |
kick |
Kicks a user from the room | send_event |
get_open_id_token |
Gets an OpenID token for the current user | get_openid |
- Many of these actions depend on an extended Widget API to send and receive events (matrix-org/matrix-spec-proposals#2762)
- This has been cut down to Scalar API actions which to my knowledge are actually in use. There are a number of other actions which refer to unspecced or unsupported functionality.
What would you like to do?
Enable integration managers to use the Widget API across all clients.
Why would you like to do it?
Improve flexibility and ease of implementation for both clients and integration managers.
How would you like to achieve it?
Listen for Widget API requests from the integration manager iframe
.
There may be other considerations for how the user grants permissions to the integration manager, and how to approach deprecation of the Scalar API.
Have you considered any alternatives?
Another option could be for the integration managers to become a full embedded Matrix client rather than having to communicate with the parent client, but this seems much more complex.
Additional context
No response
Are you willing to provide a PR?
No