{"id":13559172,"url":"https://github.com/matrix-org/matrix-appservice-node","last_synced_at":"2025-04-04T06:10:06.910Z","repository":{"id":27949387,"uuid":"31442076","full_name":"matrix-org/matrix-appservice-node","owner":"matrix-org","description":"Matrix Application Service framework in Node.js","archived":false,"fork":false,"pushed_at":"2023-09-27T22:22:31.000Z","size":1027,"stargazers_count":85,"open_issues_count":5,"forks_count":26,"subscribers_count":32,"default_branch":"develop","last_synced_at":"2025-03-28T05:13:53.627Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/matrix-org.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2015-02-27T22:32:03.000Z","updated_at":"2025-02-07T14:15:51.000Z","dependencies_parsed_at":"2024-04-22T00:50:31.708Z","dependency_job_id":"74eca6c5-93b0-4207-837a-ded27cf3de4a","html_url":"https://github.com/matrix-org/matrix-appservice-node","commit_stats":{"total_commits":190,"total_committers":16,"mean_commits":11.875,"dds":0.631578947368421,"last_synced_commit":"2691e38463879f73cf06037810edc80a6b2fb6bd"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matrix-org%2Fmatrix-appservice-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matrix-org%2Fmatrix-appservice-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matrix-org%2Fmatrix-appservice-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matrix-org%2Fmatrix-appservice-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/matrix-org","download_url":"https://codeload.github.com/matrix-org/matrix-appservice-node/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247128753,"owners_count":20888235,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-08-01T12:05:24.038Z","updated_at":"2025-04-04T06:10:06.894Z","avatar_url":"https://github.com/matrix-org.png","language":"TypeScript","funding_links":[],"categories":["TypeScript","others","Bot SDKs"],"sub_categories":["Javascript/Typescript"],"readme":"matrix-appservice-node\n======================\n\nThis is a Matrix Application Service framework written in Node.js.\n\nThis can be used to quickly setup performant application services for almost\nanything you can think of in a web framework agnostic way.\n\nIf you are looking for a more fully-featured SDK for creating bridges,\nyou may want to check out [matrix-appservice-bridge](https://github.com/matrix-org/matrix-appservice-bridge) instead.\n\n### Example\n\nTo create an app service registration file:\n```javascript\nconst { AppServiceRegistration } = require(\"matrix-appservice\");\n\n// creating registration files\nconst reg = new AppServiceRegistration();\nreg.setAppServiceUrl(\"http://localhost:8010\");\nreg.setHomeserverToken(AppServiceRegistration.generateToken());\nreg.setAppServiceToken(AppServiceRegistration.generateToken());\nreg.setSenderLocalpart(\"example-appservice\");\nreg.addRegexPattern(\"users\", \"@.*\", true);\nreg.setProtocols([\"exampleservice\"]); // For 3PID lookups\nreg.setId(\"example-service\");\nreg.outputAsYaml(\"registration.yaml\");\n```\n\nYou only need to generate a registration once, provided the registration info does not\nchange. Once you have generated a registration, you can run the app service like so:\n\n```javascript\nimport { AppService, AppserviceHttpError } from \"matrix-appservice\";\n// listening\nconst as = new AppService({\n  homeserverToken: \"abcd653bac492087d3c87\"\n});\nas.on(\"type:m.room.message\", (event) =\u003e {\n  // handle the incoming message\n});\nas.onUserQuery = function(userId, callback) {\n  // handle the incoming user query then respond\n  console.log(\"RECV %s\", userId);\n\n  /*\n  // if this userId cannot be created, or if some error\n  // conditions occur, throw AppserviceHttpError exception.\n  // The underlying appservice code will send the HTTP status,\n  // Matrix errorcode and error message back as a response.\n\n  if (userCreationOrQueryFailed) {\n    throw new AppserviceHttpError(\n      {\n        errcode: \"M_FORBIDDEN\",\n        error: \"User query or creation failed.\",\n      },\n      403, // Forbidden, or an appropriate HTTP status\n    )\n  }\n  */\n\n  callback();\n};\n// can also do this as a promise\nas.onAliasQuery = async function(alias) {\n  console.log(\"RECV %s\", alias);\n};\nas.listen(8010);\n```\n\n### TLS Connections\n\nIf `MATRIX_AS_TLS_KEY` and `MATRIX_AS_TLS_CERT` environment variables are\ndefined and point to valid tls key and cert files, the AS will listen using\nan HTTPS listener.\n\n### API Reference\n\nA hosted API reference can be found on [GitHub Pages](https://matrix-org.github.io/matrix-appservice-node/index.html).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatrix-org%2Fmatrix-appservice-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatrix-org%2Fmatrix-appservice-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatrix-org%2Fmatrix-appservice-node/lists"}