mattermost-community/mattermost-plugin-autolink

Can I have some random data when creating a link? (for Google meet)

petersenna opened this issue · 2 comments

Hello, I am looking into a low maintenance way to integrate MM with Google meet, and I am considering if autolink is a good fit.

My use case would be something like the user typing the word 'meet' and having the plugin to link that to https://accounts.google.com/AccountChooser/signinchooser?continue=https://g.co/meet/[random], and having [random] being replaced by something like:

  • when typed in a room: [random] -> companyName_roomName_userName
  • when typed in a private chat: [random] -> companyName_userName1_userName2 (ideally having users in alphabetic order)
  • and to have the configuration option to: [random] ->being replaced by something random, that changes on every time it is invoked

Can I do that with autolink? Thank you!

you can try https://github.com/SrMouraSilva/mattermost-google-meet-plugin
Or just create a custom script (see below) and connect it to custom slash command ( e.g. /meet) in mattermost UI

<?php
ini_set('display_errors', 0);

$token = '<PUT YOUR MATTERMOST TOKEN HERE>';
if (!isset($_POST['channel_name']) || !isset($_POST['token']) || $_POST['token'] !== $token) {
        http_response_code(401);
            echo 'bad request';
        return;
}
$name = $_POST['channel_name'];
$link = 'http://g.co/meet/' . urlencode($name);
$responseLines = [
        '### :phone: ' . $_POST['user_name'] . ' invites you to **[videoconference](http://g.co/meet/' . $name . ')**',
    ];
$json = json_encode(['response_type' => 'in_channel', 'text' => implode(PHP_EOL, $responseLines)]);

header('Content-Type: application/json');
echo $json;

Thank you!