GithubHelp home page GithubHelp logo

loafoe / hubot-matteruser Goto Github PK

View Code? Open in Web Editor NEW
193.0 5.0 81.0 1.45 MB

Hubot adapter for Mattermost using Web API and Websockets

License: MIT License

Dockerfile 1.58% JavaScript 98.42%
hubot mattermost hubot-adapter websockets

hubot-matteruser's Introduction

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.

hubot-matteruser's People

Contributors

3ch01c avatar banzo avatar bbodenmiller avatar citysim avatar contolini avatar dependabot[bot] avatar ecylmz avatar emedvedev avatar gbonnefille avatar hesstobi avatar hp41 avatar it33 avatar jgarec avatar judokus avatar lgmcode avatar loafoe avatar marthym avatar matfiz avatar mlmnetcologne avatar nothingtoloose avatar tobiasgiese avatar trentm avatar vhex avatar xurizaemon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

hubot-matteruser's Issues

Hubot Failed to log to Mattermost Chat

Hello all,

When i try to launch hubot in Mattermost I got this error :

 ./bin/hubot --adapter matteruser


npm WARN [email protected] requires a peer of coffee-script@^1.12.6 but none is installed. You must install peer dependencies yourself.

up to date in 1.664s
[Tue Jan 16 2018 13:48:59 GMT+0100 (CET)] INFO Logging in...
[Tue Jan 16 2018 13:48:59 GMT+0100 (CET)] INFO api url:https://182.21.221.170::8065/api/v4/users/login
[Tue Jan 16 2018 13:48:59 GMT+0100 (CET)] ERROR Login call failed
[Tue Jan 16 2018 13:48:59 GMT+0100 (CET)] INFO Reconnecting in 1000ms
[Tue Jan 16 2018 13:49:00 GMT+0100 (CET)] INFO Attempting reconnect
[Tue Jan 16 2018 13:49:00 GMT+0100 (CET)] INFO Logging in...
[Tue Jan 16 2018 13:49:00 GMT+0100 (CET)] INFO api url:https://182.21.221.170::8065/api/v4/users/login
[Tue Jan 16 2018 13:49:00 GMT+0100 (CET)] ERROR Login call failed
[Tue Jan 16 2018 13:49:00 GMT+0100 (CET)] INFO Reconnecting in 2000ms
^C


My variable are :

env | grep MATT*

MATTERMOST_HOST=182.21.221.170:8065
MATTERMOST_PASSWORD=mypassword
MATTERMOST_GROUP=myteam
MATTERMOST_USER=myuser

Hubot and Mattermost are on the same machine and when i try to connect directly with the user it works, but when i try to connect using Hubot it don't work and i get the error above.

Can someone help me with this plz ?

response of the bot

Hi,

when executing a command to which to bot reacts/responses, I always get back the "id" of the bot-user first before the actual result follows.

For example: p93qj5g13tyj9fxktzg7ekctsr

Is it possible to disable this behaviour, for example with an additional environment variable? I only want the bot to reply with the result of my request.

Regards,
Simon

Message didn't deliver

Hi guys,
I have configured in my docker-compose.sh information to start hubot-matteruser, but when I send a message like hubot help the message didn't delivery.

Below, follow my configuration.
hubot-matteruser:
build:
context: ./hubot-matteruser
args:
hubot_owner: admin
hubot_name: hubot
hubot_description: GitGameBot
restart: always
user: hubot-matteruser
links:
- web:web
ports:
- "8080:8080"
environment:
- MATTERMOST_HOST=myIP
- MATTERMOST_PORT=myPort
- MATTERMOST_GROUP=myTime
- MATTERMOST_USER=myEmailUser
- MATTERMOST_PASSWORD=myPassword
- MATTERMOST_LOG_LEVEL=debug
- MATTERMOST_USE_TLS=false
- MATTERMOST_TLS_VERIFY=false
- MATTERMOST_WSS_PORT=80

And log, doesn't have any information about error:
Wed Apr 18 2018 17:17:55 GMT+0000 (UTC)] INFO Logging in...
[Wed Apr 18 2018 17:17:55 GMT+0000 (UTC)] DEBUG POST /users/login
[Wed Apr 18 2018 17:17:55 GMT+0000 (UTC)] INFO api url:http://192.168.57.65:8090/api/v4/users/login
[Wed Apr 18 2018 17:17:55 GMT+0000 (UTC)] INFO Websocket URL: ws://192.168.57.65:8090/api/v4/websocket
[Wed Apr 18 2018 17:17:55 GMT+0000 (UTC)] INFO Logged in as user "hubot" but not connected yet.
[Wed Apr 18 2018 17:17:55 GMT+0000 (UTC)] INFO Loading /users/me
[Wed Apr 18 2018 17:17:55 GMT+0000 (UTC)] DEBUG GET /users/me
[Wed Apr 18 2018 17:17:55 GMT+0000 (UTC)] INFO api url:http://192.168.57.65:8090/api/v4/users/me
[Wed Apr 18 2018 17:17:55 GMT+0000 (UTC)] INFO Loading /users/me/preferences
[Wed Apr 18 2018 17:17:55 GMT+0000 (UTC)] DEBUG GET /users/me/preferences
[Wed Apr 18 2018 17:17:55 GMT+0000 (UTC)] INFO api url:http://192.168.57.65:8090/api/v4/users/me/preferences
[Wed Apr 18 2018 17:17:55 GMT+0000 (UTC)] INFO Loading /users/me/teams
[Wed Apr 18 2018 17:17:55 GMT+0000 (UTC)] DEBUG GET /users/me/teams
[Wed Apr 18 2018 17:17:55 GMT+0000 (UTC)] INFO api url:http://192.168.57.65:8090/api/v4/users/me/teams
[Wed Apr 18 2018 17:17:55 GMT+0000 (UTC)] INFO Loaded Preferences...
[Wed Apr 18 2018 17:17:55 GMT+0000 (UTC)] INFO Loaded Me...
[Wed Apr 18 2018 17:17:55 GMT+0000 (UTC)] INFO Found 1 teams.
[Wed Apr 18 2018 17:17:55 GMT+0000 (UTC)] DEBUG Testing accurate == accurate
[Wed Apr 18 2018 17:17:55 GMT+0000 (UTC)] INFO Found team! 8s6rdaqubids58fydzriexnhqc
[Wed Apr 18 2018 17:17:55 GMT+0000 (UTC)] INFO Loading /users?page=0&per_page=200&in_team=8s6rdaqubids58fydzriexnhqc
[Wed Apr 18 2018 17:17:55 GMT+0000 (UTC)] DEBUG GET /users?page=0&per_page=200&in_team=8s6rdaqubids58fydzriexnhqc
[Wed Apr 18 2018 17:17:55 GMT+0000 (UTC)] INFO api url:http://192.168.57.65:8090/api/v4/users?page=0&per_page=200&in_team=8s6rdaqubids58fydzriexnhqc
[Wed Apr 18 2018 17:17:55 GMT+0000 (UTC)] INFO Loading /users/me/teams/8s6rdaqubids58fydzriexnhqc/channels
[Wed Apr 18 2018 17:17:55 GMT+0000 (UTC)] DEBUG GET /users/me/teams/8s6rdaqubids58fydzriexnhqc/channels
[Wed Apr 18 2018 17:17:55 GMT+0000 (UTC)] INFO api url:http://192.168.57.65:8090/api/v4/users/me/teams/8s6rdaqubids58fydzriexnhqc/channels
[Wed Apr 18 2018 17:17:55 GMT+0000 (UTC)] INFO Connecting...
[Wed Apr 18 2018 17:17:55 GMT+0000 (UTC)] INFO Connected to Mattermost.
[Wed Apr 18 2018 17:17:55 GMT+0000 (UTC)] INFO Sending challenge...
[Wed Apr 18 2018 17:17:55 GMT+0000 (UTC)] INFO Starting pinger...
[Wed Apr 18 2018 17:17:55 GMT+0000 (UTC)] INFO Mattermost server: 4.9.0.4.9.0.d39ed1f8abee5df86e3d38e503512310.false
[Wed Apr 18 2018 17:17:55 GMT+0000 (UTC)] DEBUG Received unhandled message:
[Wed Apr 18 2018 17:17:55 GMT+0000 (UTC)] DEBUG { status: 'OK', seq_reply: 1 }
[Wed Apr 18 2018 17:17:55 GMT+0000 (UTC)] INFO Found 3 subscribed channels.
[Wed Apr 18 2018 17:17:55 GMT+0000 (UTC)] INFO Found 60 profiles.
[Wed Apr 18 2018 17:17:55 GMT+0000 (UTC)] INFO Loading /users?page=1&per_page=200&in_team=8s6rdaqubids58fydzriexnhqc
[Wed Apr 18 2018 17:17:55 GMT+0000 (UTC)] DEBUG GET /users?page=1&per_page=200&in_team=8s6rdaqubids58fydzriexnhqc
[Wed Apr 18 2018 17:17:55 GMT+0000 (UTC)] INFO api url:http://192.168.57.65:8090/api/v4/users?page=1&per_page=200&in_team=8s6rdaqubids58fydzriexnhqc
[Wed Apr 18 2018 17:17:56 GMT+0000 (UTC)] INFO hubot-redis-brain: Using default redis on localhost:6379

