Method: MatrixSdk::Protocols::CS#send_message

Defined in:
lib/matrix_sdk/protocols/cs.rb

#send_message(room_id, message, **params) ⇒ Response

Send a plaintext message to a room

Parameters:

  • room_id (MXID, String)

    The room ID to send the message to

  • message (String)

    The message to send

  • params (Hash)

    Options for the request

Options Hash (**params):

  • :msg_type (String) — default: 'm.text'

    The message type to send

Returns:

  • (Response)

    A response hash with the parameter :event_id

See Also:



414
415
416
417
418
419
420
# File 'lib/matrix_sdk/protocols/cs.rb', line 414

def send_message(room_id, message, **params)
  content = {
    msgtype: params.delete(:msg_type) { 'm.text' },
    body: message
  }
  send_message_event(room_id, 'm.room.message', content, params)
end