I’m assembling a bot with hubot and mattermost and I wanted to know if there is the possibility that hubot can perform actions through the interactive buttons of mattermost so that the user doesn’t need to type the command.
I have not been able to make requests through the action buttons given through an example I have prepared.
Is this the one you are using: https://github.com/renanvicente/hubot-mattermost? If yes, it might be best to directly contact the maintainers / creators of the bot as they might be most familiar with your question!
module.exports = (robot) ->
robot.respond /give me an attachment/i, (res) ->
envelope =
username: 'TheBoss'
channel: res.envelope.room
icon_url: 'http://www.someiconfarm.com/theboss.png'
attachments: [
color: "#000080"
text: "Here's a blue one."
fallback: "Here's a blue one that you can't see."
]
robot.send envelope, "Message with attachments"
Essentially, what my changes to the adapter do is let you set more properties on the envelope that you pass to robot.send. The original adapter only respected properties on envelope that affected the channel to which the response was sent.
What I did shouldn’t break other things, but it might have some odd interactions in cases where code was passing an envelope to send, because the old adapter would ignore anything in the envelope except .room and .user.room.
If you see things in my code that you think you need to change, please feel free to send me a PR on github.
Now I get it to show correctly just like the example I did with the renanvicente connector.
But, I have the same problem I indicated. I cannot associate actions of the attachment buttons to execute commands on hubot or Mattermost’s custom slash commands.