Someone can help me ?

ERROR TypeError: Cannot set property 'dm_channel_id' of undefined

[gajus@mattermost myhubot]$ ./bin/hubot --adapter matteruser
[Wed Nov 23 2016 14:29:10 GMT+0000 (UTC)] INFO Logging in...
[Wed Nov 23 2016 14:29:10 GMT+0000 (UTC)] INFO Websocket URL: wss://messaging.anuary.com:443/api/v3/users/websocket
[Wed Nov 23 2016 14:29:10 GMT+0000 (UTC)] INFO Logged in as user "january" but not connected yet.
[Wed Nov 23 2016 14:29:10 GMT+0000 (UTC)] INFO Connecting...
[Wed Nov 23 2016 14:29:10 GMT+0000 (UTC)] ERROR Failed to load profiles from server.
[Wed Nov 23 2016 14:29:10 GMT+0000 (UTC)] INFO Error: [object Object]
[Wed Nov 23 2016 14:29:10 GMT+0000 (UTC)] INFO Connected to Mattermost.
[Wed Nov 23 2016 14:29:10 GMT+0000 (UTC)] INFO Starting pinger...
[Wed Nov 23 2016 14:29:11 GMT+0000 (UTC)] ERROR hubot-heroku-alive included, but missing HUBOT_HEROKU_KEEPALIVE_URL. `heroku config:set HUBOT_HEROKU_KEEPALIVE_URL=$(heroku apps:info -s  | grep web-url | cut -d= -f2)`
[Wed Nov 23 2016 14:29:11 GMT+0000 (UTC)] INFO hubot-redis-brain: Using default redis on localhost:6379
[Wed Nov 23 2016 14:29:11 GMT+0000 (UTC)] INFO hubot-redis-brain: Data for hubot brain retrieved from Redis
[Wed Nov 23 2016 14:29:11 GMT+0000 (UTC)] INFO Brain loaded
+[Wed Nov 23 2016 14:29:29 GMT+0000 (UTC)] ERROR TypeError: Cannot set property 'dm_channel_id' of undefined
+  at Matteruser.message (/home/gajus/myhubot/node_modules/hubot-matteruser/src/matteruser.coffee:133:11, <js>:206:31)
+  at Client.<anonymous> (/home/gajus/myhubot/node_modules/hubot-matteruser/src/matteruser.coffee:1:1, <js>:3:61)
+  at emitOne (events.js:96:13)
+  at Client.emit (events.js:188:7)
+  at Client.onMessage (/home/gajus/myhubot/node_modules/mattermost-client/src/client.coffee:211:17, <js>:278:23)
+  at WebSocket.<anonymous> (/home/gajus/myhubot/node_modules/mattermost-client/src/client.coffee:158:13, <js>:217:22)
+  at emitTwo (events.js:106:13)
+  at WebSocket.emit (events.js:191:7)
+  at Receiver.ontext (/home/gajus/myhubot/node_modules/ws/lib/WebSocket.js:841:10)
+  at /home/gajus/myhubot/node_modules/ws/lib/Receiver.js:536:18
+  at Receiver.applyExtensions (/home/gajus/myhubot/node_modules/ws/lib/Receiver.js:371:5)
+  at /home/gajus/myhubot/node_modules/ws/lib/Receiver.js:508:14
+  at Receiver.flush (/home/gajus/myhubot/node_modules/ws/lib/Receiver.js:347:3)
+  at Receiver.finish (/home/gajus/myhubot/node_modules/ws/lib/Receiver.js:541:12)
+  at Receiver.expectHandler (/home/gajus/myhubot/node_modules/ws/lib/Receiver.js:499:31)
+  at Receiver.add (/home/gajus/myhubot/node_modules/ws/lib/Receiver.js:103:24)
+  at TLSSocket.realHandler (/home/gajus/myhubot/node_modules/ws/lib/WebSocket.js:825:20)
+  at emitOne (events.js:96:13)
+  at TLSSocket.emit (events.js:188:7)
+  at readableAddChunk (_stream_readable.js:176:18)
+  at TLSSocket.Readable.push (_stream_readable.js:134:10)
+  at TLSWrap.onread (net.js:551:20)

I have got this error after sending a private message to the bot.

Show Channel Name

Hello,
thanks for your great hubot plugin.

For many plugins you need the room name. The method "context.response.message.room" outputs only the room ID. I've seen the Mattermost API has the ability to output the room name. Could you implement the function please?

Multiple "brain loaded" messages

I'm observing issues where we see some plugins get loaded repeatedly - and alongside this I see repeats of the "Brain loaded" message from matteruser.coffee

[Thu Apr 27 2017 09:24:51 GMT+1200 (NZST)] INFO hubot-redis-brain: Data for hubot brain retrieved from Redis
[Thu Apr 27 2017 09:24:51 GMT+1200 (NZST)] INFO Brain loaded
[Thu Apr 27 2017 09:24:51 GMT+1200 (NZST)] INFO Brain loaded
[Thu Apr 27 2017 09:24:51 GMT+1200 (NZST)] INFO Brain loaded
[Thu Apr 27 2017 09:24:52 GMT+1200 (NZST)] INFO Brain loaded
[Thu Apr 27 2017 09:24:52 GMT+1200 (NZST)] INFO Brain loaded

Trying to identify what would cause this to happen, and wondering if other users are observing it also.

Related issue over in my bot repo: xurizaemon/bolts#15

Caret range specifier breaks legacy clients

Hi @loafoe!

After trying to figure out why our bot was mysteriously crashing, I noticed v3.1.1 of this plugin lists version ^3.1.1 of mattermost-client as a dependency. Now that version 3.3.x of mattermost-client has been released, hubot-matteruser is pulling it in, causing it to fail because there are backwards-incompatible changes in 3.3.x. (Our server is still at MM v3.2)

Instead, the mattermost-client dep should probably be listed with a tilde ~ range specifier so that only patch increments are included.

cc @higs4281

hubot with matteruser adapter will not post to mattermost channel

Hi,

I can run hubot on a server external to the mattermost server. Hubot answers commands and responds appropriately. However, I cannot get hubot to post on the mattermost channel.
Is there some logs I can look up or is there some advice you can give me?

I also noticed when I run ./bin/hubot --matteruser then ask hubot for the adapter it responds with shell.
I ran without the --matteruser and it stayed as shell.
Here is a screenshot.

Thanks. :)
matteruser

  • Victoria

Cannot initiate a private message channel from the bot

Using this code:

robot.hear /plop/i, (res) ->
    robot.messageRoom res.message.user.name, "Hello!"
    robot.send {room: res.message.user.name}, "Hello!"

I expect the bot to write a private message to the user. It does work, but only if the user has already open a private message channel to the bot. The bot cannot open it on its initiative the very first time.

I get the following trace:

ERROR TypeError: Cannot read property 'toLowerCase' of undefined
  at Brain.userForName (xxxx\basic\node_modules\hubot\src\brain.coffee:120:17, <js>:106:23)
  at Matteruser.send (xxxx\basic\node_modules\hubot-matteruser\src\matteruser.coffee:101:16, <js>:160:31)
  at runAdapterSend (xxxx\basic\node_modules\hubot\src\response.coffee:82:34, <js>:87:50)
  at allDone (xxxx\basic\node_modules\hubot\src\middleware.coffee:44:37, <js>:34:16)
  at xxxx\basic\node_modules\async\lib\async.js:274:13
  at Object.async.eachSeries (xxxx\basic\node_modules\async\lib\async.js:142:20)
  at Object.async.reduce (xxxx\basic\node_modules\async\lib\async.js:268:15)
  at xxxx\basic\node_modules\hubot\src\middleware.coffee:49:7, <js>:37:22
  at _combinedTickCallback (internal/process/next_tick.js:67:7)
  at process._tickCallback (internal/process/next_tick.js:98:9)

Reproduced on node 6.9.4, npm 3.10.10.

Join multiple teams

Hi,

Wondering if there is support for multiple teams in the matteruser plugin. I have multiple internal teams that it would be nice to integrate Hubot into, so if there is a way to do that without spinning up multiple Hubot instances that'd be awesome.

May be incompatible with hubot@3?

I was just trying to upgrade all my hubot things, and I went with [email protected]. This yielded errors here:

if msg.data.sender_name in @mmIgnoreUsers

I commented this line out to see if it the ignored users. The error just shifted to just a few lines later:

mmUser = @client.getUserByID mmPost.user_id

INFO Someone is typing...
DEBUG Message {
  event: 'posted',
  data:
   { channel_display_name: '',
     channel_name: 'my8---redacted---br6c',
     channel_type: 'D',
     mentions: '["no4--redacted--br6c"]',
     post: '{"id":"ke3----tc","create_at":1522146010510,"update_at":1522146010510,"edit_at":0,"delete_at":0,"is_pinned":false,"user_id":"my8---t1h9e","channel_id":"rn----wa","root_id":"","parent_id":"","original_id":"","message":"help","type":"","props":{},"hashtags":"","pending_post_id":"my8------h9e:1522146010862"}',
     sender_name: 'mynickname',
     team_id: '' },
  broadcast:
   { omit_users: null,
     user_id: '',
     channel_id: 'rn83---redacted--cwa',
     team_id: '' },
  seq: 4 }
ERROR TypeError: Cannot read property 'getUserByID' of undefined
  at Matteruser.message (--redacted--\node_modules\hubot-matteruser\src\matteruser.coffee:207:18, <js>:289:28)
  at Client.<anonymous> (--redacted--\node_modules\hubot-matteruser\src\matteruser.coffee:1:1, <js>:5:61)
  at Client.emit (events.js:160:13)
  at Client.onMessage (--redacted--\node_modules\mattermost-client\src\client.coffee:279:17, <js>:381:23)
  at WebSocket.<anonymous> (--redacted--\node_modules\mattermost-client\src\client.coffee:224:13, <js>:318:22)
  at WebSocket.emit (events.js:160:13)
  at Receiver.ontext (--redacted--\node_modules\ws\lib\WebSocket.js:841:10)
  at --redacted--\node_modules\ws\lib\Receiver.js:536:18
  at Receiver.applyExtensions (--redacted--\node_modules\ws\lib\Receiver.js:371:5)
  at --redacted--\node_modules\ws\lib\Receiver.js:508:14
  at Receiver.flush (--redacted--\node_modules\ws\lib\Receiver.js:347:3)
  at Receiver.finish (--redacted--\node_modules\ws\lib\Receiver.js:541:12)
  at Receiver.expectHandler (--redacted--\node_modules\ws\lib\Receiver.js:499:31)
  at Receiver.add (--redacted--\node_modules\ws\lib\Receiver.js:103:24)
  at TLSSocket.realHandler (--redacted--\node_modules\ws\lib\WebSocket.js:825:20)
  at TLSSocket.emit (events.js:160:13)
  at addChunk (_stream_readable.js:269:12)
  at readableAddChunk (_stream_readable.js:256:11)
  at TLSSocket.Readable.push (_stream_readable.js:213:10)
  at TLSWrap.onread (net.js:599:20)

INFO ping

Mattermost 4.5 does not seem to work

Is this version not compatible with mattermost 4.5? When I startup I get the following log:

