-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add MatterMost remote #508
base: main
Are you sure you want to change the base?
Conversation
Adds a basic mattermost remote to handle recieving webhook events and posting messages with the API.
thanks for the PR and apologies for the delay, i will give it a look in the coming days. also, looking to test it on a real or fake mattermost instance |
No worries @wass3rw3rk stuff happens and I've had PRs sit idle for longer. This did work with that local mattermost development container, but it didn't work with my company's MatterMost. We use the version packaged with Gitlab Omnibus and it's a pain to test against because it is in a sandbox environment. I don't know if it is our configuration or an issue with how I'm using the websocket library, but I would get a panic when trying to connect. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got a local version of Mattermost stood up with Docker and things worked pretty well. A couple of notes below.
Thanks again for the patience.
// instantiate a new mattermost client. | ||
func (c *Client) new() *model.Client4 { | ||
log.Info().Msgf("%#v", c) | ||
api := model.NewAPIv4Client("http://" + c.Server) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
presumably server is not typically on http
but https
? should the expectation be to provide a FQDN for the MATTERMOST_SERVER
configuration item?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, it probably should default to https
.
I'd like to keep the ability to set MATTERMOST_SERVER
as a bare IP address, if for no other reason than testing.
What's the best way to allow the user to connect over http
if that's what they want? An optional MATTERMOST_SECURE_PROTOCOL
variable or something like that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think i would default to secure: https
+ wss
and add a flag like you said. maybe inverse though, something like MATTERMOST_USE_INSECURE
or MATTERMOST_LOCAL
? not sure if local
is the only use-case, so maybe the former?
c.BotID = user.Username | ||
} | ||
|
||
sock, err := model.NewWebSocketClient4("ws://"+c.Server, c.Token) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to previous comment, I presume this would be wss:
for most installations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep I'll update that. It might be the issue I'm seeing with my work instance.
MATTERMOST_CHANNEL= | ||
MATTERMOST_USERNAME= |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these seem to be unused? is this for future work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I added them expecting them to be needed but never got around to using them. They might be nice in the future, but I'll remove them until/unless I find a need.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds good - thank you
Proposed change
Adds a basic mattermost remote to handle receiving webhook events and posting messages with the API.
Should resolve #97
Types of changes
What types of changes is this pull request introducing to flottbot? Put an
x
in the boxes that applyChecklist
You can fill this out after creating your PR. Put an
x
in the boxes that applyTesting
To test I used the docker image and add user script from the MM bot example repo https://github.com/mattermost-community/mattermost-bot-sample-golang