@girik/cti
v1.1.0
Published
Girik CTI (Computer Telephony Integration) Node/TypeScript SDK — telephony, calls, CDR, recordings, and real-time call events for the Girik Communication platform.
Maintainers
Readme
@girik/cti
Node/TypeScript SDK for the Girik Communication CTI (Computer Telephony Integration) platform — telephony, call control, CDR, recordings, and real-time call events. This is the reference SDK (Phase 1); other language SDKs port its object model.
Scope: core CTI. See
docs/SDK-FEATURES.mdfor the full feature list anddocs/SDK-LOGIC-AND-FLOW.mdfor architecture and flows.
Install
npm install @girik/ctiRequires Node ≥ 18 (native fetch/WebSocket).
Quick start
import { Girik } from '@girik/cti';
const girik = new Girik({ baseUrl: 'https://cti.girikon.ai' });
// Authenticate (or pass { auth: { token } } to the constructor)
await girik.auth.signin('[email protected]', 'secret');
// Softphone click-to-dial: mint a browser Voice token
const { token, identity } = await girik.telephony.getVoiceToken();
// Pull data (lists are normalized to a Page<T>)
const logs = await girik.callLogs.list({ page: 1, limit: 50 });
// Live call control
await girik.telephony.hold({ cdrId, hold: true });
await girik.telephony.transfer({ transferTo, parentCallSid });
// Real-time events (auto-joins org/user rooms)
girik.realtime.connect();
girik.realtime.on('call:connected:broadcast', (p) => console.log(p));Auth modes
new Girik({ baseUrl, auth: { token: jwt } }); // pre-obtained JWT
new Girik({ baseUrl, auth: { apiKey: KEY } }); // x-api-key (third-party surface)
new Girik({ baseUrl, auth: { getToken: () => jwt } }); // dynamic / refreshableResources
| Namespace | Purpose |
|---|---|
| girik.auth | signin/signup/password, token management |
| girik.telephony | voice token, call/hold/cancel/transfer, numbers, agents, missed calls |
| girik.calls | call-record CRUD |
| girik.callLogs | historical call logs (paginated) |
| girik.cdr | call detail records, legs, AI re-analysis (regenerate) |
| girik.recordings | metadata + audio streaming |
| girik.webhooks | outbound webhook config + delivery logs |
| girik.realtime | Socket.IO call events |
Errors
All API errors extend GirikApiError (.status, .body, .code): AuthError, AuthExpiredError, ForbiddenError, ValidationError, NotFoundError, ConflictError, RateLimitError, TelephonySyncError (502 — record not saved). Network/timeouts throw GirikTransportError.
Develop
npm install
npm run typecheck
npm run build # tsup → dist (ESM + CJS + d.ts)