Skip to content
This repository has been archived by the owner on Jun 30, 2022. It is now read-only.

Support for background colors in Hipchat messages #7

Open
esigler opened this issue Apr 11, 2014 · 8 comments
Open

Support for background colors in Hipchat messages #7

esigler opened this issue Apr 11, 2014 · 8 comments

Comments

@esigler
Copy link
Contributor

esigler commented Apr 11, 2014

So, Hipchat has the ability to have messages with alternate background colors (red, green, yellow, etc), which can be very helpful for quickly visually indicating message content. (See https://www.hipchat.com/docs/api/method/rooms/message for examples).

Via only XMPP, this is not currently possible. (See http://help.hipchat.com/forums/138883-suggestions-issues/suggestions/2974079-support-xhtml-im-send-text-only-notifications-to).

As an additional gotcha, when using HTML-formatted API-sent messages, Hipchat features such as @mentions don't work properly, so by default we wouldn't want to send only HTML-formatted messages.

@jimmycuadra
Copy link
Collaborator

I'd very much like this ability. It's unfortunate how much Atlassian has been dragging on it. :\

@apsoto
Copy link

apsoto commented Oct 24, 2014

I've prototyped this using the hipchat gem. Works well in my limited testing. Would be nice to somehow have the option to send a message as an API html message via some config option or extension.

However, seems to me that unless the plugin author also sends HTML responses, I don't see much utility beyond changing background color.

It seems as if the framework needs to provide the ability for plugin providers to send regular text and rich html messages as message replies and the adapter chooses the appropriate one for it. For example, the shell adapter would have no need for html output, but hipchat and others would.

@jimmycuadra
Copy link
Collaborator

@josqu4red and I have discussed this before and imagined something similar to what you describe.

The big open question is what the format for the rich text should be, since each chat service will have different capabilities and different syntax. If Lita were to provide a generic "rich text version of the message" mechanism, it would need to have some sort of markup format that would represent the lowest common denominator, and then each adapter would need to convert that format into their own chat service's syntax.

The other possibility is that handlers directly target specific chat services so they know the formatting in advance, but this would require some degree of code duplication if a handler wanted to support rich text for more than one chat service.

I'm not sure what the answer is at the moment, but it's definitely a desirable feature.

@josqu4red
Copy link

The problem is that the lowest common denominator is basically nil :) take IRC colors and Slack's rich-formated messages.
Targeting specific adapters in handlers is probably the best way to do this. That's the tradeoff for a multiplatform tool.
I tried it by passing a optional hash of formated messages to send_messages but a dedicated method could be better.

@apsoto
Copy link

apsoto commented Oct 24, 2014

I've hijacked this thread....but :)
one idea that pops to mind is the Rails pattern for view templates.

For example

HANDLER.ROUTE.ADAPTER.erb
HANDLER = registered handler class name
ROUTE = the method name symbol passed to #route
ADAPTER = the adapter name (hipchat, slack, shell, etc)

The message sent is a hash of context variables to use in a template, otherwise fall back to old behavior which is a text message

Handler authors can provide response templates, but existing ones continue to work sending plain text

@jimmycuadra
Copy link
Collaborator

Interesting idea! For the sake of not losing this discussion, would you mind opening an issue on the main Lita project? We can discuss further there without cluttering up this issue.

@sjernigan
Copy link

So the templating is now available and works. But my html message just shows the markup. Has anyone worked out the format of a hipchat HTML message?

@adrianchinghc
Copy link

@jimmycuadra Is it possible to send to Hipchat a HTML message with this templating feature? I've tried it with no luck. Anyone?

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

No branches or pull requests

6 participants