Send a message to a user

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.

Query Params
int32
required

Specify the Id of the user to whom you are sending this message.

string
required

Enter the body of the message that you are sending to your user.

Headers
string

Specify the timezone for formatting the timestamps.

boolean

Specify if you want to use the Metric units or the Imperial units. TRUE: Metric units. FALSE: Imperial Units

int32

Specify the ID of the user who is accessing this endpoint.

Responses

Language
Credentials
Header
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json