[SOLVED] Simple slash command 404

I’m trying to setup a simple slash command from MM to Gitlab but am getting a 404 response.

  • I’ve setup a trigger in gitlab that allows me to build branches.
  • I can send a POST request that kicks it off via postman. This works successfully.
  • I setup a slash command in MM with the request url being the same url I used in postman.

What I’m confused about are the tokens. I have two of them. One for the trigger in Gitlab. And one from the MM slash command. Currently I’m just using the trigger one and simply trying to POST with the same postman tested url as before. So not using the MM slash command token anywhere.

#confused

Question #2 is how do I pass in an argument? Branch name for eg. I’m assuming that’s what the auto complete hint is for? If so, how do I reference that in the request url? [branch] == $branch ?

Ideally I’d like to be able to call my command /whatever dev and have it kick off a dev branch build

Edit for question #2: I found this: [SOLVED] Passing slash command parameters so it looks like I can’t pass args in for query params. Bummer.

I don’t think you can connect the slash-command directly to the gitlab trigger the way you are trying to, because the payload of the slash command is different to what the Gitlab trigger expects. You need to put a small shim in between - an easy way to do this would be either a script behind a webserver in your scripting language of choice, or if you prefer, something like an AWS lambda function, that receives the Slash command from Mattermost, extracts what you need from the payload, and calls to the Gitlab trigger with the correct payload for that.

Yeah I ended up just writing a node.js app to handle all communication. Sorry I’m new to all this.

Do you happen to know of a way to make the response only show up for the user that types the slash command? Right now when it responds everyone in the channel it was typed in gets the response… which for my command isn’t desirable.

Nevermind. I found docs finally for it.

response_type: ephemeral