get https://api.gomotive.com/v2/messages/
Purpose: Use this API to fetch a list of all the messages sent by a user. Note that you can use the query parameters to narrow down the messages that you want to fetch for the sender. Refer to the Query Parameters section for more info.
require 'uri'
require 'net/http'
require 'json'
url = URI('https://api.gomotive.com/v2/messages')
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request['Authorization'] = "Bearer <OAUTH_TOKEN>"
request['Content-Type'] = 'application/json'
params = {
:sender_id => 1645,
:receiver_ids => [1591],
}
request.body = params.to_json
response = http.request(request)
puts response.read_body
Response Parameters
message
- Type: Object
- Description: Contains the details of a message.
sent_at
- Type: String
- Description: The timestamp when the message was sent.
id
- Type: String
- Description: The unique identifier for the message, including its protocol and ID.
sender_id
- Type: Number
- Description: The unique identifier of the user who sent the message.
receiver_ids
- Type: Array of Numbers
- Description: A list of unique identifiers for the users who received the message.
body
- Type: String
- Description: The content or text of the message.
attachment
- Type: Object | Null
- Description: Contains the attachment details if present, otherwise null.
location
- Type: Object
- Description: Contains the location details associated with the message, if any.
status
- Type: String
- Description: The current status of the message (e.g., "read").