====== Matrix ====== Matrix est un protocole de communication (texte, vocal et visioconférence) libre et fédéré. Matrix permet également de se connecter à d'autres protocoles de communication (Slack, Gitter, IRC, Twitter, SMS et d'autres). ===== Client(s) ===== ==== Riot.im ==== Client ([[https://riot.im/|Site Riot.im]]) === Installation sur Debian (Stretch ou Testing ) === On ajoute les dépôts de Riot : simon@laptop:~$ wget https://riot.im/packages/debian/repo-key.asc --2017-10-17 10:37:12-- https://riot.im/packages/debian/repo-key.asc Résolution de riot.im (riot.im)… 83.136.250.51, 2a04:3541:1000:500:6866:a4ff:fe4c:21ac Connexion à riot.im (riot.im)|83.136.250.51|:443… connecté. requête HTTP transmise, en attente de la réponse… 200 OK Taille : 8239 (8,0K) [text/plain] Sauvegarde en : « repo-key.asc » repo-key.asc 100%[===================>] 8,05K --.-KB/s in 0s 2017-10-17 10:37:13 (51,9 MB/s) — « repo-key.asc » sauvegardé [8239/8239] simon@laptop:~$ su Mot de passe : root@laptop:/home/simon# apt-key add repo-key.asc OK root@laptop:/home/simon# rm repo-key.asc root@laptop:/home/simon# vim /etc/apt/sources.list.d/matrix-riot.list root@laptop:/home/simon# cat /etc/apt/sources.list.d/matrix-riot.list # Riot (Matrix client) deb https://riot.im/packages/debian/ stretch main deb-src https://riot.im/packages/debian/ stretch main Mise à jour des dépôts et recherche : root@laptop:/home/simon# apt update root@laptop:/home/simon# apt search ^riot En train de trier... Fait Recherche en texte intégral... Fait riot-web/testing 0.13.1 amd64 A feature-rich client for Matrix.org Installation : root@laptop:/home/simon# apt install riot-web Lecture des listes de paquets... Fait Construction de l'arbre des dépendances Lecture des informations d'état... Fait The following additional packages will be installed: libappindicator1 libdbusmenu-gtk4 libindicator7 Les NOUVEAUX paquets suivants seront installés : libappindicator1 libdbusmenu-gtk4 libindicator7 riot-web 0 mis à jour, 4 nouvellement installés, 0 à enlever et 0 non mis à jour. Il est nécessaire de prendre 46,8 Mo dans les archives. Après cette opération, 181 Mo d'espace disque supplémentaires seront utilisés. Souhaitez-vous continuer ? [O/n] ===== Bots ===== ==== Webhook et Matrix ==== Je cherchais à envoyer des notifications sur mon compte Matrix via un webhook. J'ai trouvé une [[https://github.com/42wim/matterbridge/issues/553#issuecomment-435947716|issue Github]] qui en parle et qui propose d'utiliser [[https://t2bot.io/webhooks/|t2bot.io]]. On invite le bot "@_webhook:t2bot.io" : {{ :20190506-matrix-webhook-bot.png?400 |}} {{ :capture_du_2019-06-05_12-26-31-webhook-matrix.png?400 |}} Quand on envoie "!webhook" au bot, il répond : Here's your webhook url for !igamGYevYexvuPZNhX:duniter.be: https://webhooks.t2bot.io/api/v1/matrix/hook/hjyErSrz7NxvRM71U5PGfojarGNLZcNQmO5Tj2NM9yszoRd9trk7TQObfhUgMARD To send a message, POST the following JSON to that URL: { "text": "Hello world!", "format": "plain", "displayName": "My Cool Webhook", "avatarUrl": "http://i.imgur.com/IDOBtEJ.png" } On peut utiliser [[curl]] pour envoyer un texte sur l'adresse donnée : $ curl -d '{"text": "Webhook in Matrix from Terminal", "format": "plain", "displayName": "Bot", "avatarUrl": "http://i.imgur.com/IDOBtEJ.png"}' -H "Content-Type: application/json" -X POST https://webhooks.t2bot.io/api/v1/matrix/hook/hjyErSrz7NxvRM71U5PGfojarGNLZcNQmO5Tj2NM9yszoRd9trk7TQObfhUgMARD {"success":true,"queued":true} Résultat : {{ :capture_du_2019-06-05_12-29-27-webhook-matrix.png?400 |}} ==== Bot Matrix <-> Telegram ==== Basé sur : [[https://t2bot.io/telegram/|https://t2bot.io/telegram/]] On ajoute le bot "@telegram:t2bot.io" : {{ ::capture_du_2019-06-05_12-39-28-telegram-matrix.png?400 |}} On fait la commande pour se connecter à Telegram et on suit la procédure pour se connecter : {{ ::capture_du_2019-06-05_12-52-03-matrix-telegram-bot.png?400 |}} Un bot va ouvrir une conversation sur Matrix pour chaque conversation (active) sur Telegram : {{ ::capture_du_2019-06-05_15-15-45-matrix-telegram.png?400 |}}