I’m attempting to use interactive message dropdown menus to make selections as a response to a slash command. I’ve tried following the documentation on interactive messages and even using their 3-option example copied over exactly (aside from the URL), I’m seeing no response from the Mattermost server. When I use any buttons in an interactive message, they work just fine. How are the option menus supposed to work? It was my understanding that the user would select an option from the menu, and Mattermost will make a request to the server, just as it would when a button is pressed, with the selected option in context. When I select an option from the menu, however, nothing happens.
There are no errors in the console, no failed requests, the Mattermost server appears to be doing nothing when I make a selection in the interactive message menu. When I use a button from an interactive message, everything functions as expected and my integration is able to process the request. Anyone know why this is or how to make it work?
Thanks!
Hello @MartinPJones! I’m sorry to hear that you’re having issues.
To better understand what is going on, I do have a couple of questions:
- Is your Mattermost log level set to
DEBUG
? - Could you provide an example of what is supposed to happen when a user clicks a button (ex. add user to channel)
- Are you using the REST API to the local server to make the requests on button click?
Hi! Yes, the log level is set to debug, but no logs appear regarding the issue. When a user clicks any option from the menu, Mattermost is supposed to send the option clicked back to my integration server. As detailed in the documentation, mattermost should send a JSON response with a context
field containing a selected option
entry. I am using the REST API to send the interactive message to Mattermost, and providing it the return URL in this call as the docs say I should.
That’s interesting, do you see any errors in the Chrome Dev console when the requests are made and if you manually make the request, does it work?
Having exactly the same behavior. Looks like a bug though.
I was planned to implement some helpful tooling for my team, but failed =)
How do we create a bugs? Im a newcomer here
Thanks for the idea. Just checked: have errors in chrome console.
For some reason, it tries to POST to the “posts/<post_id>”. Also, I use docker - maybe something is wrong with the network (it tries to reach 172.18.0.2. AllowedUntrustedInternalConnections is set to allow this, btw)
websocket_client.jsx:35 websocket connecting to ws://SERVER/api/v4/websocket
/api/v4/posts/e3ohd9rpmj8o9qg14odqaxnraw/actions/action_options:1 Failed to load resource: the server responded with a status of 404 (Not Found)
/api/v4/posts/e3ohd9rpmj8o9qg14odqaxnraw/actions/action_options:1 Failed to load resource: the server responded with a status of 404 (Not Found)
main.fa0bf9e0a29a45463849.js:229 POST http://SERVER/api/v4/posts/e3ohd9rpmj8o9qg14odqaxnraw/actions/action_options 404 (Not Found)
t.default @ main.fa0bf9e0a29a45463849.js:229
{“level”:“debug”,“ts”:1608804178.9417171,“caller”:“web/web.go:66”,“msg”:“not found handler triggered”,“path”:"/api/v4/posts/ib965df3djdkmepkcistie96ko/actions/action_options",“code”:404,“ip”:“172.18.0.2”}
I use the sample from the mattermost docs, replacing the integration url:
{“response_type”: “in_channel”, “text”: “qqqq”, “attachments”: [
{
“pretext”: “This is the attachment pretext.”,
“text”: “This is the attachment text.”,
“actions”: [
{
“id”: “action_options”,
“name”: “Select an option…”,
“integration”: {
“url”: “http://<ip_address>/hooks/action_options”,
“context”: {
“action”: “do_something”
}
},
“type”: “select”,
“options”: [
{
“text”: “Option1”,
“value”: “opt1”
},
{
“text”: “Option2”,
“value”: “opt2”
},
{
“text”: “Option3”,
“value”: “opt3”
}
]
}
]
}
]
}
I think I am beginning to understand where the issue may be at. Could you format the debug and code outputs you provided using the three backticks ```
before and after the code and error log sections so that it is a bit easier to read? I would really appreciate it, thank you!
I too am having this same issue, but I discovered something interesting. The “id” has to equal the root of the path in the “url”. In @yovgen case, he would need
"actions": [
{
"id": "hooks",
"integration": {
"url": "http://<ip_address>/hooks/action_options",
"context": {
"action": "do_something"
}
},
"type": "select"
...
}
]
This is the only way that I could get Mattermost to post a response to my integration. Message Buttons thankfully do not work this way.
Despite it seems as freaking magic, it works perfectly. Thanks a lot and have a nice day!
It is due to having -
and _
in action id.
It produces error:
{"timestamp":"2023-03-10 17:15:07.193 +03:00","level":"debug","msg":"not found handler triggered","caller":"web/web.go:63","path":"/api/v4/posts/jcfw7zog1tf8bewxb11dqot5ue/actions/commit-9c734571d5f60b4401ff9119f069880adcfb67f6","code":404,"ip":"172.17.10.1"}
I have several actions in one attachments, actions having -
or _
has trigger errors
Hi @akuzia and welcome to the Mattermost forums!
Thanks for sharing this link and I can confirm that I also stumbled upon this issue some time ago, thanks for reminding me to send in an update for the documentation which I’ve done just now