Outils pour utilisateurs

Outils du site


matrix

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
Dernière révisionLes deux révisions suivantes
matrix [2017/11/27 10:07] – [Riot.im] simonmatrix [2019/06/05 13:18] – [Webhook et Matrix] simon
Ligne 61: Ligne 61:
 Souhaitez-vous continuer ? [O/n]  Souhaitez-vous continuer ? [O/n] 
 </code> </code>
-==== Quaternion ==== +===== Bots ===== 
-Client en QT/QML ([[https://matrix.org/docs/projects/client/quaternion.html|Page sur matrix.org]]).+==== 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 :  
 +<code> 
 +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" 
 +
 +</code> 
 + 
 +On peut utiliser [[curl]] pour envoyer un texte sur l'adresse donnée : 
 + 
 +<code bash> 
 +$ 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} 
 +</code> 
 + 
 +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 (activesur Telegram : 
 +{{ ::capture_du_2019-06-05_15-15-45-matrix-telegram.png?400 |}}