Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No markdown support #7

Open
xMTinkerer opened this issue Dec 6, 2016 · 0 comments
Open

No markdown support #7

xMTinkerer opened this issue Dec 6, 2016 · 0 comments

Comments

@xMTinkerer
Copy link

xMTinkerer commented Dec 6, 2016

the messages post endpoint allows for a markdown option. It would be great to add this as a parameter to the sendMessage function.
It looks like it would just need to be a change this:

  send: (user, message, room) ->
    @robot.logger.debug "Sending message"
    @room_ids.forEach (room_id) =>
      @robot.logger.debug "send message to room #{room_id} with text #{message}"
      @spark.sendMessage
        roomId: room_id
        text: message

to something like

  send: (user, message, room, markdownText) ->
    @robot.logger.debug "Sending message"
    @room_ids.forEach (room_id) =>
      @robot.logger.debug "send message to room #{room_id} with text #{message}"
      @spark.sendMessage
        roomId: room_id
        text: message
        markdown: markdownText

Or would it make sense to pass the desired payload straight through? Something like:

  send: (user, payload, room) ->
    @robot.logger.debug "Sending message"
    @room_ids.forEach (room_id) =>
      @robot.logger.debug "send message to room #{room_id} with text #{message}"
      @spark.sendMessage payload

Where payload is:

var payload = {
  "text": "Some text here",
  "files": ["http://www.example.com/images/media.png"]
}

or

var payload = {
  "markdown": "Some `markdown` text **here**"
}

I'm not sure if that would mess with the generic adapter though?
Thoughts?

Edit: Formatting fixes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant