• Stars
    star
    191
  • Rank 202,877 (Top 4 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 9 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Hubot adapter for Mattermost using Web API and Websockets

Downloads Version Licence

hubot-matteruser

Hubot is "chat bot" created by GitHub that listens for commands and executes actions based on your requests.

hubot-matteruser is a Hubot adapter for Mattermost written in JavaScript that uses the Mattermost Web Services API and WebSockets to deliver Hubot functionality.

Description

This Hubot adapter connects to your Mattermost server. You can invite your bot to any channel just as a regular user. It listens and perform your commands. The adapter uses mattermost-client for all low level Mattermost communication.

Two authentication methods are supported:

The second one is necessary if the Mattermost server delegates the authentication to another service (for example when using Mattermost shiped with GitLab). Such method is also probably prefered as the token does not reveals original credentials and can be revoked without any impact on the related account.

Docker usage

Standalone

Clone this repository, then build the Hubot-Matteruser container:

$ docker build --build-arg hubot_owner=<owner> \
             --build-arg hubot_name=<name> \
             --build-arg hubot_description=<desc> \
             --tag=hubot-matteruser \
             .

Start the container:

$ docker run -it \
           --env MATTERMOST_HOST=<mm_host> \
           --env MATTERMOST_GROUP=<mm_team> \
           --env MATTERMOST_USER=<mm_user_email> \
           --env MATTERMOST_PASSWORD=<mm_user_password> \
           -p 8080:8080 \
           --name hubot-matteruser \
           hubot-matteruser

or if you have a personal access token:

$ docker run -it \
           --env MATTERMOST_HOST=<mm_host> \
           --env MATTERMOST_GROUP=<mm_team> \
           --env MATTERMOST_ACCESS_TOKEN=<personal>
           -p 8080:8080 \
           --name hubot-matteruser \
           hubot-matteruser

Docker Compose

To integrate with a running Mattermost instance, update docker-compose.yml accordingly and launch the bot:

docker-compose build
docker-compose run -d

If you just want to test locally, you can find here a fork of the official Mattermost Docker Compose stack plugged to Hubot-Matteruser:

Installation

1) Install a Mattermost server

Follow the Mattermost install guides to set up the latest version of Mattermost 5.4.x.

IMPORTANT: Make sure your hubot-matteruser and mattermost-client versions match the major version of your Mattermost server so the API versions will match.

2) Install hubot-matteruser

On a separate server, install hubot-matteruser using the following commands:

npm install -g yo generator-hubot
yo hubot --adapter matteruser

Follow the instructions to set up your bot, including setup of mattermost-client.

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 No The Mattermost user account name e.g. [email protected]
MATTERMOST_PASSWORD No The password of the user e.g. s3cr3tP@ssw0rd!
MATTERMOST_ACCESS_TOKEN No The personal access token of the user
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, ...)
MATTERMOST_REPLY No (default: true) set to 'false' to stop posting reply responses as comments
MATTERMOST_IGNORE_USERS No (default: empty) Enter a comma-separated list of user senderi_names to ignore.

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!

Upgrade

To upgrade your Hubot for Mattermost 4.4.x, 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 ^5.4.4 of the client. Example:

  ...
  "dependencies": {
    "hubot-matteruser": "^5.4.6"
  },
  ...

Try the Hubot demo

You can try out Hubot by joining the Mattermost community server and joining the Hubot channel:

  1. Create an account on the Mattermost nightly builds server at https://pre-release.mattermost.com/
  2. Join the "Hubot" channel
  3. Type hubot help for instructions

Sample commands

You can try a simple command like hubot the rules to bring some static text stored in Hubot:

s

Try hubot animate me to have Hubot reach out to Giphy and bring back a random animated image.

s

Try hubot map me [NAME_OF_CITY] to have Hubot reach out to Google Maps and bring back a map based on the name of a city you pass in as a parameter. For example, hubot map me palo alto brings back the below map of Palo Alto

s

License

The MIT License. See LICENSE file.

More Repositories

1

mattermost-client

Mattermost client using websockets
JavaScript
62
star
2

terraform-provider-ssh

Copy files and run commands remotely via SSH, with bastion and proxy support
Go
31
star
3

terraform-provider-htpasswd

Terraform provider to generate htpasswd related content
Go
15
star
4

iam-proxy

HSDP IAM proxy
Go
5
star
5

prometheus-hsdp-metrics-exporter

Exporter for the HSDP Metrics service. Yes, turtles all the way down
Go
4
star
6

terraform-backend-hsdp

Store Terraform state on HSDP
Go
4
star
7

