Here are the events each feature triggers.
| Event | Description |
|---|---|
patient.selected | Fired when a practitioner creates or selects a patient. The data returned identifies the selected patient. You can store the Fullscript patient id with your local patient data to avoid triggering a search next time a practitioner creates a treatment plan for this patient. Event details found below. |
treatmentPlan.activated | Fired when the practitioner or staff member finalizes the treatment plan. The data returned includes details about who created the plan, for which patient, and an array with the selected products and their details. Event details found below. Supplement practitioner-pay checkout still uses this event. |
order.checkoutStarted | Fired when a practitioner starts practitioner-pay checkout for a lab plan in Fullscript Embed. Requires Fullscript Embed 3.3.0 or later. The plan is still a draft and nothing has been charged. order.id is the same id as the later order.placed webhook. This is not treatmentPlan.activated. Event details found below. |
Here is a TypeScript definition for the patient.selected event data.
For more information about possible values and formats, refer to the Fullscript Patient object in our REST API docs.
declare type PatientPayload = {
patient: {
id: string;
firstName: string;
lastName: string;
email: string;
dateOfBirth: string;
biologicalSex: string;
gender: string;
discount: number;
totalDiscount: number;
mobileNumber: string;
textMessageNotification: boolean;
};
};
The payload includes both biologicalSex (assigned sex) and gender. The published @fullscript/fullscript-js type only declares gender.
Here is a TypeScript definition for the treatmentPlan.activated event data.
For more information about possible values and formats, refer to the Fullscript Treatment Plan object in our REST API docs.
This event doesn't include the partnerSessionId you passed at launch. It's returned as partner_session_id on treatment plan webhooks instead.
declare type TreatmentPlanPayload = {
treatmentPlan: {
id: string;
state: string;
patient: {
id: string;
firstName: string;
lastName: string;
email: string;
};
practitioner: {
id: string;
};
availableAt: string;
recommendations: {
variantId: string;
refill: boolean;
unitsToPurchase: number;
dosage: {
recommendedAmount: string;
recommendedFrequency: string;
recommendedDuration: string;
format: string;
additionalInfo: string;
};
}[];
labRecommendations: {
id: string;
name: string;
instructions: string;
requiresFasting: boolean;
tests: {
id: string;
name: string;
}[];
}[];
};
};
This event fires only for lab practitioner-pay checkout, before the practitioner pays. It requires Fullscript Embed 3.3.0 or later. Older versions reject order.checkoutStarted as an unknown event type.
The treatment plan is still a draft: state is "draft", and nothing has been charged. practitionerPay is true.
order.id is the same id you will receive on the order.placed webhook if checkout completes. Store it so you can reconcile the two.
Supplement practitioner-pay checkout does not emit order.checkoutStarted. It still emits treatmentPlan.activated when the plan is finalized.
treatmentPlan has the same fields as treatmentPlan.activated above. availableAt is null while the plan is still a draft.
declare type OrderPayload = {
order: {
id: string;
practitionerPay: boolean;
treatmentPlan: {
id: string;
state: string;
patient: {
id: string;
firstName: string;
lastName: string;
email: string;
};
practitioner: {
id: string;
};
availableAt: string | null;
recommendations: {
variantId: string;
refill: boolean;
unitsToPurchase: number;
dosage: {
recommendedAmount: string;
recommendedFrequency: string;
recommendedDuration: string;
format: string;
additionalInfo: string;
};
}[];
labRecommendations: {
id: string;
name: string;
instructions: string;
requiresFasting: boolean;
tests: {
id: string;
name: string;
}[];
}[];
};
};
};