Developer documentation

API Documentation

Reference material and integration guides for the Relational Manager API.

Ruby Integration

Example POST /v1/score using Faraday.

Prereqs

  • RI_API_KEY (string)
  • BASE_URL (string), default https://www.relationalmanager.com/api
  • gem install faraday
require "faraday"
require "json"

base_url = ENV.fetch("BASE_URL", "https://www.relationalmanager.com/api")
api_key = ENV.fetch("RI_API_KEY")

payload = {
  lenses: [1, 4],
  persist: false,
  message: {
    message_id: "m2",
    conversation_id: "c1",
    text: "I'm not sure this will work.",
    channel_type: "chat",
    channel_id: "support",
    sender_id: "u2",
    sender_type: "user",
    lang: "en",
    timestamp: "1716561012",
  },
  previous_message: {
    message_id: "m1",
    conversation_id: "c1",
    text: "We can try a few options.",
    channel_type: "chat",
    channel_id: "support",
    sender_id: "u1",
    sender_type: "agent",
    lang: "en",
    timestamp: "1716560950",
  }
}

conn = Faraday.new(url: base_url)
response = conn.post("/v1/score") do |req|
  req.headers["Authorization"] = "Bearer #{api_key}"
  req.headers["Content-Type"] = "application/json"
  req.body = JSON.generate(payload)
end

puts "#{response.status} #{response.headers["x-request-id"]}"
puts response.body

Lens Aggregates, Indicators and Traffic Lights

Lens results include weighted score, scoring_coverage, and traffic_light; questions include question and scoring_status.

Use each question's indicator_name, score, scoring_status, and traffic_light for UI dials. The signal uses the parent lens ranges, while internal metric details remain private.

The lens prescriptions array contains prioritized guidance for yellow/red signals and is empty for green.

response = conn.put("/v1/lenses/1/traffic-light-ranges") do |req|
  req.headers["Authorization"] = "Bearer #{api_key}"
  req.headers["Content-Type"] = "application/json"
  req.body = JSON.generate(traffic_light_ranges: {
    red: { min: -1.0, max: -0.2 }, yellow: { min: -0.2, max: 0.4 },
    green: { min: 0.4, max: 1.0 }
  })
end

The update key requires org:write; inspect scoring_status for zero-valued questions.