post https://api.gomotive.com/v2/messages
Purpose: Use this API to send a bulk message to multiple recipients or users in your company. This API allows you to quickly communicate important updates to your drivers, or managers.
NOTE
To send a bulk messages to multiple recipients, you must use the following values as "Query Parameters".
- sender_id
- receiver_id OR receiver_ids
- body
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::Post.new(url)
request['Authorization'] = "Bearer <OAUTH_TOKEN>"
request['Content-Type'] = 'application/json'
params = {
:sender_id => 12345,
:receiver_ids => [67890],
:body => "Hi, this is a test message"
}
request.body = params.to_json
response = http.request(request)
puts response.read_body
Response Parameters
message
- Type: Object
- Description: Contains the details of a single message.
sent_at
- Type: String
- Description: The timestamp when the message was sent.
id
- Type: String
- Description: The unique identifier for the message.
sender_id
- Type: Number
- Description: The unique identifier of the user who sent the message.
recipient_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
- Description: Contains the attachment details if present.
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., "sent").