[Thu Feb 08 2018 09:58:27 GMT+0000 (UTC)] INFO Loading /users/me/teams/null/channels
[Thu Feb 08 2018 09:58:27 GMT+0000 (UTC)] INFO api url:https://XXX/api/v4/users/me/teams/null/channels
[Thu Feb 08 2018 09:58:27 GMT+0000 (UTC)] INFO Connecting...
[Thu Feb 08 2018 09:58:27 GMT+0000 (UTC)] INFO Loaded Me...
[Thu Feb 08 2018 09:58:27 GMT+0000 (UTC)] ERROR Failed to load profiles from server.
[Thu Feb 08 2018 09:58:27 GMT+0000 (UTC)] INFO Error: [object Object]
[Thu Feb 08 2018 09:58:27 GMT+0000 (UTC)] ERROR Failed to get subscribed channels list from server: API response: 400
[Thu Feb 08 2018 09:58:27 GMT+0000 (UTC)] INFO Error: [object Object]
[Thu Feb 08 2018 09:58:27 GMT+0000 (UTC)] INFO Connected to Mattermost.
[Thu Feb 08 2018 09:58:27 GMT+0000 (UTC)] INFO Sending challenge...
[Thu Feb 08 2018 09:58:27 GMT+0000 (UTC)] INFO Starting pinger...
[Thu Feb 08 2018 09:58:27 GMT+0000 (UTC)] INFO Mattermost server: 4.5.0.4.5.0.f2bf6dfa722fc3f8278daeaf88f8fffb.false
[Thu Feb 08 2018 09:58:57 GMT+0000 (UTC)] INFO ping

Question/Suggestion: why mattermost-client, not Mattermosts own Javascript Driver?

Dear Loafoe
Dear all

As far as I understood, we need mattermost-client as an MM-API-Implementation for this hubot plugin. So we're limited to those calls implemented in mattermost-client, right? Wouldn't it make sense to use the original mattermost Javascript Driver found here? As far as I understood, all necessesary API calls are implemented there.

Cheers
TG

Wrong message order if your hubot machine have time difference with mattermost server.

If your hubot machine have different time with mattermost server you may recieve wrong message order between you and hubot if you use msg.reply

Similar as loafoe/mattermost-client#39 but on module

reply: (envelope, strings...) ->
    if @mmNoReply
      return @send(envelope, strings...)

    strings = strings.map (s) -> "@#{envelope.user.name} #{s}"
    postData = {}
    postData.message = strings[0]

    # Set the comment relationship
    postData.root_id = envelope.message.id
    postData.parent_id = postData.root_id

    postData.create_at = Date.now()            <- Change to postData.create_at = 0

docker troubles

Hi,

I am receiving the following error when attempting to build using docker-compose -

Step 14/18 : RUN echo "No" | yo hubot --adapter matteruser --owner="${hubot_owner}" --name="${hubot_name}" --description="${hubot_desciption}" --defaults && sed -i '/heroku/d' external-scripts.json
 ---> Running in 8bc2a25c8fc7
/usr/local/lib/node_modules/yo/node_modules/yeoman-environment/lib/resolver.js:165
    let lookup = path.join(...parts.slice(0, i + 1), 'node_modules');
                           ^^^

SyntaxError: Unexpected token ...
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:373:25)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/yo/node_modules/yeoman-environment/lib/environment.js:14:18)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
ERROR: Service 'hubot-matteruser' failed to build: The command '/bin/sh -c echo "No" | yo hubot --adapter matteruser --owner="${hubot_owner}" --name="${hubot_name}" --description="${hubot_desciption}" --defaults && sed -i '/heroku/d' external-scripts.json' returned a non-zero code: 1

with an appropriately configured docker-compose.yml.

This is occurring on multiple OSes/docker versions, too

Any ideas?

INFO Error: [object Object] and ERROR TypeError: Cannot set property 'dm_channel_id' of undefined

I'm getting the below errors when I start up the bot and when I try to message it, I am using mattermost 3.9.0 with your docker-compose setup. Any suggestions on what might be causing this?

On startup:

hubot-matteruser_1  | [Sat Jun 10 2017 12:50:36 GMT+0000 (UTC)] INFO Logged in as user "jarvis" but not connected yet.
hubot-matteruser_1  | [Sat Jun 10 2017 12:50:37 GMT+0000 (UTC)] INFO Connecting...
hubot-matteruser_1  | [Sat Jun 10 2017 12:50:37 GMT+0000 (UTC)] ERROR Failed to load profiles from server.
hubot-matteruser_1  | [Sat Jun 10 2017 12:50:37 GMT+0000 (UTC)] INFO Error: [object Object]
hubot-matteruser_1  | [Sat Jun 10 2017 12:50:37 GMT+0000 (UTC)] ERROR Failed to get subscribed channels list from server.
hubot-matteruser_1  | [Sat Jun 10 2017 12:50:37 GMT+0000 (UTC)] INFO Error: [object Object]
hubot-matteruser_1  | [Sat Jun 10 2017 12:50:37 GMT+0000 (UTC)] INFO Connected to Mattermost.

When direct messaging:

ERROR TypeError: Cannot set property 'dm_channel_id' of undefined
hubot-matteruser_1  |   at Matteruser.message (/usr/src/hubot-matteruser/node_modules/hubot-matteruser/src/matteruser.coffee:182:11, <js>:261:31)
hubot-matteruser_1  |   at Client.<anonymous> (/usr/src/hubot-matteruser/node_modules/hubot-matteruser/src/matteruser.coffee:1:1, <js>:5:61)
hubot-matteruser_1  |   at emitOne (events.js:77:13)
hubot-matteruser_1  |   at Client.emit (events.js:169:7)
hubot-matteruser_1  |   at Client.onMessage (/usr/src/hubot-matteruser/node_modules/hubot-matteruser/node_modules/mattermost-client/src/client.coffee:212:17, <js>:283:23)
hubot-matteruser_1  |   at WebSocket.<anonymous> (/usr/src/hubot-matteruser/node_modules/hubot-matteruser/node_modules/mattermost-client/src/client.coffee:159:13, <js>:222:22)
hubot-matteruser_1  |   at emitTwo (events.js:87:13)
hubot-matteruser_1  |   at WebSocket.emit (events.js:172:7)
hubot-matteruser_1  |   at Receiver.ontext (/usr/src/hubot-matteruser/node_modules/hubot-matteruser/node_modules/mattermost-client/node_modules/ws/lib/WebSocket.js:841:10)
hubot-matteruser_1  |   at /usr/src/hubot-matteruser/node_modules/hubot-matteruser/node_modules/mattermost-client/node_modules/ws/lib/Receiver.js:536:18
hubot-matteruser_1  |   at Receiver.applyExtensions (/usr/src/hubot-matteruser/node_modules/hubot-matteruser/node_modules/mattermost-client/node_modules/ws/lib/Receiver.js:371:5)
hubot-matteruser_1  |   at /usr/src/hubot-matteruser/node_modules/hubot-matteruser/node_modules/mattermost-client/node_modules/ws/lib/Receiver.js:508:14
hubot-matteruser_1  |   at Receiver.flush (/usr/src/hubot-matteruser/node_modules/hubot-matteruser/node_modules/mattermost-client/node_modules/ws/lib/Receiver.js:347:3)
hubot-matteruser_1  |   at Receiver.opcodes.1.finish (/usr/src/hubot-matteruser/node_modules/hubot-matteruser/node_modules/mattermost-client/node_modules/ws/lib/Receiver.js:541:12)
hubot-matteruser_1  |   at Receiver.expectHandler (/usr/src/hubot-matteruser/node_modules/hubot-matteruser/node_modules/mattermost-client/node_modules/ws/lib/Receiver.js:499:31)
hubot-matteruser_1  |   at Receiver.add (/usr/src/hubot-matteruser/node_modules/hubot-matteruser/node_modules/mattermost-client/node_modules/ws/lib/Receiver.js:103:24)
hubot-matteruser_1  |   at TLSSocket.realHandler (/usr/src/hubot-matteruser/node_modules/hubot-matteruser/node_modules/mattermost-client/node_modules/ws/lib/WebSocket.js:825:20)
hubot-matteruser_1  |   at emitOne (events.js:77:13)
hubot-matteruser_1  |   at TLSSocket.emit (events.js:169:7)
hubot-matteruser_1  |   at readableAddChunk (_stream_readable.js:153:18)
hubot-matteruser_1  |   at TLSSocket.Readable.push (_stream_readable.js:111:10)
hubot-matteruser_1  |   at TLSWrap.onread (net.js:540:20)

