Response from interactive button POST is ignored

'm building a slash command. The flow I imagine is:

  1. User triggers slash command in client
  2. My server handles request and returns interactive dropdown
  3. User selects option from dropdown in client
  4. My server handles the POST request from the selection and returns an interactive button
  5. User presses the button

Something seems to go wrong between steps 4 and five. The server handles the selection and returns the desired response:

{ 
  "update": {"message": "Updated!"}, 
  "ephemeral_text": "You updated the post!", 
  "attachments": [{
    "text": "Ready?", "actions": [{
      "name": "Go!", 
      "integration": {
        "url": "https://somewhere.com?foo=bar",
        "context": {"action": "event_submitted"}
      }
    }]
  }]
}

…but nothing shows up in the client.

Is something wrong with that JSON? I have tried other things like only returning a text message.

I’ve set log level to DEBUG and don’t find anything suspicious there.

I wonder, if I have misunderstood the docs and the client will never even evaluate a response from a POST triggered by an interactive message. In that case I would have to make a new request back from my server to the Mattermost API in order to get to the next step in my workflow. Is that correct?

I have asked the same question on StackOverflow, but no answers yet.

What mattermost api endpoint do you use to send this message?

It’s not an API endpoint. The original trigger is a slash command. The part that fails is between 3 and 4 (see above).

client will never even evaluate a response from a POST triggered by an interactive message

Pardon, I misread this.

From what I got, Mattermost controls do requests and doesn’t handle anything these requests return.
Right now we use custom integration service which transforms info it gets from buttons into the valid mattermost api call.

1 Like

Thanks a lot for confirming!

I think the docs here could really do a better job of explaining this.

The integration can respond with an update to the original post, or with an ephemeral message

It would be helpful to mention that this “response” would be a separate API call, not an http response.

Yep, I completely agree, documentation is really vague about it.

Hello @alex_enyway and @xlorken - I’m updating the docs was wondering if you had any comments we should add to this page/link: https://github.com/mattermost/docs/pull/2874

I’ve replaced The integration can respond with an update to the original post, or with an ephemeral message with The integration can then perform a separate API call with an update to the original post, or with an ephemeral message:

Happy to address any other issues or add tips that will make it easier for others.

Hey @aaronrothschild, Yeah that sounds like a very good idea. Thanks for your work there!

Maybe you could mention in a more prominent place that the Mattermost server will never evaluate response bodies from requests coming from Mattermost controls. I didn’t find that anywhere in the docs and there is no warning in the logs. Your suggested edit is a step in the right direction, but it might still be overlooked. And for me it was a pretty frustrating experience to find that out by trial and error - and @xlorken’s help of course.

How about a listing of the different kinds of integrations and whether the server will evaluate response bodies or not?
Slash Commands - Yes
Incoming Webhooks - Yes
POSTs from interactive controls - No

I’ve created a PR for the doc change and have added a table with the different integration types. It would be great if you could add some more context, I’ve also asked one of our developers to review this. Thanks for your help, and sorry about the frustrations you encountered!

Hey @aaronrothschild, that looks pretty good to me. Although I don’t know what I was thinking when mentioning incoming webhooks. That’s a request, not a response and I think everyone knows that the server evaluates the request body as otherwise they’d be useless. Outgoing webhooks on the other hand should be mentioned. I haven’t tried them though and would have no idea, whether their responses would be evaluated.