StackStorm / hubot-stackstorm

Hubot plugin for integration with StackStorm event-driven infrastructure automation platform.
Apache License 2.0
49 stars 39 forks source link

Support for "Button attachments" #151

Closed SURAJTHEGREAT closed 6 years ago

SURAJTHEGREAT commented 6 years ago

I am not able to send the message with button attachments. If I send simple message{non-attachment message} its working fine. If i send message with extra param from the stackstorm the message is not getting displayed in the channel.

If I have changed the line 137 in post_data.js under lib folder from attachments: content to attachments: content.attachments ? content.attachments : content then the button gets displayed.

Please help on this issue. Is this a right fix

message from stackstorm

action:
  ref: chatops.post_message
  parameters:
    channel: "bq97zw96ypnrjp15h9ey4bhu5o"
    #channel: "#town-square"
    message: "Trying button action"
    extra:
      color: "#ff0000"
      mattermost:
           attachments:
                 - pretext: "This is the attachment pretext."
                   text: "This is the attachment text."
                   actions:
                      - name: "Ephemeral Message"
                        integration:
                              url: "https://x.x.x.x/hubot/buttonaction"
                              context:
                                  action: "do_something_ephemeral"
                      - name: "Update"
                        integration:
                              url: "https://x.x.x.x/hubot/buttonaction"
                              context:
                                  action: "do_something_update"
arm4b commented 6 years ago

Without digging into the code, logically your code suggestion looks safe.

Can you open a PR with mentioned changes in post_data.js? Someone will review it and hopefully that would be included in hubot-stackstorm.

SURAJTHEGREAT commented 6 years ago

@armab : We are facing error remote: Permission to StackStorm/hubot-stackstorm.git denied to SURAJTHEGREAT. when trying to git pull the repository. Could you please provide access for the same.

arulvelu21 commented 6 years ago

@armab : We have created fork method as well to create a pull request. Currently it is showing in pull request under the heading "Button attachement fix for mattermostuser" . But the build Travis CI is getting failed.Please assist.

arm4b commented 6 years ago

Implemented in https://github.com/StackStorm/hubot-stackstorm/pull/152