My package.json is configured for:

"name": "hubot-matteruser",
"version": "3.9.0",

Thanks

Not clear how to use this

Hi,

I setup the bot as per the instructions and the logs say that everything looks okay. And at regular intervals I see the following messages also

INFO ping
INFO ACK ping

Now, I am unable to figure out how to use the bot and what triggers any actions. Nothing happen when I DM the bot or if I do an @ mention of the bot in a channel.

Any hints of how to actually make the bot useful?

Question about external scripts

I'm able to get hubot up and running have a couple scripts that are working like youtube, etc.
but any scripts that don't need a token will not work.
I'm not sure if I'm missing something.

I have writen a shell file
that runs hubot and external scripts

export HUBOT_YOUTUBE_API_KEY="secret"
any help would be great

Question

I was wondering if matteruser works with outgoing web hooks.

I'm trying to get hubot to listen on all channels with out having to invite to a channel.
The channels I'm looking to do this on are all public channels.
I've tried creating a web hook and adding it into my export cmds in shell script, but
can't seem to get anywhere.

Outgoing hook for public channels
Content-Type: application/x-www-form-urlencoded
Trigger Words: bot
Trigger When: First word matches a trigger word exactly
Token: secret
Callback URLs: http://localhost:8080/bot/incoming

HUBOT UNABLE TO POST MESSAGE TO MATTERMOST DYNAMIC CHANNEL UNLESS RESTART

Hi Team,

I could observe that the messages posted to the new dynamically created mattermost channel does not reflect unless the hubot service is restarted

Steps to reproduce the issue:

  1. Create a channel dynamically
  2. Post message to channel from HUBOT - does not display the message in the channel
  3. Post the message again after restart of Hubot - now displays message in the channel

Seems like the newly created dynamically channel is not discovered by hubot .

Please look into it and advice.

Thanks in advance.

Thanks,
Suraj S

Matteruser fails to log in

I'm a bit new to linux and using hubot.
I'm currently trying to get up and running hubot with matteruser adapter and I'm not sure if I'm way off with trying to configure it to work.

On a virtual machine
I've setup a user and password for the robot in Mattermost
Then I've created shell script.

!/bin/sh

export MATTERMOST_HOST=http/127.0.0.1:8065
export MATTERMOST_GROUP=internal
export MATTERMOST_USER=gizmo
export MATTERMOST_PASSWORD=secret

cd /home/spike/myhubot
bin/hubot --adapter matteruser > /var/log/hubot.log 2>&1

log file shows

Fri Oct 14 2016 10:08:30 GMT-0700 (PDT)] INFO Logging in...
[Fri Oct 14 2016 10:08:31 GMT-0700 (PDT)] ERROR Login call failed
[Fri Oct 14 2016 10:08:31 GMT-0700 (PDT)] INFO Reconnecting in 1000ms
[Fri Oct 14 2016 10:08:32 GMT-0700 (PDT)] INFO Attempting reconnect

Any help would be great

Question - Using Behind a Proxy

Hi,

This is not really a bug report, but a question about how to use this bot behind a proxy to reach the mattermost server.

-Renjith

Does MATTERMOST_WSS_PORT not function?

When the port number of the server is not 443, the adapter is not connected even if MATTERMOST_WSS_PORT is set.
I tried it with 8443 and 8065.

Thank you for awesome product!

enter and leave doesn't work

When using enter and leave to make the bot react on these events,

robot.enter (res) ->
    res.send res.random enterReplies
  robot.leave (res) ->
    res.send res.random leaveReplies

I get the following error:

ERROR TypeError: Cannot read property 'toLowerCase' of undefined
  at Brain.userForName (xxxx\basic\node_modules\hubot\src\brain.coffee:120:17, <js>:106:23)
  at Matteruser.send (xxxx\basic\node_modules\hubot-matteruser\src\matteruser.coffee:101:16, <js>:160:31)
  at runAdapterSend (xxxx\basic\node_modules\hubot\src\response.coffee:82:34, <js>:87:50)
  at allDone (xxxx\basic\node_modules\hubot\src\middleware.coffee:44:37, <js>:34:16)
  atxxxx\basic\node_modules\async\lib\async.js:274:13
  at Object.async.eachSeries (xxxx\basic\node_modules\async\lib\async.js:142:20)
  at Object.async.reduce (xxxx\basic\node_modules\async\lib\async.js:268:15)
  at xxxx\basic\node_modules\hubot\src\middleware.coffee:49:7, <js>:37:22
  at _combinedTickCallback (internal/process/next_tick.js:67:7)
  at process._tickCallback (internal/process/next_tick.js:98:9)

It looks like it is the same problem than #32

Doesn't work

I have been trying to get this up an running for the past three days now. I have tried both Mattermost 3.3 and 3.2. I am able to get the bot logged into the rooms as seen with the green icons over the username, however none of the actions work. For example if I run it with the shell adapter it works perfectly. But using the matteruser adapter does not. It looks like the bot just sits there in the chat. I would really like to get this setup. I have used the regular web hook mattermost adapter and been successful with that. Below is a debug of the last instance I had running:

