Method: ChatWork::Client::MessageMethods#create_message

Defined in:
lib/chatwork/client/message_methods.rb

#create_message(room_id:, body:, self_unread: false) {|response_body, response_header| ... } ⇒ Hashie::Mash

Add new message to the chat

Examples:

response format

{
  "message_id": "1234"
}

Parameters:

  • room_id (Integer)
  • body (String)

    message body

  • self_unread (Boolean) (defaults to: false)

    Whether to add the added message as unread by looking at it from myself

Yields:

  • (response_body, response_header)

    if block was given, return response body and response header through block arguments

Yield Parameters:

  • response_body (Hashie::Mash)

    response body

  • response_header (Hash<String, String>)

    response header (e.g. X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset)

Returns:

  • (Hashie::Mash)

See Also:



55
56
57
# File 'lib/chatwork/client/message_methods.rb', line 55

def create_message(room_id:, body:, self_unread: false, &block)
  post("/rooms/#{room_id}/messages", body: body, self_unread: boolean_to_integer(self_unread), &block)
end