It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

xmpp htmlText

I'm writing an xmpp bot in scala I am unable to send an xmpp message to display a notification. I was unable to find any documentation in regards to hipchats custom stanzas. I am using smack 4.1.7

Here is the message I see when I send a notif via curl:
<message 
to='17702_2503775@chat.hipchat.com/bot||proxy|pubproxy-d300.hipchat.com|5262
from='17702_testbot@conf.hipchat.com/BuildBot' type='groupchat'>

<body><pre>hello world</pre></body>

<x xmlns='http://hipchat.com/protocol/muc#room'>
<message_format>html</message_format>
<color>yellow</color>
<type>system</type>
<notify>0</notify>
</x>

<html xmlns='http://jabber.org/protocol/xhtml-im'>
<body xmlns='http://www.w3.org/1999/xhtml'>
<pre>hello world</pre>
</body>
</html>
</message>

So I constructed and sent this message:
<message 
to='17702_testbot_1@conf.hipchat.com
id='rHeL8-678' 
type='groupchat'>

<body><pre>hello world</pre></body>

<x xmlns='http://hipchat.com/protocol/muc#room'>
<message_format>html</message_format>
<color>yellow</color>
<type>system</type>
<notify>0</notify>
</x>
<html xmlns='http://jabber.org/protocol/xhtml-im'>
<body xmlns='http://www.w3.org/1999/xhtml'>
<pre>hello world</pre>
</body>
</html>
</message>

1 answer

0 votes
rich Atlassian Team Jun 02, 2016

HipChat does support xhtml-im for 1-1 conversations. Here's an example stanza:

&lt;message to='10804_51380@chat.hipchat.com' id='325323535' type='chat'&gt;
  &lt;body&gt;Unstyled message&lt;/body&gt;
  &lt;html xmlns='http://jabber.org/protocol/xhtml-im'&gt;
    &lt;body xmlns='http://www.w3.org/1999/xhtml'&gt;
      &lt;p&gt;
        Styled message&lt;br/&gt;
        &lt;a href='a'&gt;https://google.com'&gt;a link&lt;/a&gt;&lt;br/&gt;
        &lt;b&gt;&amp;lt;b&amp;gt;&lt;/b&gt; and &lt;strong&gt;&amp;lt;strong&amp;gt;&lt;/strong&gt; and &lt;em&gt;&amp;lt;em&amp;gt;&lt;/em&gt; and &lt;i&gt;&amp;lt;i&amp;gt;&lt;/i&gt; and &lt;code&gt;&amp;lt;code&amp;gt;&lt;/code&gt;&lt;br/&gt;
        &lt;pre&gt;
console.log('Hello Vito!')
        &lt;/pre&gt;
        &lt;span style='color:red'&gt;This is red&lt;/span&gt;
        &lt;table&gt;
          &lt;thead&gt;
            &lt;tr&gt;
              &lt;th&gt;a&lt;/th&gt;
              &lt;th&gt;b&lt;/th&gt;
              &lt;th&gt;c&lt;/th&gt;
            &lt;/tr&gt;
          &lt;/thead&gt;
          &lt;tbody&gt;
            &lt;tr&gt;
              &lt;td&gt;d&lt;/td&gt;
              &lt;td&gt;e&lt;/td&gt;
              &lt;td&gt;f&lt;/td&gt;
            &lt;/tr&gt;
          &lt;/tbody&gt;
        &lt;/table&gt;
        &lt;ul&gt;
          &lt;li&gt;1&lt;/li&gt;
          &lt;li&gt;2&lt;/li&gt;
          &lt;li&gt;3&lt;/li&gt;
        &lt;/ul&gt;
        &lt;ol&gt;
          &lt;li&gt;1&lt;/li&gt;
          &lt;li&gt;2&lt;/li&gt;
          &lt;li&gt;3&lt;/li&gt;
        &lt;/ol&gt;
        &lt;hc-mention&gt;@rich&lt;/hc-mention&gt;
        &lt;hc-mention&gt;@vito&lt;/hc-mention&gt;&lt;br/&gt;
        &lt;img src='https://cdn.meme.am/instances/57918848.jpg' alt='meme' height='50' width='50' align='right' style='border:1px;solid:red' /&gt;&lt;br/&gt;
        &lt;span style='text-decoration:line-through'&gt;redacted&lt;/span&gt;
      &lt;/p&gt;
    &lt;/body&gt;
  &lt;/html&gt;
&lt;/message&gt;

One thing to note is for this to work, your styled body needs to be inside the html>body>p tag.

@rich Why not suport them for mucs?? Especially when you already have a notif that pretty much already does that. Honestly I just want to display preformatted text in a monospace font.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Hipchat

Hipchat Cloud and Stride have reached End of Life (updated)

All good things come to an end - thanks to all our customers and partners who have been along the Hipchat and Stride journey with us.  As of Feb 15th 2019, Hipchat Cloud and Stride have reached ...

35,188 views 9 8
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you