$ bin/hubot -a matteruser
[Mon Aug 22 2016 22:08:10 GMT-0400 (EDT)] INFO Logging in...
[Mon Aug 22 2016 22:08:10 GMT-0400 (EDT)] DEBUG POST /users/login
[Mon Aug 22 2016 22:08:10 GMT-0400 (EDT)] INFO Websocket URL: ws://mattermost.kregloh.com:443/api/v3/users/websocket
[Mon Aug 22 2016 22:08:10 GMT-0400 (EDT)] INFO Logged in as user "vina3" but not connected yet.
[Mon Aug 22 2016 22:08:10 GMT-0400 (EDT)] DEBUG GET /users/initial_load
[Mon Aug 22 2016 22:08:10 GMT-0400 (EDT)] DEBUG Found 2 teams.
[Mon Aug 22 2016 22:08:10 GMT-0400 (EDT)] DEBUG Testing bots == bots
[Mon Aug 22 2016 22:08:10 GMT-0400 (EDT)] DEBUG Found team! wox7dqdyat8zdbb58a147c6cgr
[Mon Aug 22 2016 22:08:10 GMT-0400 (EDT)] DEBUG GET /users/profiles/wox7dqdyat8zdbb58a147c6cgr
[Mon Aug 22 2016 22:08:10 GMT-0400 (EDT)] DEBUG GET /teams/wox7dqdyat8zdbb58a147c6cgr/channels/
[Mon Aug 22 2016 22:08:10 GMT-0400 (EDT)] INFO Connecting...
[Mon Aug 22 2016 22:08:10 GMT-0400 (EDT)] INFO Error: Error: connect ENOENT
[Mon Aug 22 2016 22:08:10 GMT-0400 (EDT)] INFO Reconnecting in 1000ms
[Mon Aug 22 2016 22:08:10 GMT-0400 (EDT)] DEBUG Found 4 channels.
[Mon Aug 22 2016 22:08:10 GMT-0400 (EDT)] DEBUG Found 2 profiles.
[Mon Aug 22 2016 22:08:11 GMT-0400 (EDT)] INFO Attempting reconnect
[Mon Aug 22 2016 22:08:11 GMT-0400 (EDT)] INFO Logging in...
[Mon Aug 22 2016 22:08:11 GMT-0400 (EDT)] DEBUG POST /users/login
[Mon Aug 22 2016 22:08:12 GMT-0400 (EDT)] INFO Websocket URL: ws://mattermost.kregloh.com:443/api/v3/users/websocket
[Mon Aug 22 2016 22:08:12 GMT-0400 (EDT)] INFO Logged in as user "vina3" but not connected yet.
[Mon Aug 22 2016 22:08:12 GMT-0400 (EDT)] DEBUG GET /users/initial_load
[Mon Aug 22 2016 22:08:12 GMT-0400 (EDT)] DEBUG Found 2 teams.
[Mon Aug 22 2016 22:08:12 GMT-0400 (EDT)] DEBUG Testing bots == bots
[Mon Aug 22 2016 22:08:12 GMT-0400 (EDT)] DEBUG Found team! wox7dqdyat8zdbb58a147c6cgr
[Mon Aug 22 2016 22:08:12 GMT-0400 (EDT)] DEBUG GET /users/profiles/wox7dqdyat8zdbb58a147c6cgr
[Mon Aug 22 2016 22:08:12 GMT-0400 (EDT)] DEBUG GET /teams/wox7dqdyat8zdbb58a147c6cgr/channels/
[Mon Aug 22 2016 22:08:12 GMT-0400 (EDT)] DEBUG Found 4 channels.
[Mon Aug 22 2016 22:08:12 GMT-0400 (EDT)] DEBUG Found 2 profiles.

hubot unresponsive in channel after upgrade

After upgrading hubot to a more recent matteruser driver, the bot stopped replying to channel mentions, but still responds when sent a DM.

"hubot-matteruser": "4.2.0",
"mattermost-client": "4.2.0",

using 3.9.1 and 3.9.0 the bot replies as expected.

This is all taking place on mattermost 4.1.0

Using debugging I can see that Hubot receives my message and schedules a reply, but the reply never comes to the channel

Err403 on websocket URLs triggering reconnections?

