listAppointments
This interface retrieves upcoming appointments from the connected CRM so they can be displayed within App Connect's appointment panel. It is called whenever a user opens or refreshes the appointments view.
Input parameters
| Parameter | Description |
|---|---|
user |
An object describing the Chrome extension user associated with the action that triggered this interface. |
authHeader |
The HTTP Authorization header to be transmitted with the API request to the target CRM. |
range |
(Optional) An object with startTime and endTime ISO-8601 strings defining the window of appointments to fetch. |
mineOnly |
(Optional) Boolean. When true, return only appointments owned by the current user. |
Return value(s)
An object with the following property:
| Parameter | Description |
|---|---|
appointments |
An array of appointment objects. |
Appointment object
| Property | Type | Description |
|---|---|---|
id |
string | The unique identifier of the appointment in the CRM. |
thirdPartyAppointmentId |
string | Same as id — the CRM's native ID for the appointment. |
title |
string | The appointment title or subject. |
description |
string | Notes or body text for the appointment. |
startTimeUtc |
string | ISO-8601 UTC timestamp of the appointment start time. |
durationMinutes |
number | Duration of the appointment in minutes. |
status |
string | Current status. Typically "scheduled", "cancelled", or "confirmed". |
contactId |
string | ID of the primary contact associated with the appointment (empty string if none). |
attendees |
array | Array of attendee objects, each with id, name, and type. |
Example
return {
appointments: [
{
id: "12345",
thirdPartyAppointmentId: "12345",
title: "Intake call with Jane Smith",
description: "Initial consultation",
startTimeUtc: "2024-03-15T14:00:00.000Z",
durationMinutes: 60,
status: "scheduled",
contactId: "67890",
attendees: [
{ id: 67890, name: "Jane Smith", type: "Contact" }
]
}
]
};
Reference
};
return {
extraDataTracking
}
}
async function getCallLog({ user, callLogId, contactId: loggedContactId, authHeader }) {
let extraDataTracking = {};
const formattedLogId = callLogId.split('.')[0];
const getLogRes = await axios.get(
`https://${user.hostname}/api/v4/communications/${formattedLogId}.json?fields=subject,body,matter,senders,receivers,id`,
{
headers: { 'Authorization': authHeader }
});
//const note = getLogRes.data.data.body.split('- Note: ')[1]?.split('\n')[0];
const noteRegex = /- (?:Note|Agent notes): ([\s\S]*?)(?=\n- [A-Z][a-zA-Z\s/]*:|\n$|$)/;
// The communication can be edited in Clio after it was logged, so its body and participants
// are not guaranteed to be present.
const note = (getLogRes.data.data.body ?? '').match(noteRegex)?.[1]?.trim();
// The contact is the first participant that is not a Clio user ('Person' or 'Company' vs
// 'User'). If Clio no longer lists one (e.g. the contact was removed from the communication),
// fall back to the contact stored when the call was logged.
const participants = [
...(getLogRes.data.data.senders ?? []),
...(getLogRes.data.data.receivers ?? [])
];
const contactId = participants.find(p => p?.id != null && p.type !== 'User')?.id ?? loggedContactId;
let contactName = null;
let rateLimitHeaders = getLogRes.headers;
if (contactId != null && contactId !== '') {
try {
const contactRes = await axios.get(
`https://${user.hostname}/api/v4/contacts/${contactId}.json?fields=name`,
{
headers: { 'Authorization': authHeader }
});