Method: SelfSDK::MessagingClient#send_custom

Defined in:
lib/messaging.rb

#send_custom(recipient, request_body) ⇒ Object

Send custom mmessage

Parameters:

  • recipient (string)

    selfID to be requested

  • type (string)

    message type

  • request (hash)

    original message requesing information

[View source]

96
97
98
99
100
101
102
103
104
105
# File 'lib/messaging.rb', line 96

def send_custom(recipient, request_body)
    @to_device = @client.devices(recipient).first
    send_message msg = Msgproto::Message.new(
      type: Msgproto::MsgType::MSG,
      id: SecureRandom.uuid,
      sender: "#{@jwt.id}:#{@device_id}",
      recipient: "#{recipient}:#{@to_device}",
      ciphertext: @jwt.prepare(request_body),
    )
end