This is a Matrix Application Service framework written in Node.js.
This can be used to quickly setup performant application services for almost
anything you can think of in a web framework agnostic way.
var AppService = require("matrix-appservice").AppService;
var AppServiceRegistration = require("matrix-appservice").AppServiceRegistration;
var reg = new AppServiceRegistration("http://localhost:8010");
reg.setHomeserverToken(AppServiceRegistration.generateToken());
reg.setAppServiceToken(AppServiceRegistration.generateToken());
reg.setSenderLocalpart("example-appservice");
reg.addRegexPattern("users", "@.*", true);
reg.outputAsYaml("registration.yaml");
var as = new AppService({
homeserverToken: "abcd653bac492087d3c87"
});
as.on("type:m.room.message", function(event) {
});
as.onUserQuery = function(userId, callback) {
console.log("RECV %s", userId);
callback();
};
as.onAliasQuery = function(alias) {
var defer = q.defer();
defer.resolve();
return defer.promise;
};
as.listen(8010);
API Reference
A hosted API reference can be found on GitHub Pages.