Mattermost, Inc.

[SOLVED] Interactive Message Buttons

From the documentation
we can see that they show the way to add an update
The integration can respond with an update to the original post, or with an ephemeral message:
But where to add this ?
{
“update”: {
“message”: “Updated!”
},
“ephemeral_text”: “You updated the post!”
}

Hi shekharkoirala,

The interactive buttons are defined with an url per action and some context, when you click in the action, the server call the url with the context information and the userId. You need to have an endpoint to manage that information and reply with that data. {“update”: {“message”: “Updated!”}} or {“ephemeral_text”: “You updated the post!”}

Thanks for the details OP. Glad to know about it.

hi jespino ,
I created a button by this

{
 "name": "Button Name",
 "integration": {
            "url": "http://my_ip/getmessage",
            "context": {
            "action": "action_trigger_name"
            }

and a flask app to capture the action. It is captured but
while calling this function

@app.route("/getmessage",methods=["POST"]) 
def afunction(value):
      payload = {
        "channel": "testchannel",
        "username": "lunch-bot",
        "response_type": "ephemeral",
        "icon_url": "a url",
        "text" : "some text"
      } 
      url = 'incoming webhooks url'
      headers = {'content-type': 'application/json'}
      r = requests.post(url, data = json.dumps(payload) , headers = headers)

It post the data
But it is not ephemeral ( only visible to you )
so , i am not getting what i want.

Hi @shekharkoirala, just following up on this - has this been resolved or are you still having trouble with interactive message buttons? If you need further assistance I will ask one of our engineers to take a look.

return jsonify(ephemeral_text=‘Your response has been updated.’)

thanks @jespino for the edt months ago. it is solved by using above return method on the callback URL.

it is possible to create something similar but with Hubot and the actions of the buttons?