Skip to content

Brightscout/mattermost-plugin-outlook-presence

 
 

Repository files navigation

Mattermost Plugin Outlook Presence

This plugin is used for getting status updates for users. It adds an additional websocket endpoint to the Mattermost server which can be connected to without an active user's valid token. It also exposes a new paginated API to get the statuses of all users along with their emails. The purpose of this plugin is to provide status updates to Microsoft Outlook through the use of an intermediary IM app. To know more about how to integrate an application with Outlook, you can read the official docs. (This plugin can be used with any third-party application that wants to subscribe to Mattermost users' status updates.)

Prerequisite

This plugin works with a companion Windows binary which integrates with Outlook on each user's desktop. Learn more about the Mattermost Outlook Presence Provider here.

Installation

  1. Go to the releases page of this GitHub repository and download the latest release for your Mattermost server.
  2. Upload this file in the Mattermost System Console > Plugins > Management page to install the plugin. To learn more about how to upload a plugin, see the documentation.
  3. After installing the plugin, you should go to the plugin's settings in System Console and generate a Webhook Secret (more about this below).

Configuration

This plugin contains some configuration settings that you must set. You can do that by going to System Console > Plugins > Outlook Presence. You can know more about these settings below:

  • Webhook Secret: Setting a webhook secret allows you to ensure that the requests sent to the payload URL are from the Office IM app (or any other client app), and is used with every request that is made from the IM app to Mattermost.

  • Status response page size This setting is for the paginated APIs exposed by the plugin. It basically denotes the number of statuses to return on a single page of the API request.

Features

This plugin adds two endpoints to the Mattermost server and both require authentication using the webhook secret in the plugin configuration settings.

  • GetStatusForAllUsers endpoint: /status is the endpoint which can be used to get the statuses for all active users present in Mattermost. The request must contain the webhook secret in a query param called secret or in form data. It accepts another query param called page whose default value is 0. If a page does not contain any users, then the endpoint returns an empty array. Also, if there's no record of a user's status in the Mattermost database (in the case of bots and users who have just signed up), then this endpoint returns their status as "offline".

  • Websocket endpoint: /ws is the endpoint through which you can connect to the websocket. This plugin adds server logs whenever a new client is connected/disconnected along with the current size of the websocket connection pool. This endpoint also requires the secret query param for authentication.

You can make a request to both these endpoints using the base url as -

{MATTERMOST_SERVER_URL}/plugins/com.mattermost.outlook-presence/api/v1

Building the plugin

  • Make sure you have following components installed:

  • Note that this project uses Go modules. Be sure to locate the project outside of $GOPATH. To learn more about plugins, see plugin documentation.

  • Build your plugin:

    make dist
    
  • This will produce a single plugin file (with support for multiple architectures) for upload to your Mattermost server:

    dist/com.mattermost.outlook-presence-x.y.z.tar.gz
    

Development

To avoid having to manually install your plugin, build and deploy your plugin using one of the following options. In order for the below options to work, you must first enable plugin uploads via your config.json or API and restart Mattermost.

    "PluginSettings" : {
        ...
        "EnableUploads" : true
    }

Deploying with Local Mode

If your Mattermost server is running locally, you can enable local mode to streamline deploying your plugin. Edit your server configuration as follows:

{
    "ServiceSettings": {
        ...
        "EnableLocalMode": true,
        "LocalModeSocketLocation": "/var/tmp/mattermost_local.socket"
    },
}

and then deploy your plugin:

make deploy

You may also customize the Unix socket path:

export MM_LOCALSOCKETPATH=/var/tmp/alternate_local.socket
make deploy

Deploying with credentials

Alternatively, you can authenticate with the server's API with credentials:

export MM_SERVICESETTINGS_SITEURL=http://localhost:8065
export MM_ADMIN_USERNAME=admin
export MM_ADMIN_PASSWORD=password
make deploy

or with a personal access token:

export MM_SERVICESETTINGS_SITEURL=http://localhost:8065
export MM_ADMIN_TOKEN=j44acwd8obn78cdcx7koid4jkr
make deploy

Made with ♥ by Brightscout

About

Outlook Presence plugin for Mattermost

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 76.7%
  • Makefile 13.8%
  • JavaScript 5.0%
  • TypeScript 4.4%
  • HTML 0.1%