Feature request: External trigger
For some idea I am working on (API interaction) it is possible to issue a call and the response will eventually be POST'ed to a webserver. Have a system that not only responds to commands in channels, but also on an external trigger. This could be as simple as a file appearing in a directory or a full-blown HTTP server.
Low priority, now solved by just POST'ing to the matrix server
Thanks @Heidistein I think this is a valuable idea, something that really adds functionality.
Do you envision something along the lines of periodically executing a provided script?
Something like a repeat command that executes periodically?
Or how do you envision that? Ideas? Further details?
Hmmm, yes. This is a question with a million answers I am afraid. You could implement an entire HTTP server. My opinion on this, is that this will prove a lot of work, will have a lot of challenges. However, it is the most 'trendy' think to say you have you a rest-full API. Personally my opinion is that this is a too difficult approach.
My current idea is a thread which subscribes to an 'inotify' event on a directory (perhaps implement polling for NFS volumes). Every time a file appears in that specific directory, the corresponding script will be executed, with the full filename as argument (or first line on stdin, whichever is easier). This way the scriptbuilder has absolute control over the data he needs to pass along, in which format.
It is entirely possible this idea has holes in it, or can be done even simpler/handier.
Thanks @Heidistein for the additional details. Your input is food for thoughts.
As an alternative, available now, is to use matrix-commander from repo https://github.com/8go/matrix-commander.
One can build about anything witht his CLI tool. matrix-commander can be used to send messages to rooms. It cculd be called from from cron (crontab), from a script that polls NFS volumes, etc.
Yes (diverting from the topic now a bit, sorry), that is a good one. I have looked at it. However I ended up just sending a HTTP PUT to the matrix server itself:
curl -X PUT "https://${SERVER_HOST}/_matrix/client/r0/rooms/${ROOM_ID}/send/m.room.message/${RANDOM}" -H "Authorization: Bearer ${ACCESS_TOKEN}" -d "${CONTENT}"