Skip to content

New Components - acuity_scheduling #17165

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "acuity_scheduling-add-blocked-off-time",
name: "Add Blocked Off Time",
description: "Blocks a specific time slot on your schedule to prevent the scheduling of any appointments during this particular time range. [See the documentation](https://developers.acuityscheduling.com/reference/post-blocks)",
version: "0.0.1",
version: "0.0.2",
type: "action",
props: {
acuityScheduling,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
import acuityScheduling from "../../acuity_scheduling.app.mjs";
import { ConfigurationError } from "@pipedream/platform";

export default {
key: "acuity_scheduling-book-appointment",
name: "Book Appointment",
description: "Book an appointment. [See the documentation](https://developers.acuityscheduling.com/reference/post-appointments)",
version: "0.0.1",
type: "action",
props: {
acuityScheduling,
datetime: {
type: "string",
label: "Datetime",
description: "Date and time of the appointment. E.g. `2016-02-03T14:00:00-0800`",
},
appointmentTypeId: {
propDefinition: [
acuityScheduling,
"appointmentTypeId",
],
description: "The type of appointment to book",
},
firstName: {
type: "string",
label: "First Name",
description: "First name of the client",
},
lastName: {
type: "string",
label: "Last Name",
description: "Last name of the client",
},
isAdmin: {
type: "boolean",
label: "Is Admin",
description: "By default appointments are created as if they are being booked by a client. Booking as an admin disables availability and attribute validations, and allows setting the notes attribute. This also requires a valid `calendarID` to be included in the request.",
optional: true,
},
email: {
type: "string",
label: "Email",
description: "Email address of the client",
optional: true,
},
calendarId: {
propDefinition: [
acuityScheduling,
"calendarId",
],
description: "The calendar to book the appointment on. If not provided we'll try to find an available calendar automatically.",
optional: true,
},
phone: {
type: "string",
label: "Phone",
description: "Phone number of the client",
optional: true,
},
timezone: {
propDefinition: [
acuityScheduling,
"timezone",
],
},
certificate: {
propDefinition: [
acuityScheduling,
"certificate",
(c) => ({
appointmentTypeId: c.appointmentTypeId,
}),
],
optional: true,
},
notes: {
type: "string",
label: "Notes",
description: "Notes to be added to the appointment. Settable when booking as an admin.",
optional: true,
},
labelId: {
propDefinition: [
acuityScheduling,
"labelId",
],
optional: true,
},
smsOptin: {
type: "boolean",
label: "SMS Opt-in",
description: "Indicates whether the client has explicitly given their permission to receive SMS messages. This parameter is only applicable to Appointments with an Appointment Type that requires Opt In and can be omitted (and will be ignored) for all other Appointments. If omitted or set to false on an applicable Appointment, an SMS reminder will not be sent. For more information on SMS Opt In settings for Appointment Types, see the article in our [Knowledge Base](https://support.squarespace.com/hc/en-us/articles/360040093611).",
optional: true,
},
formId: {
propDefinition: [
acuityScheduling,
"formId",
],
optional: true,
reloadProps: true,
},
},
async additionalProps() {
const props = {};
if (!this.formId) {
return props;
}
const forms = await this.acuityScheduling.listForms();
const form = forms.find((f) => f.id === this.formId);
const { fields } = form;
for (const field of fields) {
props[`${field.id}`] = {
type: "string",
label: field.name,
};
if (field.options) {
props[`${field.id}`].options = field.options;
}
}
return props;
},
async run({ $ }) {
const {
acuityScheduling,
datetime,
appointmentTypeId,
firstName,
lastName,
isAdmin,
email,
calendarId,
phone,
timezone,
certificate,
notes,
labelId,
smsOptin,
formId,
...fieldValues
} = this;

if (isAdmin && !calendarId) {
throw new ConfigurationError("`calendarID` is required when booking as an admin");
}

if (!isAdmin && !email) {
throw new ConfigurationError("`email` is required when booking as a client");
}

if (!isAdmin && notes) {
throw new ConfigurationError("`notes` is only available when booking as an admin");
}

if (formId && !appointmentTypeId) {
throw new ConfigurationError("`formId` is required when booking an appointment with a form");
}

const fields = [];
if (Object.keys(fieldValues).length > 0) {
for (const [
fieldId,
value,
] of Object.entries(fieldValues)) {
fields.push({
id: fieldId,
value,
});
}
}

const response = await acuityScheduling.createAppointment({
$,
params: {
admin: isAdmin,
},
data: {
datetime,
appointmentTypeID: appointmentTypeId,
firstName,
lastName,
email,
calendarID: calendarId,
phone,
timezone,
certificate,
notes,
labels: labelId
? [
{
id: labelId,
},
]
: undefined,
smsOptin,
fields,
},
});
$.export("$summary", `Successfully booked appointment with ID: ${response.id}`);
return response;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import acuityScheduling from "../../acuity_scheduling.app.mjs";

export default {
key: "acuity_scheduling-check-availability-times",
name: "Check Availability Times",
description: "Validate available times for an appointment. [See the documentation](https://developers.acuityscheduling.com/reference/availability-check-times)",
version: "0.0.1",
type: "action",
props: {
acuityScheduling,
date: {
type: "string",
label: "Date",
description: "Date to check availability for. E.g. `2016-02-03T14:00:00-0800`",
},
appointmentTypeId: {
propDefinition: [
acuityScheduling,
"appointmentTypeId",
],
description: "Appointment type to check availability time for",
},
calendarId: {
propDefinition: [
acuityScheduling,
"calendarId",
],
description: "Calendar to check availability time for",
optional: true,
},
},
async run({ $ }) {
const response = await this.acuityScheduling.checkAvailabilityTimes({
$,
data: {
datetime: this.date,
appointmentTypeID: this.appointmentTypeId,
calendarID: this.calendarId,
},
});
$.export("$summary", `Successfully checked availability for ${this.date}`);
return response;
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "acuity_scheduling-find-appointments-by-client-info",
name: "Find Appointments by Client Info",
description: "Retrieves existing appointments using the client's information, allowing you to track all the appointments associated with a specific client. [See the documentation](https://developers.acuityscheduling.com/reference/get-appointments)",
version: "0.0.1",
version: "0.0.2",
type: "action",
props: {
acuityScheduling,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import acuityScheduling from "../../acuity_scheduling.app.mjs";

export default {
key: "acuity_scheduling-get-appointment-types",
name: "Get Appointment Types",
description: "Return a list ofappointment types. [See the documentation](https://developers.acuityscheduling.com/reference/appointment-types)",
version: "0.0.1",
type: "action",
props: {
acuityScheduling,
includeDeleted: {
type: "boolean",
label: "Include Deleted",
description: "Include deleted appointment types in the response",
optional: true,
},
},
async run({ $ }) {
const response = await this.acuityScheduling.listAppointmentTypes({
$,
params: {
includeDeleted: this.includeDeleted,
},
});
$.export("$summary", `Successfully retrieved ${response.length} appointment types`);
return response;
},
};
Loading
Loading