Install
Works with Drupal: ^11.1Using Composer to manage Drupal site dependencies
Alternative installation files
Download tar.gz
55.08 KB
MD5: 4a5b7ab40cc31a573004a553a19350e8
SHA-1: 903010a82cac3cc11fc84d26c3faa1138d7cb6e0
SHA-256: 6218f805a4027df0b6714343aaf333d2b9d06ac76810af7a9038aede75a93c41
Download zip
84.7 KB
MD5: d9b4b70f338b53badac865f1a2ad4dcd
SHA-1: acea48c929e5b2619519fa188ffcf6dcb685d560
SHA-256: eb9161cb6c95ede1889294acf1c3646417dcdb403cbe099bcea53f4fe79d0b1b
Release notes
The first beta of the 3.x line. From here the plugin APIs, the configuration
shape and the stored data are settled: beta1 is a supported upgrade target and
3.0.0 final will not change them without a deprecation cycle.
Compatibility
- Requires Drupal 11.1 or later. The module's hook implementations are `#[Hook]` attribute classes, which Drupal only discovers from 11.1. Earlier 3.0 alphas claimed `^10.2 || ^11 || ^12`; that was wrong in both directions and is corrected here.
- PHP 8.1 or later, per Drupal 11.1's own requirement.
- Drupal 12 is not declared. The code is prepared for it — the ECA action plugins implement the core `ExecutableInterface` signature and the settings are schema-complete — but `key`, a hard dependency, has no Drupal 12 release, so the module cannot be installed there yet. See #3606457: Automated Drupal 12 compatibility fixes for matrix_api 3.0.x-dev.
- Requires the Key module (`drupal/key ^1.0`).
Breaking changes from 2.x
- The access token is stored in a Key entity. `drupal/key` is a hard dependency. The plugin loads it from the entity named by the new `matrix_api.key_id` setting instead of a plain config string, and the settings form has moved to a `key_select` element with a generate-token fieldset.
- `matrix_api.token` and `matrix_api.password` are gone from the settings configuration.
- `matrix_api.matrixhttp` was removed. It was an internal Guzzle client factory exposed as a service. Nothing should have depended on it, but any custom code that did must resolve its own HTTP client.
- Code that read the old settings must be updated.
Replace
\Drupal::config('matrix_api.MatrixApiSettings')->get('matrix_api.token')
with
$keyId = \Drupal::config('matrix_api.MatrixApiSettings')->get('matrix_api.key_id');
$token = $keyId ? \Drupal::service('key.repository')->getKey($keyId)?->getKeyValue() : NULL;
Upgrading from 2.x
- `composer require drupal/matrix_api:^3.0-beta1`. This pulls in `drupal/key`.
- drush updb` (or `drush updatedb`). `matrix_api_update_3001()` installs the Key module if needed, moves an existing `matrix_api.token` into a Key entity named `matrix_api_access_token`, and clears the old keys. A site that stored only a password has nothing to migrate and will log a warning; re-enter credentials at `/admin/config/services/matrix-api`.
- Re-check any ECA model that used the removed `matrix_api.matrixhttp` service.
Upgrading from an earlier 3.0 alpha needs no data migration: this is a pre-release, and no alpha has been in production use.
New in 3.0
- Matrix client. `MatrixClientInterface` covers joining and leaving rooms, sending messages and thread replies, redacting events, reading and writing room state, and reading room history. The text version of a reply is stripped of formatting, and `formatted_body` is exposed for the HTML version.
- ECA event. `matrix_api:event_received` fires for every inbound Matrix event, with tokens for `event_id`, `room_id`, `sender`, `type`, `state_key`, `body`, `formatted_body`, `thread_root` and `in_reply_to`.
- ECA actions. Send a message, send a thread reply, set room state, redact an event, and trigger a non-blocking inbound poll. Send-message and send-thread-reply can store their result `event_id` and the resolved `room_id` into ECA tokens (`result_token`, `room_result_token`).
- Inbound synchronisation is a plugin type. `cron_poller` polls `/sync` on cron; `matrix_api:sync-daemon` runs a long-lived Drush daemon for sites that would rather not poll from a web request. Other transports can be added as plugins.
- Config action. `setupMatrixCredentials` provisions a Key entity from a recipe, so a site can be configured without an administrator.
- Rules action `SendMatrixMessage` is retained for Rules 1 sites.
Fixed in 3.0.0-beta1
- #3606747: Add a Canvas-based template(https://git.drupalcode.org/project/matrix_api/-/work_items/3606747) The `message` field is now optional in the send-thread-reply action when `html_message` is provided.
- #3606746: Instead of views pages, provide Canvas pages with placed views blocks(https://git.drupalcode.org/project/matrix_api/-/work_items/3606746) `formatted_body` is available as an ECA token and a Drupal token.
- #3606745: Move secrets to Key module(https://git.drupalcode.org/project/matrix_api/-/work_items/3606745) A thread reply with no `room_id` falls back to the configured default room.
- #3606745: Move secrets to Key module(https://git.drupalcode.org/project/matrix_api/-/work_items/3606745) `CronPoller` counts dispatched and skipped events with instance counters instead of returning a value from `process()`.
- #3606745: Move secrets to Key module(https://git.drupalcode.org/project/matrix_api/-/work_items/3606745) Logger context uses `@placeholder` syntax, so messages render on every Drupal version.
- #3606745: Move secrets to Key module(https://git.drupalcode.org/project/matrix_api/-/work_items/3606745) `room_result_token` is declared in the send-message config schema.
- #3606457: Automated Drupal 12 compatibility fixes for matrix_api 3.0.x-dev(https://git.drupalcode.org/project/matrix_api/-/work_items/3606745) The `matrix_api_trigger_poll` action's `timeout` setting is declared in the config schema. Installing the module on a site with the bundled ECA model no longer reports a schema error.
- #3606748: ebt_timeline 2.0.0(https://git.drupalcode.org/project/matrix_api/-/work_items/3606748) The module is clean under PHPCS, PHPStan, CSpell and the other checks Drupal CI runs, with a `phpstan.neon` pinning the analysis scope.
- #3606457: Automated Drupal 12 compatibility fixes for matrix_api 3.0.x-dev(https://git.drupalcode.org/project/matrix_api/-/work_items/3606457) Services are injected rather than fetched through `\Drupal::`, and the ECA actions declare the core `ExecutableInterface::execute()` signature, so they are compatible with Drupal 12's stricter contract.
- #3606457: Automated Drupal 12 compatibility fixes for matrix_api 3.0.x-dev(https://git.drupalcode.org/project/matrix_api/-/work_items/3606457) All five ECA action plugins are declared with `#[Action]` attributes instead of annotations, which is the form Drupal 13 requires. Plugin IDs, labels and the `matrix` type are unchanged, so existing ECA models keep working. A kernel test asserts every action is discoverable, so a future edit that makes one disappear fails the build rather than silently breaking the models that use it.
Known issues
- Drupal 12 support is implemented but not declared, pending a `key` release for Drupal 12.
- The Rules action needs the unmaintained Rules module, which has no Drupal 11 release. ECA is the supported path.