3

This question discusses sending messages with node-xmpp: Connecting to Google Talk over XMPP on Node.js

Anyone know how to get an HTML formatted message. The library they are using escapes the HTML in a node module called ltx.

Community
  • 1
  • 1
Justin Thomas
  • 5,680
  • 3
  • 38
  • 63

1 Answers1

5

See XEP-0071. Make sure your HTML is valid XML (XHTML), then embed like this:

<message>
  <body>Wow, I&apos;m green with envy!</body>
  <html xmlns='http://jabber.org/protocol/xhtml-im'>
    <body xmlns='http://www.w3.org/1999/xhtml'>
      <p style='font-size:large'>
        <em>Wow</em>, I&apos;m <span style='color:green'>green</span>
        with <strong>envy</strong>!
      </p>
    </body>
  </html>
</message>

Note that the plain text is also included for clients that can't render XHTML.

Joe Hildebrand
  • 10,354
  • 2
  • 38
  • 48