Method: MatrixSdk::Room#send_html

Defined in:
lib/matrix_sdk/room.rb

#send_html(html, body = nil, msg_type = 'm.text') ⇒ Object

Sends a custom HTML message to the room

Parameters:

  • html (String)

    the HTML message to send

  • body (String, nil) (defaults to: nil)

    a plain-text representation of the object (Will default to the HTML with tags stripped away)

  • msg_type (String) (defaults to: 'm.text')

    A message type for the message

See Also:



183
184
185
186
187
188
189
190
191
192
# File 'lib/matrix_sdk/room.rb', line 183

def send_html(html, body = nil, msg_type = 'm.text')
  content = {
    body: body || html.gsub(/<\/?[^>]*>/, ''),
    msgtype: msg_type,
    format: 'org.matrix.custom.html',
    formatted_body: html
  }

  client.api.send_message_event(id, 'm.room.message', content)
end