Skip to content

Getting Started

Quick start

Create a minimal opportunity cycle and confirm read/write path against the ComeBk API.

  • Getting Started
  • 1 min read

Goal

In under an hour you should:

  1. Authenticate against your tenant
  2. Create one opportunity in a defined cycle stage
  3. Read it back with explainability metadata present

1. Authenticate

import { ComeBkClient } from '@comebk/sdk'

const client = new ComeBkClient({
  baseUrl: process.env.COMEBK_API_BASE_URL!,
  tenantId: process.env.COMEBK_TENANT_ID!,
  token: process.env.COMEBK_API_TOKEN!,
})

const session = await client.auth.verify()
console.log(session.tenantId, session.scopes)

2. Create an opportunity

const opportunity = await client.opportunities.create({
  name: 'Sample commercial facility',
  stage: 'qualify',
  channel: 'relationship',
  borrowerSegment: 'mid-market',
})

Use stage and channel values that exist in your tenant’s cycle configuration. See Core concepts.

3. Read with decision context

const detail = await client.opportunities.get(opportunity.id, {
  include: ['stageHistory', 'explanations'],
})

console.log(detail.stage, detail.explanations)

If explanations is empty, confirm the tenant has explainability enabled for that stage and that your token includes the opportunities:read scope.

4. Clean up (evaluation tenants)

await client.opportunities.archive(opportunity.id)

Related reading