terraform-cloudfoundry-esapm

Terraform module to set up an Elastic APM enabled cluster and the Kibana frontend
HCL
4
star
8

gotversion

Determine next semantic version of your project by analysing your Git repo
Go
3
star
9

go-hello-world

Small microservice which demonstrates how to deploy to Cloud foundry
Go
3
star
10

hsdp-events

HSDP Metrics alerts webhook broker and CF events forwarder for Microsoft Teams
Go
3
star
11

kong-plugin-mtlsauth

mTLS auth plugin
Go
3
star
12

loki-cf-logdrain

Forward logs from Cloud foundry to Loki
Go
3
star
13

helm2cf

Generate Cloud foundry manifests from Helm charts
Shell
2
star
14

hsdp-function-vault-read

Function to read keys from a HSDP Vault instance
Go
2
star
15

caddy-hsdpsigner

Caddy module to sign requests
Go
2
star
16

hsdp-task-s3mirror

Periodically mirror S3 Bucket content to another bucket
Shell
2
star
17

kong-plugin-geofence

Kong plugin implementing geofencing
Go
2
star
18

go-envoy

Go client for talking to the Enphase Gateway-S Metered
Go
2
star
19

kong-plugin-hsdpverifier

Kong Verifier plugin for HSDP API signed requests
Go
2
star
20

provider-jet-hsdp

HSDP Terrajet Provider
Go
2
star
21

terraform-twilio-phone-number

Terraform module to provision Twilio phone numbers
HCL
2
star
22

cf-crontab

A crontab scheduler in a 16MB microservice for Cloud foundry
Go
2
star
23

prometheus-solaxrt-exporter

Prometheus exporter for real-time Solax inverter data
Go
2
star
24

hsdp-task-streaming-backup

hsdp-task for backing up a PostgreSQL database to S3
Shell
2
star
25

hmac

HSDP Metrics Alert Collector
Go
2
star
26

terraform-hsdp-prometheus

Terraform module for provisioning Promethues on HSDP Container Host
HCL
2
star
27

iron-streaming-backup

IronIO schedulable PostgreSQL backup task
Shell
2
star
28

prometheus-envoy-exporter

Prometheus exporter for Enphase Envoy-S Metered gateways
Go
2
star
29

lessor

Dynamic tenant access control for Loki
Go
2
star
30

hsdp-task-http-request

HTTP Task for use with hsdp_function
Go
2
star
31

terraform-hsdp-broadsea

Terraform module to deploy Broadsea
HCL
1
star
32

hue-state-cycler

Power cycle hue devices with a simple API
Go
1
star
33

cfutil

Convenience functions for Go apps running in Cloudfoundry
Go
1
star
34

terraform-hsdp-timescaledb

Deploy TimescaleDB to Container Host
HCL
1
star
35

nomad-driver-ch

Experimental Nomad Container Host driver plugin
Go
1
star
36

terraform-cloudfoundry-loki

Grafana Loki deployment for Cloud foundry
HCL
1
star
37

terraform-cloudfoundry-grafana-agent

Module to deploy Grafana Agent to Cloud foundry
HCL
1
star
38

aws-lambda-loki-extension

Lambda extension to push function logs directly to a Loki cluster
Go
1
star
39

go-rabbitmq

Convenience wrapper for accessing RabbitMQ services in CF
Go
1
star
40

terraform-cloudfoundry-tempo

Experiment with Grafana Tempo
HCL
1
star
41

terraform-hsdp-rabbitmq

Terraform module for RabbitMQ on HSDP Container Host
HCL
1
star
42

caddy-token

Caddy plugin for static and ID token authentication
Go
1
star
43

dhp-client

DHP client
Go
1
star
44

terraform-cloudfoundry-traefik

Terraform module for deploying Traefik
HCL
1
star
45

busybox-wget-with-retries

A busybox with a modified wget command that allows injecting retries
Shell
1
star
46

prometheus-solaxcloud-exporter

Promethues exporter for SolaxCloud inverter data
Go
1
star
47

hs

hs - Healthy Scripter for interacting with various HSDP services from the CLI
Go
1
star
48

phs-client

PHS client
Go
1
star
49

terraform-hsdp-nomad

Module to deploy Nomad to HSP Container Host
HCL
1
star
50

mmdb

Load MindMax DB files using license key
Go
1
star
51

prometheus-watermeter-exporter

Prometheus exporter for the HomeWizard Wifi Watermeter
Go
1
star
52

prometheus-aws-cost-exporter

Export AWS cost information as standard Prometheus metrics
Go
1
star