Skip to content

Call log and client timeline ​

Record calls and notes on a client, and show everything that happened to it.

Log a call ​

ts
export async function logCall(clientId: number, text: string) {
  return staff.clients.createComments(clientId, {
    kind: "call",
    call_result: "successful",
    important: true,
    text,
  });
}

kind is note (default), record, call or auto; call_result (no_answer, wrong_number, not_interested, successful) only with call.

The timeline ​

ts
export async function timeline(clientId: number) {
  const [client, comments, changes] = await Promise.all([
    staff.clients.retrieve(clientId),
    staff.clients.listComments(clientId),
    staff.clients.history(clientId), // journal: who changed what, before and after
  ]);
  return { client, comments, changes };
}

Merge comments and changes by time to render one feed. Documents live under clients.listDocuments / clients.createDocuments.