Search code examples
mattermost

Response from interactive button POST is ignored in Mattermost


I'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 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?


Solution

  • I misunderstood how Mattermost works in this case. You can't handle a POST from Mattermost and return another interactive button, because Mattermost doesn't evaluate the response body. You have to make a request to the API (or a Webhook) to continue.