We've been observing issues with Hubot getting locked out of our Mattermost server (see xurizaemon/bolts#25). What happens seems to be this:

  • Hubot logs in as expected.
  • Something triggers Hubot to reconnect (more on this below)
  • Hubot starts reconnecting at intervals (even though it's connected)
  • Mattermost detects the high number of authentication attempts and locks Hubot (MaximumLoginAttempts in MM config.json?)

Mattermost Version: 4.7.1 (4.7.3) (https://chat.civicrm.org) and 4.9.1-rc1 (https://oss.mattermost.com). I see the repeat logins occur when testing on oss.mattermost.com, but I haven't yet seen the lockout behaviour (guessing diff values of MaximumLoginAttempts on the servers).

I've managed to trace my way through and identify that after a successful login, I see an HTTP403 response when mattermost-client requests the websocket.

When using Mattermost via desktop browser I see this request, with the same URL, get an HTTP101 and upgrade to wss. The wss URL is wss://oss.mattermost.com:443/api/v4/websocket. After this I see

error Error: unexpected server response (403)

Here's where I hit the limits of my JS debugging and get speculative (I know, I know). I suspect this triggers mattermost-client to re-initialise the websocket connection and repeat login, which makes Mattermost increment its login counter and leads to the lockout.

My aim in reporting this is (1) to ensure it is on your radar if we're hitting a real issue in the MM adapter, and (2) to ask for guidance in debugging further. I'll update if I'm able to track it down any further!

Bot doesn't respond in Mattermost 3.5

Bot seems to log in fine, but doesn't seem to recognize message posts. I'm using hubot-matteruser v3.5.0. I added a console.log message to the onMessage event in mattermost-client/src/client.coffee to see if I could figure anything out. Here's what I get when logging in and doing a @hubot ping on 3.4 where everything works fine:

[Thu Nov 17 2016 16:50:16 GMT-0700 (MST)] INFO Logging in...
[Thu Nov 17 2016 16:50:16 GMT-0700 (MST)] DEBUG POST /users/login
[Thu Nov 17 2016 16:50:16 GMT-0700 (MST)] INFO Websocket URL: wss://$HOST:443/api/v3/users/websocket
[Thu Nov 17 2016 16:50:16 GMT-0700 (MST)] INFO Logged in as user "$BOTNAME" but not connected yet.
[Thu Nov 17 2016 16:50:16 GMT-0700 (MST)] DEBUG GET /users/initial_load
[Thu Nov 17 2016 16:50:16 GMT-0700 (MST)] DEBUG Found 2 teams.
[Thu Nov 17 2016 16:50:16 GMT-0700 (MST)] DEBUG Testing $TEAMNAME == $TEAMNAME
[Thu Nov 17 2016 16:50:16 GMT-0700 (MST)] DEBUG Found team! $TEAM
[Thu Nov 17 2016 16:50:16 GMT-0700 (MST)] DEBUG GET /teams/$TEAM/users/0/1000
[Thu Nov 17 2016 16:50:16 GMT-0700 (MST)] DEBUG GET /teams/$TEAM/channels/
[Thu Nov 17 2016 16:50:16 GMT-0700 (MST)] INFO Connecting...
[Thu Nov 17 2016 16:50:16 GMT-0700 (MST)] ERROR Failed to load profiles from server.
[Thu Nov 17 2016 16:50:16 GMT-0700 (MST)] INFO Error: [object Object]
[Thu Nov 17 2016 16:50:16 GMT-0700 (MST)] INFO Connected to Mattermost.
[Thu Nov 17 2016 16:50:17 GMT-0700 (MST)] INFO Starting pinger...
{ team_id: '',
  channel_id: '',
  user_id: '$USERID',
  event: 'status_change',
  data: { status: 'online' } }
{ team_id: '',
  channel_id: '',
  user_id: '$USERID',
  event: 'hello',
  data: { server_version: '3.4.0.3.4.0.5f09928bad05fdc89cd815300a0e12c0' } }
[Thu Nov 17 2016 16:50:17 GMT-0700 (MST)] DEBUG Received unhandled message type: hello
[Thu Nov 17 2016 16:50:17 GMT-0700 (MST)] DEBUG { team_id: '',
  channel_id: '',
  user_id: '$USERID',
  event: 'hello',
  data: { server_version: '3.4.0.3.4.0.5f09928bad05fdc89cd815300a0e12c0' } }
[Thu Nov 17 2016 16:50:18 GMT-0700 (MST)] INFO hubot-redis-brain: Using default redis on localhost:6379
{ team_id: '',
  channel_id: '$CHANNELID',
  user_id: '$USERID',
  event: 'typing',
  data: { parent_id: '' } }
{ team_id: '$TEAM',
  channel_id: '$CHANNELID',
  user_id: '$USERID',
  event: 'posted',
  data: 
   { channel_display_name: '$CHANNELNAME',
     channel_type: 'O',
     mentions: '["$USERID"]',
     post: '{"id":"$POSTID","create_at":1479426624236,"update_at":1479426624236,"delete_at":0,"user_id":"$USERID","channel_id":"$CHANNELID","root_id":"","parent_id":"","original_id":"","message":"@$BOTNAME ping","type":"","props":{},"hashtags":"","filenames":[],"pending_post_id":"$USERID:1479426624226"}',
     sender_name: 'wernicke.lanl',
     team_id: '$TEAM' } }
[Thu Nov 17 2016 16:50:24 GMT-0700 (MST)] DEBUG POST /teams/$TEAM/channels/$CHANNELID/posts/create
[Thu Nov 17 2016 16:50:24 GMT-0700 (MST)] DEBUG Posted message.
{ team_id: '$TEAM',
  channel_id: '$CHANNELID',
  user_id: '$USERID',
  event: 'posted',
  data: 
   { channel_display_name: '$CHANNELNAME',
     channel_type: 'O',
     post: '{"id":"$POSTID","create_at":1479426624270,"update_at":1479426624270,"delete_at":0,"user_id":"$USERID","channel_id":"$CHANNELID","root_id":"","parent_id":"","original_id":"","message":"PONG","type":"","props":{},"hashtags":"","filenames":[],"pending_post_id":""}',
     sender_name: '$BOTNAME',
     team_id: '$TEAM' } }
[Thu Nov 17 2016 16:50:47 GMT-0700 (MST)] INFO ping
{ status: 'OK',
  seq_reply: 1,
  data: 
   { node_id: '',
     server_time: 1479426647486,
     text: 'pong',
     version: '3.4.0' } }
[Thu Nov 17 2016 16:50:47 GMT-0700 (MST)] INFO ACK ping

Here's what I get when doing a @hubot ping on 3.5:

[Thu Nov 17 2016 16:51:29 GMT-0700 (MST)] INFO Logging in...
[Thu Nov 17 2016 16:51:29 GMT-0700 (MST)] DEBUG POST /users/login
[Thu Nov 17 2016 16:51:29 GMT-0700 (MST)] INFO Websocket URL: wss://$HOST:443/api/v3/users/websocket
[Thu Nov 17 2016 16:51:29 GMT-0700 (MST)] INFO Logged in as user "$BOTNAME" but not connected yet.
[Thu Nov 17 2016 16:51:29 GMT-0700 (MST)] DEBUG GET /users/initial_load
[Thu Nov 17 2016 16:51:30 GMT-0700 (MST)] DEBUG Found 2 teams.
[Thu Nov 17 2016 16:51:30 GMT-0700 (MST)] DEBUG Testing $TEAMNAME == $TEAMNAME
[Thu Nov 17 2016 16:51:30 GMT-0700 (MST)] DEBUG Found team! $TEAM
[Thu Nov 17 2016 16:51:30 GMT-0700 (MST)] DEBUG GET /teams/$TEAM/users/0/1000
[Thu Nov 17 2016 16:51:30 GMT-0700 (MST)] DEBUG GET /teams/$TEAM/channels/
[Thu Nov 17 2016 16:51:30 GMT-0700 (MST)] INFO Connecting...
[Thu Nov 17 2016 16:51:30 GMT-0700 (MST)] INFO Connected to Mattermost.
[Thu Nov 17 2016 16:51:30 GMT-0700 (MST)] INFO Starting pinger...
{ event: 'hello',
  data: { server_version: '3.5.0.3.5.0.977864ec83b61ac2f656306d140e5909' },
  broadcast: 
   { omit_users: null,
     user_id: '$USERID',
     channel_id: '',
     team_id: '' } }
[Thu Nov 17 2016 16:51:30 GMT-0700 (MST)] DEBUG Received unhandled message type: hello
[Thu Nov 17 2016 16:51:30 GMT-0700 (MST)] DEBUG { event: 'hello',
  data: { server_version: '3.5.0.3.5.0.977864ec83b61ac2f656306d140e5909' },
  broadcast: 
   { omit_users: null,
     user_id: '$USERID',
     channel_id: '',
     team_id: '' } }
{ event: 'status_change',
  data: { status: 'online', user_id: '$USERID' },
  broadcast: 
   { omit_users: null,
     user_id: '$USERID',
     channel_id: '',
     team_id: '' } }
[Thu Nov 17 2016 16:51:30 GMT-0700 (MST)] DEBUG Found 223 profiles.
[Thu Nov 17 2016 16:51:31 GMT-0700 (MST)] INFO hubot-redis-brain: Using default redis on localhost:6379
[Thu Nov 17 2016 16:52:00 GMT-0700 (MST)] INFO ping
{ status: 'OK',
  seq_reply: 1,
  data: 
   { node_id: '',
     server_time: 1479426720670,
     text: 'pong',
     version: '3.5.0' } }
[Thu Nov 17 2016 16:52:00 GMT-0700 (MST)] INFO ACK ping

Map me Preview

I recently installed hubot with the matteruser adapter. All works fine, but not the maps preview.

In your Readme-Example the bot response is just one image link.

If I ask my bot to map me sth. I get a response with 2 links, the "real" link (for which there is no preview available) and the image link (ending in "format=png").

Did you tweak your hubot for the example, so it only returns the image link or I am doing sth wrong here?

Here you have an example (link preview is activated in Mattermost):
unbenannt

After asking to Mattermost devs they said :

Hubot should really embed that image using markup and make the image link to the map. Might be worth opening an issue on that repo.

I am just not sure if this is an issue of matteruser or hubot....

Is it possible to send direct messages to users?

Greetings,

Thanks a lot for this adapter!

I'm trying to send direct messages from our hubot to users, based on user id. However, I can't get it working.

I've tried robot.messageRoom(user_id, "message"), since it looks like that'll set envelope.room to the user's ID, but that doesn't work and I'm not sure it even would.

Any ideas?

thanks!

bot cannot ignore message from other bots in one channel

I invite two bots into one channel in same team, the bot cannot ignore messages from other bots
Steps to reproduce:

  1. invite two bots (bot1, bot2) into one channel.
  2. @BOT1 {message}
  3. bot1 reply message
  4. bot2 will receive message which reply from bot1

Expected result:
bot2 ignore messages from other bot1

No response to channel

Hi,

The adapter is able to add user successfully.

On issuing command from chat window - it shows the debug message as below but no feedback back to room. No matching like executing listener.

DEBUG Message {
event: 'posted',
data:
{ channel_display_name: 'Town Square',
channel_name: 'town-square',
channel_type: 'O',
post: '{"id":"3m3fzaragffymytc8b1zfa4amc","create_at":1510742604875,"update_at":1510742604875,"edit_at":0,"delete_at":0,"is_pinned":false,"user_id":"4h449hxdxtygddog1d14shfohy","channel_id":"han17huxebfufbed5fdoeowd3h","root_id":"","parent_id":"","original_id":"","message":"matteruser help","type":"","props":{},"hashtags":"","pending_post_id":"4h449hxdxtygddog1d14shfohy:1510742582275"}',
sender_name: 'chatops',
team_id: 'i84af7shmjgojchfom6xs9xq6y' },
broadcast:
{ omit_users: null,
user_id: '',
channel_id: 'han17huxebfufbed5fdoeowd3h',
team_id: '' },
seq: 3 }

`loggedIn` overrides bot name provided via `hubot --name NAME ...`

This line in loggedIn sets robot.name to the auth username:

@robot.name = @self.username

This overrides a value set via hubot --name NAME ....

Should that be a bug? It is for me, at least. At my company we use a corporate LDAP for auth to our Mattermost team. I want the bot to respond to the name "bot", but the access account given me by our operations team is "joybot2". In my copy of hubot-matteruser I remove this line (via this patch: https://gist.github.com/trentm/3decef3c09278b18863744759693af20).

I'm not sure if you'd consider this a bug for this project. Just removing this line would potentially (likely?) break existing users, so either you'd want to make it opt-in or do a major version bump.

Thanks for the library!

Not possible to use several groups/teams?

Hi,

Would it be possible to make a multi-instance script, where groups could be separated by a coma for instance?

Currently, we can have only 1 group/team per hubot instance. We use different teams in our organization and we would like to be able to have hubot user for all groups (even if we have to change variable each time).

Feature request: OAuth2

Is there any way to implement OAuth2 support. I'm unable to use matteruser as our mattermost instance is daisy chained with Oauth2

Can't login

Hi!

I'm trying to configure the bot.

Here's the things I've already done:

  1. Matter is running on a self-signed certificate;
  2. hubot is running locally for tests (plan to deploy using heroku);
  3. I can run bin/hubot without any adapter;
  4. matter is bundled with gitlab;
  5. I can login with the specific user that I created for the bot in matter. It's configured to sign in using email and password, not SSO;

I'm getting a generic "Login Call failed" message, as this:

bin/hubot -a matterusernpm 
WARN prefer global [email protected] should be installed with -g
[Fri Aug 12 2016 15:10:51 GMT-0300 (BRT)] INFO Logging in...
[Fri Aug 12 2016 15:10:51 GMT-0300 (BRT)] DEBUG POST /users/login
[Fri Aug 12 2016 15:10:52 GMT-0300 (BRT)] ERROR Login call failed
[Fri Aug 12 2016 15:10:52 GMT-0300 (BRT)] INFO Reconnecting in 1000ms
[Fri Aug 12 2016 15:10:53 GMT-0300 (BRT)] INFO Attempting reconnect
[Fri Aug 12 2016 15:10:53 GMT-0300 (BRT)] INFO Logging in...
[Fri Aug 12 2016 15:10:53 GMT-0300 (BRT)] DEBUG POST /users/login
[Fri Aug 12 2016 15:10:53 GMT-0300 (BRT)] ERROR Login call failed
[Fri Aug 12 2016 15:10:53 GMT-0300 (BRT)] INFO Reconnecting in 2000ms

My env vars are configured as this, inside my .bashrc

export MATTERMOST_HOST="matter.mydomain.com.br" # i get there usually by going to https://matter.mydomain.com.br
export MATTERMOST_GROUP="core"
export MATTERMOST_USER="<user registration email>"
export MATTERMOST_PASSWORD="<pwd>"

Any help?

Support MatterMost 3.0

Could you please help to upgrade it to support Mattermost 3.0? The current one only work for Mattermost 2.x

Regarding the 'slack-attachment' event - how to pass channelID

We are calling the 'slack-attachment' event from the other hubot module to show message in the mattermost channel. We know only the channel name but in the slackAttachmentMessage method this is expecting channel ID so is it possible to include the channel name to channel ID logic inside the slackAttachmentMessage method itself.

Please help on this issue

Mattermost moving to API version 4

Hey @loafoe!

Cross-posting my note in loafoe/mattermost-client#31 over here too. Big thanks for sharing this project!


I wanted to let you know about our plans moving to API v4:

To make the Mattermost API web service easier to use and to offer more powerful options for these integrations, Mattermost will be moving to a new API version soon. Highlights include:

  • Fully documented API endpoints
  • More in-depth access to server functionality
  • Wider use of established HTTP verbs
  • Consistent endpoint structures
  • A new and improved Go driver

We plan to release API version 4 on March 16th, with Mattermost server 3.7. While the current API version 3 will be supported until September 16th, we recommend you begin using API version 4 soon after its release.

Contributing

API version 4 is an active and on-going project. If you're interested in helping contribute, please join our Mattermost community instance and the APIv4 channel.

We've prepared a contribution process for APIv4 and a progress tracker for new APIv4 enpoints to help you get started.

We're also open for suggestions on adding new API endpoints to help with your integration.

@hubot mentions should work

this would give similar functionality to what is seen with slackbot in slack. from what I've read searching around for this, the slack adapter supports this. With some guidance, I can probably tackle this as my first foray into hubot development.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.