Developer documentation

API Documentation

Reference material and integration guides for the Relational Manager API.

Node.js Integration

Example POST /v1/score using the built-in fetch (Node.js 18+).

Prereqs

  • RI_API_KEY (string)
  • BASE_URL (string), default https://www.relationalmanager.com/api
const baseUrl = process.env.BASE_URL || "https://www.relationalmanager.com/api";
const apiKey = process.env.RI_API_KEY;

const 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",
  },
};

async function main() {
  const res = await fetch(`${baseUrl}/v1/score`, {
    method: "POST",
    headers: {
      "Authorization": `Bearer ${apiKey}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify(payload),
  });

  const data = await res.json();
  console.log(res.status, res.headers.get("x-request-id"), data);
}

main().catch((err) => {
  console.error(err);
  process.exit(1);
});

Lens Aggregates, Indicators and Traffic Lights

Read lens_name, weighted score, scoring_coverage, and traffic_light. Questions include question and scoring_status; a zero may be unscored.

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.

lens.prescriptions contains prioritized question guidance for yellow/red lenses; green lenses return an empty list.

await fetch(`${baseUrl}/v1/lenses/1/traffic-light-ranges`, {
  method: "PUT",
  headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json" },
  body: JSON.stringify({ traffic_light_ranges: {
    red: { min: -1.0, max: -0.2 },
    yellow: { min: -0.2, max: 0.4 },
    green: { min: 0.4, max: 1.0 }
  }})
});

The key used for this PUT must contain org:write.