Skylar-Tech / node-red-contrib-matrix-chat

Matrix chat server support for Node-RED
GNU General Public License v3.0
33 stars 11 forks source link

HTML messages are missing plain text part #92

Open sgofferj opened 1 year ago

sgofferj commented 1 year ago

I noticed that when sending an HTML messages with this module, the HTML source appears in the notification on Element Android. I think, the message might not be generated properly. HTML messages should still contain the plain text like this:

{
  "msgtype":"m.text",
  "body":"PLAIN TEXT",
  "format":"org.matrix.custom.html",
  "formatted_body":"HTML SOURCE"
}

When I send a message with CURL like this, the Android notification contains the plain text and the chat message appears as rendered HTML. I haven't done a deep-dive into the source code but I assume you put the HTML source also in the body item?

skylord123 commented 1 year ago

Have you tried using the msg.formatted_payload input option for send message? With that you set msg.payload to the plain text version and msg.formatted_payload to the HTML version. Otherwise it uses msg.payload for both which may not be the best case..

We may need to update it so if you send an HTML message you must specify both.

sgofferj commented 1 year ago

Ah, I haven't. There's no input field for that, so I kinda missed that it's available.