@lautmaler/crm-connectors
Version:
Provides connectors to various CRM systems and calendar services.
119 lines (113 loc) • 2.9 kB
text/typescript
import {
appointmentStatus,
appointmentType,
contactName,
meetingExternalLink,
meetingLocation,
meetingNotes,
meetingTitle,
timestamp,
virtualMeetingService,
} from "./crm.types.js";
export type Appointment = {
id?: string;
status: appointmentStatus;
type: appointmentType;
timestamp: timestamp;
contactName: contactName;
contactEmail?: string;
contactPhone?: string;
employeeName?: string;
employeeEmail?: string;
employeePhone?: string;
meetingTitle?: meetingTitle;
meetingExternalLink?: meetingExternalLink; // e.g., Zoom link
meetingLocation?: meetingLocation;
meetingNotes?: meetingNotes;
virtualMeetingService?: virtualMeetingService;
};
export interface CRMBackend {
createEventToSms(appointment: Appointment): string | PromiseLike<string>;
fetchAppointmentTypes(): Promise<string[]>;
fetchAvailableSlots(
timestamp: string,
attendees: string[],
): Promise<string[]>;
bookAppointment(appointment: Appointment): Promise<string>;
modifyAppointment(
id: string,
updatedInfo: Partial<Appointment>,
): Promise<Appointment>;
findAppointmentByContactName(name: string): Promise<Appointment>;
findAppointmentByTimestamp(timestamp: string): Promise<Appointment | null>;
findAppointmentById(id: string): Promise<Appointment | null>;
}
export interface HubSpotApiResponse {
archived: boolean;
createdAt: string;
id: string;
properties: {
hs_createdate: string;
hs_internal_meeting_notes: string;
hs_lastmodifieddate: string;
hs_meeting_location: string;
hs_meeting_source: string;
hs_object_id: string;
hs_object_source: string;
hs_object_source_id: string;
hs_object_source_label: string;
hs_outcome_canceled_count: string;
hs_outcome_completed_count: string;
hs_outcome_no_show_count: string;
hs_outcome_rescheduled_count: string;
hs_outcome_scheduled_count: string;
hs_time_to_book_meeting_from_first_contact: string;
hs_timestamp: string;
};
updatedAt: string;
}
export interface FreeBusyResponse {
kind: "calendar#freeBusy";
timeMin: string;
timeMax: string;
groups: {
(key): {
errors: [
{
domain: string;
reason: string;
},
];
calendars: [string];
};
};
calendars: {
(key): {
errors: [
{
domain: string;
reason: string;
},
];
busy: [
{
start: string;
end: string;
},
];
};
};
}
export interface GoogleCalendarEvent {
summary: string;
start: { dateTime: string; timeZone: string };
end: { dateTime: string; timeZone: string };
// email and optional infinnite keys
attendees: { email: string, [key: string]: any }[];
conferenceData: {
createRequest: {
requestId: string;
conferenceSolutionKey: { type: string };
};
};
}