hubot-matteruser
Hubot Adapter for Mattermost using the Web API and Websockets.
Description
Use this Hubot Adapter to connect to your Mattermost server. You can invite your bot to any channel just as a regular user. It will listen and perform your commands. The adapter uses mattermost-client for all low level Mattermost communication.
Installation
Creating a bot from scratch is easy:
npm install -g yo generator-hubot
yo hubot --adapter matteruser
Follow the instructions to set up your bot.
Environment variables
The adapter requires the following environment variables to be defined before your Hubot instance will start:
Variable | Required | Description |
---|---|---|
MATTERMOST_HOST | Yes | The Mattermost host e.g. mm.yourcompany.com |
MATTERMOST_GROUP | Yes | The team/group on your Mattermost server e.g. core |
MATTERMOST_USER | Yes | The Mattermost user account name e.g. [email protected] |
MATTERMOST_PASSWORD | Yes | The password of the user e.g. s3cr3tP@ssw0rd! |
MATTERMOST_WSS_PORT | No | Overrides the default port 443 for websocket (wss:// ) connections |
MATTERMOST_HTTP_PORT | No | Overrides the default port (80 or 443 ) for http:// or https:// connections |
MATTERMOST_TLS_VERIFY | No | (default: true) set to 'false' to allow connections when certs can not be verified (ex: self-signed, internal CA, ... - MITM risks) |
MATTERMOST_USE_TLS | No | (default: true) set to 'false' to switch to http/ws protocols |
MATTERMOST_LOG_LEVEL | No | (default: info) set log level (also: debug, ...) |
Example configuration
The below example assumes you have created a user [email protected]
with username hubot
and password s3cr3tP@ssw0rd!
on your Mattermost server in the core
team reachable on URL https://mm.yourcompany.com/core
export MATTERMOST_HOST=mm.yourcompany.com
export MATTERMOST_GROUP=core
export [email protected]
export MATTERMOST_PASSWORD=s3cr3tP@ssw0rd!
Example usage
For a complete working application that uses this client checkout the Hubot Mattermost adapter
Mattermost 3.3
Recently Mattermost has received a major upgrade that introduces backwards incompatible changes. Since hubot-matteruser
is using user credentials for interacting with the Mattermost API this will break your Hubot if you upgrade your Mattermost server without also upgrading the mattermost-client
version it uses.
Upgrading your Hubot for Mattermost 3.3
Find the package.json
file in your Hubot directory and look for the line in the dependencies
section that references hubot-matteruser
. Change the verion so it points to ^3.3.0
of the client. Example:
...
"dependencies": {
"hubot-matteruser": "^3.3.1"
},
...
License
The MIT License. See LICENSE
file.