User Tools

Site Tools


matrix_tools

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
matrix_tools [2020/05/30 09:00]
admin
matrix_tools [2020/06/01 11:41]
admin
Line 1: Line 1:
 ====== Matrix ​ ====== ====== Matrix ​ ======
 +===== Documentation =====
 +  * https://​matrix.org/​docs/​api/​client-server/#/​
 +  * https://​matrix.org/​docs/​spec/​
 ===== Getting your access token ===== ===== Getting your access token =====
   * Using Riot (that'​s whats running on https://​matrix.glasgow.social) - Click on your profile name at the top left corner and select ''​Settings''​   * Using Riot (that'​s whats running on https://​matrix.glasgow.social) - Click on your profile name at the top left corner and select ''​Settings''​
Line 96: Line 99:
  
 ?> ?>
 +</​code>​
 +
 +You can follow one particular room just using GET requests, by doing something like this:
 +
 +<code php>
 +function get_new_events($room) {
 +   ​$homeserver = "​glasgow.social";​
 +   ​$access_token = "​access_token_goes_here"​
 +   $url = "​https://​$homeserver/​_matrix/​client/​r0/​rooms/​$room/​messages?​access_token=$access_token&​from=$tracking_id";​
 +   $data = json_decode(file_get_contents($url),​ true);
 +   ​return $data;
 +}
 </​code>​ </​code>​
  
 ===== Matrix Bot ===== ===== Matrix Bot =====
-  * See [[Matrix Bot]]+The basis of my bot's interaction with Matrix is bascially the above code.  Replace the echo line with with whatever you want to do (in my case, I look up a list of rules [i.e. pairs of regexes and their response functionsI use in IRC from a database and act accordingly). ​
matrix_tools.txt ยท Last modified: 2023/12/27 13:45 by admin