{"id":37019964,"url":"https://github.com/bot4s/zmatrix","last_synced_at":"2026-01-14T02:14:21.139Z","repository":{"id":38381551,"uuid":"358328660","full_name":"bot4s/zmatrix","owner":"bot4s","description":"A Matrix.org client written using ZIO","archived":false,"fork":false,"pushed_at":"2025-09-26T13:42:04.000Z","size":219,"stargazers_count":8,"open_issues_count":7,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-09-26T15:29:21.591Z","etag":null,"topics":["matrix-org","scala"],"latest_commit_sha":null,"homepage":null,"language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bot4s.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-04-15T16:44:21.000Z","updated_at":"2025-09-26T13:40:39.000Z","dependencies_parsed_at":"2023-02-17T16:30:23.925Z","dependency_job_id":"a860d909-7929-47a6-8bbc-e77be4b48f44","html_url":"https://github.com/bot4s/zmatrix","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/bot4s/zmatrix","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bot4s%2Fzmatrix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bot4s%2Fzmatrix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bot4s%2Fzmatrix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bot4s%2Fzmatrix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bot4s","download_url":"https://codeload.github.com/bot4s/zmatrix/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bot4s%2Fzmatrix/sbom","scorecard":{"id":248741,"data":{"date":"2025-08-11","repo":{"name":"github.com/bot4s/zmatrix","commit":"bd38dc06c24c8a24f6b1fa7047ac3fbf7057a106"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.6,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":1,"reason":"2 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yaml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/bot4s/zmatrix/build.yaml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build.yaml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/bot4s/zmatrix/build.yaml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build.yaml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/bot4s/zmatrix/build.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish_snapshot.yaml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/bot4s/zmatrix/publish_snapshot.yaml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/publish_snapshot.yaml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/bot4s/zmatrix/publish_snapshot.yaml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/publish_snapshot.yaml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/bot4s/zmatrix/publish_snapshot.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yaml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/bot4s/zmatrix/release.yaml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yaml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/bot4s/zmatrix/release.yaml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yaml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/bot4s/zmatrix/release.yaml/main?enable=pin","Info:   0 out of   3 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   6 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/build.yaml:1","Warn: no topLevel permission defined: .github/workflows/publish_snapshot.yaml:1","Warn: no topLevel permission defined: .github/workflows/release.yaml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 29 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-17T08:05:17.764Z","repository_id":38381551,"created_at":"2025-08-17T08:05:17.764Z","updated_at":"2025-08-17T08:05:17.764Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28408711,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["matrix-org","scala"],"created_at":"2026-01-14T02:14:20.366Z","updated_at":"2026-01-14T02:14:21.130Z","avatar_url":"https://github.com/bot4s.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# zmatrix - ZIO Matrix\n\nA [matrix](https://matrix.org/) client implemented using ZIO.\n\n| CI              | Release                                                               | Snapshot                                                                 |\n| --------------- | --------------------------------------------------------------------- | ------------------------------------------------------------------------ |\n| ![CI][badge-ci] | [![Release Artifacts][badge-sonatypereleases]][link-sonatypereleases] | [![Snapshot Artifacts][badge-sonatypesnapshots]][link-sonatypesnapshots] |\n\n## Installation\n\nAdd the following dependency to your project's build file\n\n```scala\n// sbt\n\"com.bot4s\" %% \"zmatrix\" % \"0.4.0\"\n// mill\nivy\"com.bot4s::zmatrix:0.4.0\"\n```\n\nIt is also possible to get the latest snapshot from [Snapshot Artifacts][link-sonatypesnapshots] by adding the following\nlines to your `build.sc`:\n\n```scala\ndef repositories = super.repositories ++ Seq(\n  MavenRepository(\"https://oss.sonatype.org/content/repositories/snapshots\")\n)\n```\n\nAnd then `ivy\"com.bot4s::zmatrix:$SNAPSHOT-VERSION\"`\n\n## Description\n\nzmatrix is a library designed to communicate with a Matrix API.\n\nMatrix' API is huge and cover a lot of different topics, only a few endpoints are currently implemented.\nThe list of endpoints is defined here: https://matrix.org/docs/api/client-server/.\n\nIf there is one missing, or you find a bug in how it is implemented please submit an issue or PR.\n\nMost implementation will be similar to existing endpoint, but automatic derivation or codegen from the OpenAPI schema is not an option right now (the first result were awful and unreadable).\n\n## Usage\n\nThe main usage for this library is to write bot and automate task using a Matrix server. The current design is using a pull based approach to retrieve\nall the events addressed to the client.\n\nIt is then possible to attach some hooks to respond to changes from events.\n\nIn order to receive messages from a room, the bot must accept the invitation. This can be done using the following code:\n\n```scala\nimport com.bot4s.zmatrix.api.{ roomMembership, sync }\n// sync is to retrieve the state, roomMembership will contains all the endpoints related to room and user management (such as invites)\n\n\nlazy val acceptAllInvite: ZIO[AuthMatrixEnv, MatrixError, SyncState] =\n  sync.sync.tapInviteEvent {\n    case (roomId, invite: InviteMemberEvent) if invite.content.membership == \"invite\" =\u003e\n      log.info(f\"Joining $roomId\") *\u003e roomMembership.join(roomId)\n}\n```\n\nThis snippet of code attaches a callback on the retrieve state (`sync.sync`) and will accept any invitation.\n\nNow that we are allowed to send messages to a room, let's write an echo bot to demonstrate the usage of the room events hook:\n\n```scala\nimport com.bot4s.zmatrix.api.{ roomMembership, rooms, sync }\n// the rooms import is required to send a message\n\nval mirrorEcho : ZIO[AuthMatrixEnv, MatrixError, SyncState] = acceptAllInvite.tapRoomEvent { case (roomId, x: RoomMessageText) =\u003e\n  log.info(f\"${roomId} got: ${x.content.body}\") *\u003e ZIO.when(!x.sender.contains(\"ziobot\"))(\n    rooms.sendMsg(roomId, EventType.roomMessages, x.content.body.reverse)\n  )\n}\n```\n\nThis will attach a hook to the state that enable us to inspect the messages received. Note that we need to filter the message that we are sending\nbecause the state sync will forward them back to use, creating an infinite loop of messages.\n\nWe can now attach a scheduler to this effect to pull our state at fixed intervals\n\n```scala\nval mainLoop = mirrorEcho\n  .updateState()\n  .repeat(Schedule.spaced(10.seconds))\n```\n\nThe `updateState` method is a key piece here. Matrix API rely heavily on pagination to keep track of the state, it will by default return the whole state\nfor a client. By calling `updateState` we make sure to save our current pagination and only ask for newer events to the API.\n\n```scala\nmainLoop\n    .withAutoRefresh.retry(Schedule.forever)\n    .exitCode\n    .provide(\n        SyncTokenConfiguration.persistent(),\n        MatrixConfiguration.live(),\n        Authentication.live,\n        HttpClientZioBackend.layer(): TaskLayer[SttpBackend[Task, Any]],\n        MatrixClient.live,\n        Matrix.make\n    )\n```\n\n## Examples\n\nThe `examples` package comtains runnable examples for `zmatrix`. Examples can be selected by changing the `mainClass` definition in the `build.sc` or by running the following command:\n\n```\nmill -i examples[_].run\n```\n\n## Building\n\nA local version of the library can be published by running those two commands:\n\n```\nmill __.publishM2Local\nmill __.publishLocal\n```\n\n## References\n\nThe design of the lib was heavily inspired by the work done on [zio-slack](https://github.com/Dapperware/zio-slack/blob/master/README.md).\n\nThe actual endpoint implementation and reference for the Matrix API is taken from [matrix-nio](https://github.com/poljar/matrix-nio/) project, written in python.\n\n[link-sonatypereleases]: https://oss.sonatype.org/content/repositories/releases/com/bot4s/zmatrix_2.13/ \"Sonatype Releases\"\n[link-sonatypesnapshots]: https://oss.sonatype.org/content/repositories/snapshots/com/bot4s/zmatrix_2.13/ \"Sonatype Snapshots\"\n[badge-ci]: https://github.com/bot4s/zmatrix/workflows/Build/badge.svg\n[badge-sonatypereleases]: https://img.shields.io/nexus/r/https/oss.sonatype.org/com.bot4s/zmatrix_2.13.svg \"Sonatype Releases\"\n[badge-sonatypesnapshots]: https://img.shields.io/nexus/s/https/oss.sonatype.org/com.bot4s/zmatrix_2.13.svg \"Sonatype Snapshots\"\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbot4s%2Fzmatrix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbot4s%2Fzmatrix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbot4s%2Fzmatrix/lists"}