Skip to main content

Call history

A compact list of recent calls with one phone number, with direction icons and AI-generated summaries. Use it beside a customer or patient record, or in a screen-pop panel when a call comes in.

Usage​

TypeScript
import { CallHistory } from '@dialstack/sdk-react/call-history';

function CustomerPanel({ phoneNumber }: { phoneNumber: string }) {
return <CallHistory phoneNumber={phoneNumber} />;
}
Phone number required

Set the phone number (the phoneNumber prop or setPhoneNumber()) in E.164 format, such as +14155551234. Without it the component shows an error state.

Options​

These are specific to call history. The common options (locale, formatting, icons, layout variant, classes, load callbacks) apply too.

React propWeb Component methodTypeDefaultDescription
phoneNumbersetPhoneNumber(number)stringRequiredPhone number to show history for (E.164)
limitsetLimit(limit)number5Maximum number of calls to show (1–20)
displayOptionssetDisplayOptions(options)CallHistoryDisplayOptions—Show or hide parts of each row (see below)
classessetClasses(classes)CallHistoryClasses—Extra CSS classes (see Styling)

CallHistoryDisplayOptions​

OptionTypeDefaultDescription
showDurationbooleantrueShow the call's length
showRelativeTimebooleantrueShow relative times such as "2 min ago", "Yesterday"
showDirectionIconbooleantrueShow the inbound/outbound/missed/voicemail icon
TypeScript
<CallHistory
phoneNumber="+14155551234"
limit={10}
displayOptions={{
showDuration: true,
showRelativeTime: true,
showDirectionIcon: true,
}}
/>

Call types and icons​

TypeIcon colorMeaning
Inbound (completed)GreenAn incoming call was answered
Outbound (completed)BlueAn outgoing call connected
MissedRedAn incoming call wasn't answered
VoicemailPurpleThe caller left a voicemail

AI summaries​

For completed inbound and outbound calls and for voicemails, each row shows an AI-generated summary of the conversation under an "AI Summary" badge, so you can see what was discussed without listening to a recording. Summaries appear automatically; there is nothing to configure.

Styling​

classes adds your own CSS class names to parts of the component, which is useful with a utility framework such as Tailwind. For colors, fonts and spacing, see Theming.

KeyApplied to
baseContainer, in every state
loadingContainer while loading
errorContainer in the error state
emptyThe "no calls" message
listList container
itemEach call
itemInboundAn inbound call
itemOutboundAn outbound call
itemMissedA missed call
itemVoicemailA call that went to voicemail
iconDirection icon
timeTime
durationDuration
TypeScript
<CallHistory
phoneNumber="+14155551234"
classes={{ list: 'divide-y', itemMissed: 'border-l-4 border-red-500' }}
/>

Complete example​

TypeScript
import { CallHistory } from '@dialstack/sdk-react/call-history';

function CustomerDetailPanel({ customer }: { customer: Customer }) {
if (!customer.phone) {
return <p>No phone number on file</p>;
}

return (
<div className="rounded-lg bg-white p-4 shadow">
<h2 className="mb-4 text-lg font-semibold">Recent calls</h2>
<CallHistory
phoneNumber={customer.phone}
limit={5}
layoutVariant="comfortable"
formatting={{ dateLocale: 'en-US', use24HourTime: false }}
classes={{ item: 'rounded-md hover:bg-gray-50' }}
onLoadError={(event) => {
console.error('Failed to load call history:', event.error);
}}
/>
</div>
);
}

Next steps​