Skip to main content

CrmService

Stentor API Reference


Stentor API Reference / stentor-models/src / CrmService

Interface: CrmService

Defined in: packages/stentor-models/src/Services/CrmService.ts:204

Methods​

send()​

send(externalLead, extras?): Promise<CrmResponse>

Defined in: packages/stentor-models/src/Services/CrmService.ts:215

Send information about a lead to the CRM.

This can be used to either create a lead or append data to an existing lead.

The existing lead can be determined by the refId on the ExternalLead information or by attempting to match data such as email or phone number.

Parameters​

externalLead​

ExternalLead

Lead information

extras?​

Record<string, unknown>

Optional additional metadata to pass to the CRM

Returns​

Promise<CrmResponse>


update()?​

optional update(externalLead, extras?): Promise<CrmResponse>

Defined in: packages/stentor-models/src/Services/CrmService.ts:229

Updates a lead if the user provides more information after the lead has been sent.

It leverages the refId on the externalLead, which is originally provided in the CrmResponse to properly

Parameters​

externalLead​

ExternalLead

extras?​

Record<string, unknown>

Returns​

Promise<CrmResponse>

Deprecated​

Use send with a refId on the externalLead and call send() again. This will update.


getAvailability()​

getAvailability(range, options?): Promise<CrmServiceAvailability>

Defined in: packages/stentor-models/src/Services/CrmService.ts:239

Returns availability for scheduling an appointment with the business.

Parameters​

range​

DateTimeRange

options?​

CrmServiceAvailabilityOptions

Returns​

Promise<CrmServiceAvailability>


getJobType()?​

optional getJobType(message, externalLead?, options?): Promise<CrmServiceJobType>

Defined in: packages/stentor-models/src/Services/CrmService.ts:255

Returns the job type (id) for the free text job description (AI call usually)

Parameters​

message​

string

externalLead?​

ExternalLead

options?​

CrmServiceAvailabilitySettings

Availability settings in scope for this request (e.g. a widget's forceAvailabilityClass or jobTypeClasses), needed to resolve the job type's class.

Deliberately typed as the settings-only CrmServiceAvailabilitySettings rather than CrmServiceAvailabilityOptions: this method determines the job type, so the jobType member of the Options type would be meaningless (and misleading) here.

Returns​

Promise<CrmServiceJobType>


listJobTypes()?​

optional listJobTypes(): Promise<CrmServiceJobType[]>

Defined in: packages/stentor-models/src/Services/CrmService.ts:263

Lists the tenant's job types from the FSM. Backs a Studio picker.

Returns​

Promise<CrmServiceJobType[]>


suggestJobTypeClasses()?​

optional suggestJobTypeClasses(availabilityClasses?): Promise<JobTypeAvailabilityClass[]>

Defined in: packages/stentor-models/src/Services/CrmService.ts:269

Returns a suggested job-type -> class map. Does not persist anything.

Parameters​

availabilityClasses?​

AvailabilityClass[]

Returns​

Promise<JobTypeAvailabilityClass[]>