post https://api.gomotive.comhttps://api.gomotive.com/v1/messages?recipient_id=&body=
Purpose: Use the following API to send a message to a user or a driver. You must specify the recipient ID of the
user or the driver to send the message. Also, specify the message or an attachment that you would like
to send to the user.
require 'uri'
require 'net/http'
require 'json'
url = URI('https://api.gomotive.com/v1/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['X-User-Id'] = <api user id>
request['Content-Type'] = 'application/json'
params = {
:recipient_id => <user id>,
:status => 'read',
:body => 'hello',
}
request.body = params.to_json
response = http.request(request)
puts response.read_body
Response Parameters
success
- Type: Boolean
- Description: Dentes if the message was sent. In most cases, the bool value for the parameter 'success" will be "true". It wil not be false. In case the sending of the message has failed. you will the corresponding error message.