Skip to content

refreshAppointment

This interface fetches the latest state of a single appointment from the CRM. It is called when a user opens an appointment detail view or manually refreshes an appointment to pick up changes made directly in the CRM.

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.
appointmentId The CRM ID of the appointment to retrieve.

Return value(s)

An object with the following property:

Parameter Description
appointment The current appointment object from the CRM.

If the appointment cannot be found, return:

Parameter Description
successful false
returnMessage An object with message, messageType, and ttl.

Example

return {
  appointment: {
    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

            ...(hasAttendeeUpdate ? { attendees } : {})
        }
    };

    const updateResponseBody = await axios.patch(
        `https://${user.hostname}/api/v4/calendar_entries/${appointmentId}.json`,
        updateBody,
        { headers: { 'Authorization': authHeader }, params: { fields: 'id,summary,description,start_at,end_at,attendees,external_properties,calendar_owner_id' } }
    );
    return { appointment: normalizeCalendarEntryToAppointment(updateResponseBody?.data?.data) };
}

async function refreshAppointment({ user, authHeader, appointmentId }) {
    const calendarEntry = await getCalendarEntryById({ user, authHeader, appointmentId });