Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

feat(zoho-bookings): add AI actions and output schemas (#16813)

Kishan Parmaref01fd017101
diff --git a/bun.lock b/bun.lock
index d848a8cd55e..6aaf29b1431 100644
--- a/bun.lock
+++ b/bun.lock
@@ -10360,7 +10360,7 @@
},
"packages/pieces/community/zoho-bookings": {
"name": "@activepieces/piece-zoho-bookings",
- "version": "0.1.8",
+ "version": "0.2.0",
"dependencies": {
"@activepieces/core-piece-types": "workspace:*",
"@activepieces/core-utils": "workspace:*",
diff --git a/packages/pieces/community/zoho-bookings/package.json b/packages/pieces/community/zoho-bookings/package.json
index 3c52178324a..acaf1b5a735 100644
--- a/packages/pieces/community/zoho-bookings/package.json
+++ b/packages/pieces/community/zoho-bookings/package.json
@@ -1,6 +1,6 @@
{
"name": "@activepieces/piece-zoho-bookings",
- "version": "0.1.8",
+ "version": "0.2.0",
"type": "commonjs",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
diff --git a/packages/pieces/community/zoho-bookings/src/index.ts b/packages/pieces/community/zoho-bookings/src/index.ts
index b5bc682facf..cd53afdadd0 100644
--- a/packages/pieces/community/zoho-bookings/src/index.ts
+++ b/packages/pieces/community/zoho-bookings/src/index.ts
@@ -1,26 +1,36 @@
-import { createPiece, PieceAuth } from '@activepieces/pieces-framework';
-import { cancelAppointment } from './lib/actions/cancel-appointment';
-import { fetchAvailability } from './lib/actions/fetch-availability';
-import { rescheduleAppointment } from './lib/actions/reschedule-appointment';
-import { bookAppointment } from './lib/actions/book-appointment';
-import { getAppointmentDetails } from './lib/actions/get-appointment-details';
-import { zohoBookingsAuth } from './lib/common';
-import { PieceCategory } from '@activepieces/pieces-framework';
+import { createCustomApiCallAction } from '@activepieces/pieces-common';
+import { createPiece } from '@activepieces/pieces-framework';
+import { zohoBookingsAuth } from './lib/auth';
+import { zohoBookingsAiActions } from './lib/actions/ai';
+import { zohoBookingsClient } from './lib/common/client';
+import { bookAppointmentAction } from './lib/actions/book-appointment';
+import { cancelAppointmentAction } from './lib/actions/cancel-appointment';
+import { fetchAvailabilityAction } from './lib/actions/fetch-availability';
+import { getAppointmentDetailsAction } from './lib/actions/get-appointment-details';
+import { rescheduleAppointmentAction } from './lib/actions/reschedule-appointment';
export const zohoBookings = createPiece({
displayName: 'Zoho Bookings',
description:
'Zoho Bookings is an appointment scheduling software for managing bookings, services, and customer appointments.',
auth: zohoBookingsAuth,
- minimumSupportedRelease: '0.36.1',
+ minimumSupportedRelease: '0.88.2',
logoUrl: 'https://cdn.activepieces.com/pieces/zoho-bookings.png',
authors: ['fortunamide', 'sanket-a11y'],
actions: [
- bookAppointment,
- rescheduleAppointment,
- fetchAvailability,
- getAppointmentDetails,
- cancelAppointment,
+ bookAppointmentAction,
+ rescheduleAppointmentAction,
+ fetchAvailabilityAction,
+ getAppointmentDetailsAction,
+ cancelAppointmentAction,
+ ...zohoBookingsAiActions,
+ createCustomApiCallAction({
+ auth: zohoBookingsAuth,
+ baseUrl: (auth) => (auth ? zohoBookingsClient.baseUrl({ auth }) : ''),
+ authMapping: async (auth) => ({
+ Authorization: `Zoho-oauthtoken ${auth.access_token}`,
+ }),
+ }),
],
triggers: [],
});
diff --git a/packages/pieces/community/zoho-bookings/src/lib/actions/ai/add-staff.ts b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/add-staff.ts
new file mode 100644
index 00000000000..8e3dc762cb1
--- /dev/null
+++ b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/add-staff.ts
@@ -0,0 +1,54 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+
+import { zohoBookingsAuth } from '../../auth';
+import { zohoBookingsAiProps } from '../../common/ai-props';
+import { zohoBookingsApi } from '../../common/api';
+import { zohoBookingsAddStaffOutputSchema } from '../../output-schemas';
+
+export const zohoBookingsAddStaffAction = createAction({
+ auth: zohoBookingsAuth,
+ name: 'zoho_bookings_add_staff',
+ outputSchema: zohoBookingsAddStaffOutputSchema,
+ displayName: 'Add Staff',
+ description: 'Add a staff member to the account.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ "Add a staff member (name and email) and optionally assign services. Needs an Admin or Super Admin connection, uses one of the plan's staff seats, and staff can't be removed through the API. Returns the new staff ID, name and email; a newly added staff member may not appear in List Staff right away. Fails if the email already exists. Not idempotent.",
+ idempotent: false,
+ },
+ props: {
+ name: Property.ShortText({ displayName: 'Name', required: true }),
+ email: Property.ShortText({ displayName: 'Email', required: true }),
+ role: Property.StaticDropdown({
+ displayName: 'Role',
+ required: false,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'Admin', value: 'Admin' },
+ { label: 'Manager', value: 'Manager' },
+ { label: 'Staff', value: 'Staff' },
+ ],
+ },
+ }),
+ designation: Property.ShortText({
+ displayName: 'Designation',
+ description: 'Job title, e.g. "Consultant".',
+ required: false,
+ }),
+ phone: Property.ShortText({ displayName: 'Phone', required: false }),
+ gender: Property.ShortText({ displayName: 'Gender', required: false }),
+ dob: zohoBookingsAiProps.dateTime({ required: false, displayName: 'Date of Birth' }),
+ additionalInfo: Property.LongText({ displayName: 'Additional Info', required: false }),
+ serviceIds: Property.Array({
+ displayName: 'Service IDs',
+ description: 'Services to assign. Use List Services.',
+ required: false,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await zohoBookingsApi.addStaff({ auth, ...propsValue });
+ },
+});
diff --git a/packages/pieces/community/zoho-bookings/src/lib/actions/ai/book-appointment.ts b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/book-appointment.ts
new file mode 100644
index 00000000000..28df2d5fbee
--- /dev/null
+++ b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/book-appointment.ts
@@ -0,0 +1,84 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+
+import { zohoBookingsAuth } from '../../auth';
+import { zohoBookingsAiProps } from '../../common/ai-props';
+import { zohoBookingsApi } from '../../common/api';
+import { zohoBookingsBookAppointmentOutputSchema } from '../../output-schemas';
+
+export const zohoBookingsBookAppointmentAction = createAction({
+ auth: zohoBookingsAuth,
+ name: 'zoho_bookings_book_appointment',
+ outputSchema: zohoBookingsBookAppointmentOutputSchema,
+ displayName: 'Book Appointment',
+ description: 'Book an appointment for a customer.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Book a new appointment for a customer on a service at a start time. Assign it to a staff member, a resource or a staff group (one is required); use Get Available Slots first to pick a free time. Not idempotent: each call books a separate appointment.',
+ idempotent: false,
+ },
+ props: {
+ serviceId: zohoBookingsAiProps.serviceId({ required: true }),
+ staffId: zohoBookingsAiProps.staffId({ required: false }),
+ resourceId: zohoBookingsAiProps.resourceId({ required: false }),
+ groupId: zohoBookingsAiProps.groupId({ required: false }),
+ fromTime: zohoBookingsAiProps.dateTime({
+ required: true,
+ displayName: 'Start Time',
+ description: 'Start of the appointment.',
+ }),
+ toTime: zohoBookingsAiProps.dateTime({
+ required: false,
+ displayName: 'End Time',
+ description: 'End of the booking; only for resource-booking services.',
+ }),
+ timezone: Property.ShortText({
+ displayName: 'Time Zone',
+ description:
+ 'IANA time zone for the appointment, e.g. "America/New_York". Defaults to the workspace time zone.',
+ required: false,
+ }),
+ customerName: Property.ShortText({ displayName: 'Customer Name', required: true }),
+ customerEmail: Property.ShortText({ displayName: 'Customer Email', required: true }),
+ customerPhone: Property.ShortText({ displayName: 'Customer Phone', required: true }),
+ notes: Property.LongText({
+ displayName: 'Notes',
+ description: 'Notes about the appointment.',
+ required: false,
+ }),
+ additionalFields: Property.Json({
+ displayName: 'Custom Fields',
+ description:
+ 'Values for the booking form\'s custom fields, keyed by field label, e.g. {"Company": "Acme"}.',
+ required: false,
+ }),
+ costPaid: Property.Number({
+ displayName: 'Amount Paid',
+ description: 'Amount the customer already paid.',
+ required: false,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ if (!propsValue.staffId && !propsValue.resourceId && !propsValue.groupId) {
+ throw new Error('Provide one of Staff ID, Resource ID or Group ID.');
+ }
+ const response = await zohoBookingsApi.bookAppointment({
+ auth,
+ serviceId: propsValue.serviceId,
+ fromTime: propsValue.fromTime,
+ customerName: propsValue.customerName,
+ customerEmail: propsValue.customerEmail,
+ customerPhone: propsValue.customerPhone,
+ staffId: propsValue.staffId,
+ resourceId: propsValue.resourceId,
+ groupId: propsValue.groupId,
+ toTime: propsValue.toTime,
+ timezone: propsValue.timezone,
+ notes: propsValue.notes,
+ additionalFields: propsValue.additionalFields,
+ costPaid: propsValue.costPaid,
+ });
+ return response.returnvalue;
+ },
+});
diff --git a/packages/pieces/community/zoho-bookings/src/lib/actions/ai/create-customer.ts b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/create-customer.ts
new file mode 100644
index 00000000000..0ca175de0c8
--- /dev/null
+++ b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/create-customer.ts
@@ -0,0 +1,28 @@
+import { createAction } from '@activepieces/pieces-framework';
+
+import { zohoBookingsAuth } from '../../auth';
+import { zohoBookingsAiProps } from '../../common/ai-props';
+import { zohoBookingsApi } from '../../common/api';
+import { zohoBookingsCustomerOutputSchema } from '../../output-schemas';
+
+export const zohoBookingsCreateCustomerAction = createAction({
+ auth: zohoBookingsAuth,
+ name: 'zoho_bookings_create_customer',
+ outputSchema: zohoBookingsCustomerOutputSchema,
+ displayName: 'Create Customer',
+ description: 'Create a guest customer.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ "Create a customer, added as a guest. Pass Name, or First Name and Last Name, depending on how the account's customer name field is set up. Keep the returned customer ID: there is no action to look customers up later, and Update Customer and Delete Customer need it. Not idempotent.",
+ idempotent: false,
+ },
+ props: zohoBookingsAiProps.customerFields(),
+ async run({ auth, propsValue }) {
+ if (!propsValue.name && !(propsValue.firstName && propsValue.lastName)) {
+ throw new Error('Provide Name, or both First Name and Last Name.');
+ }
+ return await zohoBookingsApi.createCustomer({ auth, ...propsValue });
+ },
+});
diff --git a/packages/pieces/community/zoho-bookings/src/lib/actions/ai/create-date-overrides.ts b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/create-date-overrides.ts
new file mode 100644
index 00000000000..4ff24212500
--- /dev/null
+++ b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/create-date-overrides.ts
@@ -0,0 +1,50 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+
+import { zohoBookingsAuth } from '../../auth';
+import { zohoBookingsAiProps } from '../../common/ai-props';
+import { zohoBookingsApi } from '../../common/api';
+import { zohoBookingsCreateDateOverridesOutputSchema } from '../../output-schemas';
+
+export const zohoBookingsCreateDateOverridesAction = createAction({
+ auth: zohoBookingsAuth,
+ name: 'zoho_bookings_create_date_overrides',
+ outputSchema: zohoBookingsCreateDateOverridesOutputSchema,
+ displayName: 'Create Date Overrides',
+ description: 'Block time off or add extra hours for the business, a staff member or a resource.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Create 1-10 date overrides that block time (unavailability) or open extra hours (additional_availability) for the business, a staff member or a resource. Past dates are rejected. Returns each override with its ID. Not idempotent.',
+ idempotent: false,
+ },
+ props: {
+ availabilityFor: zohoBookingsAiProps.availabilityFor({ required: true }),
+ availabilityForId: Property.ShortText({
+ displayName: 'Staff or Resource ID',
+ description: 'Required for a staff member or resource. Use List Staff or List Resources.',
+ required: false,
+ }),
+ overrides: Property.Json({
+ displayName: 'Overrides',
+ description:
+ 'Array of 1-10 overrides. Each has type ("unavailability" or "additional_availability"), mode ("specific_dates" with dates ["27-Dec-2026"], "date_range" or "custom_range" with from_date/to_date "27-Dec-2026"), all_day (true/false), available_times [{"from_time": "09:00", "to_time": "13:00"}] when not all day, and an optional reason.',
+ required: true,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ if (propsValue.availabilityFor !== 'business' && !propsValue.availabilityForId) {
+ throw new Error('Staff or Resource ID is required unless Applies To is Business.');
+ }
+ const overrides = propsValue.overrides;
+ if (!Array.isArray(overrides) || overrides.length === 0 || overrides.length > 10) {
+ throw new Error('Overrides must be an array of 1 to 10 overrides.');
+ }
+ return await zohoBookingsApi.createDateOverrides({
+ auth,
+ availabilityFor: propsValue.availabilityFor,
+ availabilityForId: propsValue.availabilityForId,
+ overrides,
+ });
+ },
+});
diff --git a/packages/pieces/community/zoho-bookings/src/lib/actions/ai/create-resource.ts b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/create-resource.ts
new file mode 100644
index 00000000000..447be499a18
--- /dev/null
+++ b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/create-resource.ts
@@ -0,0 +1,35 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+
+import { zohoBookingsAuth } from '../../auth';
+import { zohoBookingsApi } from '../../common/api';
+import { zohoBookingsCreateResourceOutputSchema } from '../../output-schemas';
+
+export const zohoBookingsCreateResourceAction = createAction({
+ auth: zohoBookingsAuth,
+ name: 'zoho_bookings_create_resource',
+ outputSchema: zohoBookingsCreateResourceOutputSchema,
+ displayName: 'Create Resource',
+ description: 'Create a bookable resource, such as a room or equipment.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Create a bookable resource (a room, equipment) in one or more workspaces. Returns the new resource with its ID. Resources depend on the account plan. Not idempotent.',
+ idempotent: false,
+ },
+ props: {
+ name: Property.ShortText({ displayName: 'Name', required: true }),
+ description: Property.LongText({ displayName: 'Description', required: false }),
+ workspaceIds: Property.Array({
+ displayName: 'Workspace IDs',
+ description: 'Workspaces the resource belongs to (at least one). Use List Workspaces.',
+ required: true,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ if (propsValue.workspaceIds.length === 0) {
+ throw new Error('Workspace IDs needs at least one workspace ID.');
+ }
+ return await zohoBookingsApi.createResource({ auth, ...propsValue });
+ },
+});
diff --git a/packages/pieces/community/zoho-bookings/src/lib/actions/ai/create-service.ts b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/create-service.ts
new file mode 100644
index 00000000000..9172ca350d8
--- /dev/null
+++ b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/create-service.ts
@@ -0,0 +1,46 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+
+import { zohoBookingsAuth } from '../../auth';
+import { zohoBookingsAiProps } from '../../common/ai-props';
+import { zohoBookingsApi } from '../../common/api';
+import { zohoBookingsCreatedRecordOutputSchema } from '../../output-schemas';
+
+export const zohoBookingsCreateServiceAction = createAction({
+ auth: zohoBookingsAuth,
+ name: 'zoho_bookings_create_service',
+ outputSchema: zohoBookingsCreatedRecordOutputSchema,
+ displayName: 'Create Service',
+ description: 'Create a one-on-one or resource service in a workspace.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Create a one-on-one or resource-booking service in a workspace (group and collective services are not supported). Returns the new service ID. Not idempotent.',
+ idempotent: false,
+ },
+ props: {
+ workspaceId: zohoBookingsAiProps.workspaceId({ required: true }),
+ name: Property.ShortText({ displayName: 'Name', required: true }),
+ serviceType: Property.StaticDropdown({
+ displayName: 'Service Type',
+ description: 'Defaults to one-on-one.',
+ required: false,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'One-on-one', value: 'one_on_one' },
+ { label: 'Resource', value: 'resource' },
+ ],
+ },
+ }),
+ ...zohoBookingsAiProps.serviceFields(),
+ resourceIds: Property.Array({
+ displayName: 'Resource IDs',
+ description: 'Resources to assign (resource services). Use List Resources.',
+ required: false,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await zohoBookingsApi.createService({ auth, ...propsValue });
+ },
+});
diff --git a/packages/pieces/community/zoho-bookings/src/lib/actions/ai/create-workspace.ts b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/create-workspace.ts
new file mode 100644
index 00000000000..9b7ff99ca16
--- /dev/null
+++ b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/create-workspace.ts
@@ -0,0 +1,30 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+
+import { zohoBookingsAuth } from '../../auth';
+import { zohoBookingsApi } from '../../common/api';
+import { zohoBookingsCreatedRecordOutputSchema } from '../../output-schemas';
+
+export const zohoBookingsCreateWorkspaceAction = createAction({
+ auth: zohoBookingsAuth,
+ name: 'zoho_bookings_create_workspace',
+ outputSchema: zohoBookingsCreatedRecordOutputSchema,
+ displayName: 'Create Workspace',
+ description: 'Create a new workspace.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Create a workspace with a name. Returns the new workspace ID. The account plan limits how many workspaces can exist. Not idempotent.',
+ idempotent: false,
+ },
+ props: {
+ name: Property.ShortText({
+ displayName: 'Name',
+ description: '2-50 characters, without |/\\,?{}<>:;"\'` characters.',
+ required: true,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await zohoBookingsApi.createWorkspace({ auth, name: propsValue.name });
+ },
+});
diff --git a/packages/pieces/community/zoho-bookings/src/lib/actions/ai/delete-customer.ts b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/delete-customer.ts
new file mode 100644
index 00000000000..9f5650a0b18
--- /dev/null
+++ b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/delete-customer.ts
@@ -0,0 +1,31 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+
+import { zohoBookingsAuth } from '../../auth';
+import { zohoBookingsApi } from '../../common/api';
+import { zohoBookingsDeleteRecordOutputSchema } from '../../output-schemas';
+
+export const zohoBookingsDeleteCustomerAction = createAction({
+ auth: zohoBookingsAuth,
+ name: 'zoho_bookings_delete_customer',
+ outputSchema: zohoBookingsDeleteRecordOutputSchema,
+ displayName: 'Delete Customer',
+ description: 'Permanently delete a customer.',
+ audience: 'ai',
+ classification: 'DESTRUCTIVE',
+ aiMetadata: {
+ description:
+ "Permanently delete a customer by customer ID. Fails while the customer has upcoming appointments. The ID comes from Create Customer or from the customer's page URL in Zoho Bookings.",
+ idempotent: false,
+ },
+ props: {
+ customerId: Property.ShortText({
+ displayName: 'Customer ID',
+ description:
+ "From Create Customer, or the number in the customer's page URL in Zoho Bookings.",
+ required: true,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await zohoBookingsApi.deleteCustomer({ auth, customerId: propsValue.customerId });
+ },
+});
diff --git a/packages/pieces/community/zoho-bookings/src/lib/actions/ai/delete-date-overrides.ts b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/delete-date-overrides.ts
new file mode 100644
index 00000000000..4c51efa49e8
--- /dev/null
+++ b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/delete-date-overrides.ts
@@ -0,0 +1,38 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+
+import { zohoBookingsAuth } from '../../auth';
+import { zohoBookingsApi } from '../../common/api';
+import { zohoBookingsStatusMessageOutputSchema } from '../../output-schemas';
+
+export const zohoBookingsDeleteDateOverridesAction = createAction({
+ auth: zohoBookingsAuth,
+ name: 'zoho_bookings_delete_date_overrides',
+ outputSchema: zohoBookingsStatusMessageOutputSchema,
+ displayName: 'Delete Date Overrides',
+ description: 'Delete date overrides by ID.',
+ audience: 'ai',
+ classification: 'DESTRUCTIVE',
+ aiMetadata: {
+ description:
+ 'Permanently delete 1-10 date overrides by ID, restoring the regular working hours for those dates. Use List Date Overrides for the IDs.',
+ idempotent: false,
+ },
+ props: {
+ ids: Property.Array({
+ displayName: 'Override IDs',
+ description: '1-10 IDs from List Date Overrides.',
+ required: true,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const ids = propsValue.ids;
+ if (
+ ids.length === 0 ||
+ ids.length > 10 ||
+ !ids.every((id): id is string => typeof id === 'string' && id !== '')
+ ) {
+ throw new Error('Override IDs must hold 1 to 10 non-empty IDs.');
+ }
+ return await zohoBookingsApi.deleteDateOverrides({ auth, ids });
+ },
+});
diff --git a/packages/pieces/community/zoho-bookings/src/lib/actions/ai/delete-resource.ts b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/delete-resource.ts
new file mode 100644
index 00000000000..2899d4412b1
--- /dev/null
+++ b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/delete-resource.ts
@@ -0,0 +1,36 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+
+import { zohoBookingsAuth } from '../../auth';
+import { zohoBookingsAiProps } from '../../common/ai-props';
+import { zohoBookingsApi } from '../../common/api';
+import { zohoBookingsDeleteRecordOutputSchema } from '../../output-schemas';
+
+export const zohoBookingsDeleteResourceAction = createAction({
+ auth: zohoBookingsAuth,
+ name: 'zoho_bookings_delete_resource',
+ outputSchema: zohoBookingsDeleteRecordOutputSchema,
+ displayName: 'Delete Resource',
+ description: 'Permanently delete a resource.',
+ audience: 'ai',
+ classification: 'DESTRUCTIVE',
+ aiMetadata: {
+ description:
+ 'Permanently delete a resource by ID. Fails while it is assigned to a service or has upcoming appointments. To hide it instead, set its status to inactive with Update Resource.',
+ idempotent: false,
+ },
+ props: {
+ resourceId: zohoBookingsAiProps.resourceId({ required: true }),
+ ignorePastAppointments: Property.Checkbox({
+ displayName: 'Update Past Appointments',
+ description: 'Also update the resource details on past appointments. Defaults to false.',
+ required: false,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await zohoBookingsApi.deleteResource({
+ auth,
+ resourceId: propsValue.resourceId,
+ ignorePastAppointments: propsValue.ignorePastAppointments,
+ });
+ },
+});
diff --git a/packages/pieces/community/zoho-bookings/src/lib/actions/ai/delete-service.ts b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/delete-service.ts
new file mode 100644
index 00000000000..47dd54200ab
--- /dev/null
+++ b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/delete-service.ts
@@ -0,0 +1,27 @@
+import { createAction } from '@activepieces/pieces-framework';
+
+import { zohoBookingsAuth } from '../../auth';
+import { zohoBookingsAiProps } from '../../common/ai-props';
+import { zohoBookingsApi } from '../../common/api';
+import { zohoBookingsStatusMessageOutputSchema } from '../../output-schemas';
+
+export const zohoBookingsDeleteServiceAction = createAction({
+ auth: zohoBookingsAuth,
+ name: 'zoho_bookings_delete_service',
+ outputSchema: zohoBookingsStatusMessageOutputSchema,
+ displayName: 'Delete Service',
+ description: 'Permanently delete a one-on-one service.',
+ audience: 'ai',
+ classification: 'DESTRUCTIVE',
+ aiMetadata: {
+ description:
+ 'Permanently delete a one-on-one service by ID. To hide it instead, set its status to inactive with Update Service. Use List Services for the ID.',
+ idempotent: false,
+ },
+ props: {
+ serviceId: zohoBookingsAiProps.serviceId({ required: true }),
+ },
+ async run({ auth, propsValue }) {
+ return await zohoBookingsApi.deleteService({ auth, serviceId: propsValue.serviceId });
+ },
+});
diff --git a/packages/pieces/community/zoho-bookings/src/lib/actions/ai/delete-workspace.ts b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/delete-workspace.ts
new file mode 100644
index 00000000000..f2bfe4dbcd0
--- /dev/null
+++ b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/delete-workspace.ts
@@ -0,0 +1,36 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+
+import { zohoBookingsAuth } from '../../auth';
+import { zohoBookingsAiProps } from '../../common/ai-props';
+import { zohoBookingsApi } from '../../common/api';
+import { zohoBookingsStatusMessageOutputSchema } from '../../output-schemas';
+
+export const zohoBookingsDeleteWorkspaceAction = createAction({
+ auth: zohoBookingsAuth,
+ name: 'zoho_bookings_delete_workspace',
+ outputSchema: zohoBookingsStatusMessageOutputSchema,
+ displayName: 'Delete Workspace',
+ description: 'Permanently delete a workspace.',
+ audience: 'ai',
+ classification: 'DESTRUCTIVE',
+ aiMetadata: {
+ description:
+ 'Permanently delete a workspace by ID. Fails while it has future appointments or a booked group service; by default it also fails when it has past appointments. To hide a workspace instead, set its status to inactive with Update Workspace.',
+ idempotent: false,
+ },
+ props: {
+ workspaceId: zohoBookingsAiProps.workspaceId({ required: true }),
+ ignorePastAppointments: Property.Checkbox({
+ displayName: 'Delete Even With Past Appointments',
+ description: 'Delete the workspace even if it has past appointments. Defaults to false.',
+ required: false,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await zohoBookingsApi.deleteWorkspace({
+ auth,
+ workspaceId: propsValue.workspaceId,
+ ignorePastAppointments: propsValue.ignorePastAppointments,
+ });
+ },
+});
diff --git a/packages/pieces/community/zoho-bookings/src/lib/actions/ai/get-appointment.ts b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/get-appointment.ts
new file mode 100644
index 00000000000..bb9c7310b1f
--- /dev/null
+++ b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/get-appointment.ts
@@ -0,0 +1,31 @@
+import { createAction } from '@activepieces/pieces-framework';
+
+import { zohoBookingsAuth } from '../../auth';
+import { zohoBookingsAiProps } from '../../common/ai-props';
+import { zohoBookingsApi } from '../../common/api';
+import { zohoBookingsAppointmentOutputSchema } from '../../output-schemas';
+
+export const zohoBookingsGetAppointmentAction = createAction({
+ auth: zohoBookingsAuth,
+ name: 'zoho_bookings_get_appointment',
+ outputSchema: zohoBookingsAppointmentOutputSchema,
+ displayName: 'Get Appointment',
+ description: 'Get one appointment by its booking ID.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description:
+ 'Get the full details of one appointment (customer, service, staff, times, status) by its booking ID. Use List Appointments to search by date, customer or status instead.',
+ idempotent: true,
+ },
+ props: {
+ bookingId: zohoBookingsAiProps.bookingId({ required: true }),
+ },
+ async run({ auth, propsValue }) {
+ const response = await zohoBookingsApi.getAppointment({
+ auth,
+ bookingId: propsValue.bookingId,
+ });
+ return response.response.returnvalue;
+ },
+});
diff --git a/packages/pieces/community/zoho-bookings/src/lib/actions/ai/get-available-slots.ts b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/get-available-slots.ts
new file mode 100644
index 00000000000..9f89d356e09
--- /dev/null
+++ b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/get-available-slots.ts
@@ -0,0 +1,47 @@
+import { createAction } from '@activepieces/pieces-framework';
+
+import { zohoBookingsAuth } from '../../auth';
+import { zohoBookingsAiProps } from '../../common/ai-props';
+import { zohoBookingsApi } from '../../common/api';
+import { zohoBookingsGetAvailableSlotsOutputSchema } from '../../output-schemas';
+
+export const zohoBookingsGetAvailableSlotsAction = createAction({
+ auth: zohoBookingsAuth,
+ name: 'zoho_bookings_get_available_slots',
+ outputSchema: zohoBookingsGetAvailableSlotsOutputSchema,
+ displayName: 'Get Available Slots',
+ description: 'Get the free time slots for a service on a date.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'Get the open time slots on one date for a service, for a staff member, resource or staff group (one is required). Use it before Book Appointment or Reschedule Appointment. Slot times use the time format set in the Zoho Bookings account.',
+ idempotent: true,
+ },
+ props: {
+ serviceId: zohoBookingsAiProps.serviceId({ required: true }),
+ date: zohoBookingsAiProps.dateTime({
+ required: true,
+ displayName: 'Date',
+ description: 'Day to check; only the date part is used.',
+ }),
+ staffId: zohoBookingsAiProps.staffId({ required: false }),
+ resourceId: zohoBookingsAiProps.resourceId({ required: false }),
+ groupId: zohoBookingsAiProps.groupId({ required: false }),
+ },
+ async run({ auth, propsValue }) {
+ if (!propsValue.staffId && !propsValue.resourceId && !propsValue.groupId) {
+ throw new Error('Provide one of Staff ID, Resource ID or Group ID.');
+ }
+ const response = await zohoBookingsApi.getAvailableSlots({
+ auth,
+ serviceId: propsValue.serviceId,
+ selectedDate: propsValue.date,
+ staffId: propsValue.staffId,
+ resourceId: propsValue.resourceId,
+ groupId: propsValue.groupId,
+ });
+ const { time_zone, data } = response.response.returnvalue;
+ return { time_zone, slots: Array.isArray(data) ? data : [] };
+ },
+});
diff --git a/packages/pieces/community/zoho-bookings/src/lib/actions/ai/index.ts b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/index.ts
new file mode 100644
index 00000000000..4f47a37b526
--- /dev/null
+++ b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/index.ts
@@ -0,0 +1,59 @@
+import { zohoBookingsAddStaffAction } from './add-staff';
+import { zohoBookingsBookAppointmentAction } from './book-appointment';
+import { zohoBookingsCreateCustomerAction } from './create-customer';
+import { zohoBookingsCreateDateOverridesAction } from './create-date-overrides';
+import { zohoBookingsCreateResourceAction } from './create-resource';
+import { zohoBookingsCreateServiceAction } from './create-service';
+import { zohoBookingsCreateWorkspaceAction } from './create-workspace';
+import { zohoBookingsDeleteCustomerAction } from './delete-customer';
+import { zohoBookingsDeleteDateOverridesAction } from './delete-date-overrides';
+import { zohoBookingsDeleteResourceAction } from './delete-resource';
+import { zohoBookingsDeleteServiceAction } from './delete-service';
+import { zohoBookingsDeleteWorkspaceAction } from './delete-workspace';
+import { zohoBookingsGetAppointmentAction } from './get-appointment';
+import { zohoBookingsGetAvailableSlotsAction } from './get-available-slots';
+import { zohoBookingsListAppointmentsAction } from './list-appointments';
+import { zohoBookingsListDateOverridesAction } from './list-date-overrides';
+import { zohoBookingsListResourcesAction } from './list-resources';
+import { zohoBookingsListServicesAction } from './list-services';
+import { zohoBookingsListStaffAction } from './list-staff';
+import { zohoBookingsListWorkspacesAction } from './list-workspaces';
+import { zohoBookingsRescheduleAppointmentAction } from './reschedule-appointment';
+import { zohoBookingsUpdateAppointmentDetailsAction } from './update-appointment-details';
+import { zohoBookingsUpdateAppointmentStatusAction } from './update-appointment-status';
+import { zohoBookingsUpdateCustomerAction } from './update-customer';
+import { zohoBookingsUpdateDateOverridesAction } from './update-date-overrides';
+import { zohoBookingsUpdateResourceAction } from './update-resource';
+import { zohoBookingsUpdateServiceAction } from './update-service';
+import { zohoBookingsUpdateWorkspaceAction } from './update-workspace';
+
+export const zohoBookingsAiActions = [
+ zohoBookingsBookAppointmentAction,
+ zohoBookingsGetAppointmentAction,
+ zohoBookingsListAppointmentsAction,
+ zohoBookingsUpdateAppointmentStatusAction,
+ zohoBookingsUpdateAppointmentDetailsAction,
+ zohoBookingsRescheduleAppointmentAction,
+ zohoBookingsGetAvailableSlotsAction,
+ zohoBookingsListWorkspacesAction,
+ zohoBookingsCreateWorkspaceAction,
+ zohoBookingsUpdateWorkspaceAction,
+ zohoBookingsDeleteWorkspaceAction,
+ zohoBookingsListServicesAction,
+ zohoBookingsCreateServiceAction,
+ zohoBookingsUpdateServiceAction,
+ zohoBookingsDeleteServiceAction,
+ zohoBookingsListStaffAction,
+ zohoBookingsAddStaffAction,
+ zohoBookingsListResourcesAction,
+ zohoBookingsCreateResourceAction,
+ zohoBookingsUpdateResourceAction,
+ zohoBookingsDeleteResourceAction,
+ zohoBookingsCreateCustomerAction,
+ zohoBookingsUpdateCustomerAction,
+ zohoBookingsDeleteCustomerAction,
+ zohoBookingsListDateOverridesAction,
+ zohoBookingsCreateDateOverridesAction,
+ zohoBookingsUpdateDateOverridesAction,
+ zohoBookingsDeleteDateOverridesAction,
+];
diff --git a/packages/pieces/community/zoho-bookings/src/lib/actions/ai/list-appointments.ts b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/list-appointments.ts
new file mode 100644
index 00000000000..d866c950b06
--- /dev/null
+++ b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/list-appointments.ts
@@ -0,0 +1,108 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+
+import { zohoBookingsAuth } from '../../auth';
+import { zohoBookingsAiProps } from '../../common/ai-props';
+import { zohoBookingsApi } from '../../common/api';
+import { zohoBookingsListAppointmentsOutputSchema } from '../../output-schemas';
+
+const STATUS_OPTIONS = [
+ { label: 'Upcoming', value: 'UPCOMING' },
+ { label: 'Ongoing', value: 'ONGOING' },
+ { label: 'Pending', value: 'PENDING' },
+ { label: 'Completed', value: 'COMPLETED' },
+ { label: 'Cancelled', value: 'CANCEL' },
+ { label: 'No-show', value: 'NO_SHOW' },
+ { label: 'Pending Payment', value: 'PENDING_PAYMENT' },
+ { label: 'Payment Failed', value: 'PAYMENT_FAILURE' },
+];
+
+export const zohoBookingsListAppointmentsAction = createAction({
+ auth: zohoBookingsAuth,
+ name: 'zoho_bookings_list_appointments',
+ outputSchema: zohoBookingsListAppointmentsOutputSchema,
+ displayName: 'List Appointments',
+ description: 'List appointments in a time range, with optional filters.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'List appointments between two times, optionally filtered by service, staff, resource, status or customer (name, email and phone match on "contains"). With no times it returns today\'s appointments; with only a start time, one day from it. Returns one page; when next_page_available is true, call again with the next page and the same filters.',
+ idempotent: true,
+ },
+ props: {
+ fromTime: zohoBookingsAiProps.dateTime({
+ required: false,
+ displayName: 'From Time',
+ description: 'Start of the range.',
+ }),
+ toTime: zohoBookingsAiProps.dateTime({
+ required: false,
+ displayName: 'To Time',
+ description: 'End of the range.',
+ }),
+ serviceId: zohoBookingsAiProps.serviceId({ required: false }),
+ staffId: zohoBookingsAiProps.staffId({ required: false }),
+ resourceId: zohoBookingsAiProps.resourceId({ required: false }),
+ status: Property.StaticDropdown({
+ displayName: 'Status',
+ required: false,
+ options: { disabled: false, options: STATUS_OPTIONS },
+ }),
+ customerName: Property.ShortText({ displayName: 'Customer Name', required: false }),
+ customerEmail: Property.ShortText({ displayName: 'Customer Email', required: false }),
+ customerPhone: Property.ShortText({ displayName: 'Customer Phone', required: false }),
+ createdFrom: zohoBookingsAiProps.dateTime({
+ required: false,
+ displayName: 'Booked From',
+ description: 'Only appointments booked at or after this time.',
+ }),
+ createdTill: zohoBookingsAiProps.dateTime({
+ required: false,
+ displayName: 'Booked Until',
+ description: 'Only appointments booked at or before this time.',
+ }),
+ includeCustomFields: Property.Checkbox({
+ displayName: 'Include Custom Fields',
+ description: "Also return the booking form's custom fields (smaller pages).",
+ required: false,
+ }),
+ page: Property.Number({
+ displayName: 'Page',
+ description: 'Page number, starting at 1. Defaults to 1.',
+ required: false,
+ }),
+ limit: Property.Number({
+ displayName: 'Limit',
+ description: 'Appointments per page (1-100). Defaults to 50.',
+ required: false,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const page = propsValue.page ?? 1;
+ const limit = Math.min(Math.max(propsValue.limit ?? 50, 1), 100);
+ const result = await zohoBookingsApi.searchAppointments({
+ auth,
+ fromTime: propsValue.fromTime,
+ toTime: propsValue.toTime,
+ serviceId: propsValue.serviceId,
+ staffId: propsValue.staffId,
+ resourceId: propsValue.resourceId,
+ status: propsValue.status,
+ customerName: propsValue.customerName,
+ customerEmail: propsValue.customerEmail,
+ customerPhone: propsValue.customerPhone,
+ createdFrom: propsValue.createdFrom,
+ createdTill: propsValue.createdTill,
+ includeCustomFields: propsValue.includeCustomFields,
+ page,
+ perPage: limit,
+ });
+ const appointments = Array.isArray(result.response) ? result.response : [];
+ return {
+ appointments,
+ count: appointments.length,
+ page,
+ next_page_available: result.next_page_available ?? false,
+ };
+ },
+});
diff --git a/packages/pieces/community/zoho-bookings/src/lib/actions/ai/list-date-overrides.ts b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/list-date-overrides.ts
new file mode 100644
index 00000000000..958e3a762c8
--- /dev/null
+++ b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/list-date-overrides.ts
@@ -0,0 +1,69 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+
+import { zohoBookingsAuth } from '../../auth';
+import { zohoBookingsAiProps } from '../../common/ai-props';
+import { zohoBookingsApi } from '../../common/api';
+import { zohoBookingsListDateOverridesOutputSchema } from '../../output-schemas';
+
+const OVERRIDE_TYPE_OPTIONS = [
+ { label: 'Unavailability', value: 'unavailability' },
+ { label: 'Additional availability', value: 'additional_availability' },
+];
+
+export const zohoBookingsListDateOverridesAction = createAction({
+ auth: zohoBookingsAuth,
+ name: 'zoho_bookings_list_date_overrides',
+ outputSchema: zohoBookingsListDateOverridesOutputSchema,
+ displayName: 'List Date Overrides',
+ description:
+ 'List the date overrides (time off or extra hours) for the business, a staff member or a resource.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'List date overrides (unavailability or additional availability) for the business, a staff member or a resource, optionally within a date range. Returns up to 50 per page; when next_page_available is true, call again with the next page and the same filters. Override IDs are needed by Update and Delete Date Overrides.',
+ idempotent: true,
+ },
+ props: {
+ availabilityFor: zohoBookingsAiProps.availabilityFor({ required: true }),
+ availabilityForId: Property.ShortText({
+ displayName: 'Staff or Resource ID',
+ description: 'Required for a staff member or resource. Use List Staff or List Resources.',
+ required: false,
+ }),
+ type: Property.StaticDropdown({
+ displayName: 'Type',
+ required: false,
+ options: { disabled: false, options: OVERRIDE_TYPE_OPTIONS },
+ }),
+ fromTime: Property.ShortText({
+ displayName: 'From',
+ description: 'Start of the range, e.g. "01-Dec-2026".',
+ required: false,
+ }),
+ toTime: Property.ShortText({
+ displayName: 'To',
+ description: 'End of the range, e.g. "31-Dec-2026". Requires From.',
+ required: false,
+ }),
+ page: Property.Number({
+ displayName: 'Page',
+ description: 'Page number, starting at 1. Defaults to 1.',
+ required: false,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ if (propsValue.availabilityFor !== 'business' && !propsValue.availabilityForId) {
+ throw new Error('Staff or Resource ID is required unless Applies To is Business.');
+ }
+ const page = propsValue.page ?? 1;
+ const result = await zohoBookingsApi.listDateOverrides({ auth, ...propsValue, page });
+ const overrides = Array.isArray(result.overrides) ? result.overrides : [];
+ return {
+ overrides,
+ count: overrides.length,
+ page,
+ next_page_available: result.next_page_available ?? false,
+ };
+ },
+});
diff --git a/packages/pieces/community/zoho-bookings/src/lib/actions/ai/list-resources.ts b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/list-resources.ts
new file mode 100644
index 00000000000..80ac929b854
--- /dev/null
+++ b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/list-resources.ts
@@ -0,0 +1,39 @@
+import { createAction } from '@activepieces/pieces-framework';
+
+import { zohoBookingsAuth } from '../../auth';
+import { zohoBookingsAiProps } from '../../common/ai-props';
+import { zohoBookingsApi } from '../../common/api';
+import { zohoBookingsListResourcesOutputSchema } from '../../output-schemas';
+
+export const zohoBookingsListResourcesAction = createAction({
+ auth: zohoBookingsAuth,
+ name: 'zoho_bookings_list_resources',
+ outputSchema: zohoBookingsListResourcesOutputSchema,
+ displayName: 'List Resources',
+ description: 'List bookable resources, such as rooms or equipment.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'List bookable resources (rooms, equipment) with their IDs and names, optionally narrowed to one resource or to those assigned to a service. Resource IDs are needed by Book Appointment and Get Available Slots.',
+ idempotent: true,
+ },
+ props: {
+ serviceId: zohoBookingsAiProps.serviceId({
+ required: false,
+ description: 'Only resources assigned to this service.',
+ }),
+ resourceId: zohoBookingsAiProps.resourceId({
+ required: false,
+ description: 'Return only this resource.',
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const resources = await zohoBookingsApi.listResources({
+ auth,
+ serviceId: propsValue.serviceId,
+ resourceId: propsValue.resourceId,
+ });
+ return { resources, count: resources.length };
+ },
+});
diff --git a/packages/pieces/community/zoho-bookings/src/lib/actions/ai/list-services.ts b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/list-services.ts
new file mode 100644
index 00000000000..530983739b1
--- /dev/null
+++ b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/list-services.ts
@@ -0,0 +1,41 @@
+import { createAction } from '@activepieces/pieces-framework';
+
+import { zohoBookingsAuth } from '../../auth';
+import { zohoBookingsAiProps } from '../../common/ai-props';
+import { zohoBookingsApi } from '../../common/api';
+import { zohoBookingsListServicesOutputSchema } from '../../output-schemas';
+
+export const zohoBookingsListServicesAction = createAction({
+ auth: zohoBookingsAuth,
+ name: 'zoho_bookings_list_services',
+ outputSchema: zohoBookingsListServicesOutputSchema,
+ displayName: 'List Services',
+ description: 'List the services in a workspace.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'List the services in a workspace with their IDs, durations, costs and assigned staff, optionally narrowed to one service or to the services a staff member offers. Inactive services are not returned. Use List Workspaces for the workspace ID.',
+ idempotent: true,
+ },
+ props: {
+ workspaceId: zohoBookingsAiProps.workspaceId({ required: true }),
+ serviceId: zohoBookingsAiProps.serviceId({
+ required: false,
+ description: 'Return only this service.',
+ }),
+ staffId: zohoBookingsAiProps.staffId({
+ required: false,
+ description: 'Return only services this staff member offers.',
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const services = await zohoBookingsApi.listServices({
+ auth,
+ workspaceId: propsValue.workspaceId,
+ serviceId: propsValue.serviceId,
+ staffId: propsValue.staffId,
+ });
+ return { services, count: services.length };
+ },
+});
diff --git a/packages/pieces/community/zoho-bookings/src/lib/actions/ai/list-staff.ts b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/list-staff.ts
new file mode 100644
index 00000000000..94a2c101d52
--- /dev/null
+++ b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/list-staff.ts
@@ -0,0 +1,47 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+
+import { zohoBookingsAuth } from '../../auth';
+import { zohoBookingsAiProps } from '../../common/ai-props';
+import { zohoBookingsApi } from '../../common/api';
+import { zohoBookingsListStaffOutputSchema } from '../../output-schemas';
+
+export const zohoBookingsListStaffAction = createAction({
+ auth: zohoBookingsAuth,
+ name: 'zoho_bookings_list_staff',
+ outputSchema: zohoBookingsListStaffOutputSchema,
+ displayName: 'List Staff',
+ description: 'List staff members, with optional filters.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'List staff members with their IDs, emails and roles, optionally filtered by workspace, by a service they offer, by staff ID, or by email ("contains" match). Staff IDs are needed by Book Appointment, Get Available Slots and List Appointments.',
+ idempotent: true,
+ },
+ props: {
+ workspaceId: zohoBookingsAiProps.workspaceId({ required: false }),
+ serviceId: zohoBookingsAiProps.serviceId({
+ required: false,
+ description: 'Only staff who offer this service.',
+ }),
+ staffId: zohoBookingsAiProps.staffId({
+ required: false,
+ description: 'Return only this staff member.',
+ }),
+ staffEmail: Property.ShortText({
+ displayName: 'Staff Email',
+ description: 'Only staff whose email contains this text.',
+ required: false,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const staff = await zohoBookingsApi.listStaff({
+ auth,
+ workspaceId: propsValue.workspaceId,
+ serviceId: propsValue.serviceId,
+ staffId: propsValue.staffId,
+ staffEmail: propsValue.staffEmail,
+ });
+ return { staff, count: staff.length };
+ },
+});
diff --git a/packages/pieces/community/zoho-bookings/src/lib/actions/ai/list-workspaces.ts b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/list-workspaces.ts
new file mode 100644
index 00000000000..d1be545f02e
--- /dev/null
+++ b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/list-workspaces.ts
@@ -0,0 +1,34 @@
+import { createAction } from '@activepieces/pieces-framework';
+
+import { zohoBookingsAuth } from '../../auth';
+import { zohoBookingsAiProps } from '../../common/ai-props';
+import { zohoBookingsApi } from '../../common/api';
+import { zohoBookingsListWorkspacesOutputSchema } from '../../output-schemas';
+
+export const zohoBookingsListWorkspacesAction = createAction({
+ auth: zohoBookingsAuth,
+ name: 'zoho_bookings_list_workspaces',
+ outputSchema: zohoBookingsListWorkspacesOutputSchema,
+ displayName: 'List Workspaces',
+ description: 'List the workspaces in the account.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'List every workspace in the Zoho Bookings account with its ID and name, or get one workspace by ID. Workspace IDs are needed by List Services, Create Service and Create Resource.',
+ idempotent: true,
+ },
+ props: {
+ workspaceId: zohoBookingsAiProps.workspaceId({
+ required: false,
+ description: 'Return only this workspace. Leave empty to list all.',
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const workspaces = await zohoBookingsApi.listWorkspaces({
+ auth,
+ workspaceId: propsValue.workspaceId,
+ });
+ return { workspaces, count: workspaces.length };
+ },
+});
diff --git a/packages/pieces/community/zoho-bookings/src/lib/actions/ai/reschedule-appointment.ts b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/reschedule-appointment.ts
new file mode 100644
index 00000000000..3419be1fca8
--- /dev/null
+++ b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/reschedule-appointment.ts
@@ -0,0 +1,40 @@
+import { createAction } from '@activepieces/pieces-framework';
+
+import { zohoBookingsAuth } from '../../auth';
+import { zohoBookingsAiProps } from '../../common/ai-props';
+import { zohoBookingsApi } from '../../common/api';
+import { zohoBookingsAppointmentOutputSchema } from '../../output-schemas';
+
+export const zohoBookingsRescheduleAppointmentAction = createAction({
+ auth: zohoBookingsAuth,
+ name: 'zoho_bookings_reschedule_appointment',
+ outputSchema: zohoBookingsAppointmentOutputSchema,
+ displayName: 'Reschedule Appointment',
+ description: 'Move an appointment to a new time or another staff member.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Move an appointment, by its booking ID, to a new start time and/or a different staff member or staff group. Provide at least one of the three; use Get Available Slots to pick a free time. Not idempotent.',
+ idempotent: false,
+ },
+ props: {
+ bookingId: zohoBookingsAiProps.bookingId({ required: true }),
+ startTime: zohoBookingsAiProps.dateTime({ required: false, displayName: 'New Start Time' }),
+ staffId: zohoBookingsAiProps.staffId({ required: false }),
+ groupId: zohoBookingsAiProps.groupId({ required: false }),
+ },
+ async run({ auth, propsValue }) {
+ if (!propsValue.startTime && !propsValue.staffId && !propsValue.groupId) {
+ throw new Error('Provide at least one of New Start Time, Staff ID or Group ID.');
+ }
+ const response = await zohoBookingsApi.rescheduleAppointment({
+ auth,
+ bookingId: propsValue.bookingId,
+ startTime: propsValue.startTime,
+ staffId: propsValue.staffId,
+ groupId: propsValue.groupId,
+ });
+ return response.returnvalue;
+ },
+});
diff --git a/packages/pieces/community/zoho-bookings/src/lib/actions/ai/update-appointment-details.ts b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/update-appointment-details.ts
new file mode 100644
index 00000000000..e64d0a614b0
--- /dev/null
+++ b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/update-appointment-details.ts
@@ -0,0 +1,51 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+
+import { zohoBookingsAuth } from '../../auth';
+import { zohoBookingsAiProps } from '../../common/ai-props';
+import { zohoBookingsApi } from '../../common/api';
+import { zohoBookingsStatusMessageOutputSchema } from '../../output-schemas';
+
+export const zohoBookingsUpdateAppointmentDetailsAction = createAction({
+ auth: zohoBookingsAuth,
+ name: 'zoho_bookings_update_appointment_details',
+ outputSchema: zohoBookingsStatusMessageOutputSchema,
+ displayName: 'Update Appointment Details',
+ description: "Update an appointment's notes or custom fields.",
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Replace the notes and/or set custom booking fields on an appointment by its booking ID. Only the fields you pass change. Use Reschedule Appointment to change its time or staff.',
+ idempotent: true,
+ },
+ props: {
+ bookingId: zohoBookingsAiProps.bookingId({ required: true }),
+ notes: Property.LongText({
+ displayName: 'Notes',
+ description: 'New notes; replaces the existing notes.',
+ required: false,
+ }),
+ customFields: Property.Json({
+ displayName: 'Custom Fields',
+ description:
+ 'Custom booking fields to set, keyed by field label, e.g. {"Department": "Sales"}.',
+ required: false,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ if (propsValue.notes === undefined && propsValue.customFields === undefined) {
+ throw new Error('Provide Notes, Custom Fields or both.');
+ }
+ return await zohoBookingsApi.updateAppointment({
+ auth,
+ bookingId: propsValue.bookingId,
+ action: 'edit_appointment_info',
+ data: {
+ ...(propsValue.notes !== undefined ? { notes: propsValue.notes } : {}),
+ ...(propsValue.customFields !== undefined
+ ? { custom_fields: propsValue.customFields }
+ : {}),
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/zoho-bookings/src/lib/actions/ai/update-appointment-status.ts b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/update-appointment-status.ts
new file mode 100644
index 00000000000..fe7bb0c3913
--- /dev/null
+++ b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/update-appointment-status.ts
@@ -0,0 +1,43 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+
+import { zohoBookingsAuth } from '../../auth';
+import { zohoBookingsAiProps } from '../../common/ai-props';
+import { zohoBookingsApi } from '../../common/api';
+import { zohoBookingsAppointmentOutputSchema } from '../../output-schemas';
+
+export const zohoBookingsUpdateAppointmentStatusAction = createAction({
+ auth: zohoBookingsAuth,
+ name: 'zoho_bookings_update_appointment_status',
+ outputSchema: zohoBookingsAppointmentOutputSchema,
+ displayName: 'Update Appointment Status',
+ description: 'Mark an appointment as completed, cancelled or no-show.',
+ audience: 'ai',
+ classification: 'DESTRUCTIVE',
+ aiMetadata: {
+ description:
+ "Set an appointment's status to completed, cancelled or no-show by its booking ID. Completed and no-show are accepted only after the appointment's start time. Cancelling frees the slot and can't be undone through the API. Use Reschedule Appointment to move it instead.",
+ idempotent: true,
+ },
+ props: {
+ bookingId: zohoBookingsAiProps.bookingId({ required: true }),
+ status: Property.StaticDropdown({
+ displayName: 'Status',
+ required: true,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'Completed', value: 'completed' },
+ { label: 'Cancelled', value: 'cancel' },
+ { label: 'No-show', value: 'noshow' },
+ ],
+ },
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await zohoBookingsApi.updateAppointment({
+ auth,
+ bookingId: propsValue.bookingId,
+ action: propsValue.status,
+ });
+ },
+});
diff --git a/packages/pieces/community/zoho-bookings/src/lib/actions/ai/update-customer.ts b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/update-customer.ts
new file mode 100644
index 00000000000..af345e231cd
--- /dev/null
+++ b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/update-customer.ts
@@ -0,0 +1,37 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+
+import { zohoBookingsAuth } from '../../auth';
+import { zohoBookingsAiProps } from '../../common/ai-props';
+import { zohoBookingsApi } from '../../common/api';
+import { zohoBookingsCustomerOutputSchema } from '../../output-schemas';
+
+export const zohoBookingsUpdateCustomerAction = createAction({
+ auth: zohoBookingsAuth,
+ name: 'zoho_bookings_update_customer',
+ outputSchema: zohoBookingsCustomerOutputSchema,
+ displayName: 'Update Customer',
+ description: "Update a customer's name, email or phone.",
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ "Change a customer's name, email or phone by customer ID. Only the fields you pass change. The ID comes from Create Customer or from the customer's page URL in Zoho Bookings.",
+ idempotent: true,
+ },
+ props: {
+ customerId: Property.ShortText({
+ displayName: 'Customer ID',
+ description:
+ "From Create Customer, or the number in the customer's page URL in Zoho Bookings.",
+ required: true,
+ }),
+ ...zohoBookingsAiProps.customerFields(),
+ },
+ async run({ auth, propsValue }) {
+ const { customerId, ...customer } = propsValue;
+ if (Object.values(customer).every((value) => value === undefined)) {
+ throw new Error('Provide at least one field to update.');
+ }
+ return await zohoBookingsApi.updateCustomer({ auth, customerId, ...customer });
+ },
+});
diff --git a/packages/pieces/community/zoho-bookings/src/lib/actions/ai/update-date-overrides.ts b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/update-date-overrides.ts
new file mode 100644
index 00000000000..a834e439730
--- /dev/null
+++ b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/update-date-overrides.ts
@@ -0,0 +1,35 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+
+import { zohoBookingsAuth } from '../../auth';
+import { zohoBookingsApi } from '../../common/api';
+import { zohoBookingsUpdateDateOverridesOutputSchema } from '../../output-schemas';
+
+export const zohoBookingsUpdateDateOverridesAction = createAction({
+ auth: zohoBookingsAuth,
+ name: 'zoho_bookings_update_date_overrides',
+ outputSchema: zohoBookingsUpdateDateOverridesOutputSchema,
+ displayName: 'Update Date Overrides',
+ description: 'Update existing date overrides.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Replace 1-10 existing date overrides by ID. Each override is sent in full (id, type and mode are required), so read it with List Date Overrides first and change only what you need.',
+ idempotent: true,
+ },
+ props: {
+ overrides: Property.Json({
+ displayName: 'Overrides',
+ description:
+ 'Array of 1-10 overrides, each with id, type, mode and the same fields as Create Date Overrides, e.g. [{"id": "82045000000210001", "type": "unavailability", "mode": "specific_dates", "dates": ["27-Dec-2026"], "all_day": true}].',
+ required: true,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const overrides = propsValue.overrides;
+ if (!Array.isArray(overrides) || overrides.length === 0 || overrides.length > 10) {
+ throw new Error('Overrides must be an array of 1 to 10 overrides.');
+ }
+ return await zohoBookingsApi.updateDateOverrides({ auth, overrides });
+ },
+});
diff --git a/packages/pieces/community/zoho-bookings/src/lib/actions/ai/update-resource.ts b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/update-resource.ts
new file mode 100644
index 00000000000..0879b0db195
--- /dev/null
+++ b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/update-resource.ts
@@ -0,0 +1,60 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+
+import { zohoBookingsAuth } from '../../auth';
+import { zohoBookingsAiProps } from '../../common/ai-props';
+import { zohoBookingsApi } from '../../common/api';
+import { zohoBookingsUpdateResourceOutputSchema } from '../../output-schemas';
+
+export const zohoBookingsUpdateResourceAction = createAction({
+ auth: zohoBookingsAuth,
+ name: 'zoho_bookings_update_resource',
+ outputSchema: zohoBookingsUpdateResourceOutputSchema,
+ displayName: 'Update Resource',
+ description: 'Update a resource.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ "Change a resource's name, status, description, workspaces, services or person in charge. Only the fields you pass change; the workspace and service lists replace the current ones. Use List Resources for the ID.",
+ idempotent: true,
+ },
+ props: {
+ resourceId: zohoBookingsAiProps.resourceId({ required: true }),
+ name: Property.ShortText({ displayName: 'Name', required: false }),
+ status: Property.StaticDropdown({
+ displayName: 'Status',
+ required: false,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'Active', value: 'active' },
+ { label: 'Inactive', value: 'in_active' },
+ ],
+ },
+ }),
+ description: Property.LongText({ displayName: 'Description', required: false }),
+ workspaceIds: Property.Array({
+ displayName: 'Workspace IDs',
+ description: 'Use List Workspaces.',
+ required: false,
+ }),
+ serviceIds: Property.Array({
+ displayName: 'Service IDs',
+ description: 'Use List Services.',
+ required: false,
+ }),
+ userInCharge: Property.ShortText({
+ displayName: 'User in Charge',
+ description: 'Email of the staff member in charge of the resource.',
+ required: false,
+ }),
+ ignorePastAppointments: Property.Checkbox({
+ displayName: 'Update Past Appointments',
+ description: 'Also apply the new details to past appointments. Defaults to false.',
+ required: false,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await zohoBookingsApi.updateResource({ auth, ...propsValue });
+ },
+});
diff --git a/packages/pieces/community/zoho-bookings/src/lib/actions/ai/update-service.ts b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/update-service.ts
new file mode 100644
index 00000000000..1fb0587feb5
--- /dev/null
+++ b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/update-service.ts
@@ -0,0 +1,40 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+
+import { zohoBookingsAuth } from '../../auth';
+import { zohoBookingsAiProps } from '../../common/ai-props';
+import { zohoBookingsApi } from '../../common/api';
+import { zohoBookingsStatusMessageOutputSchema } from '../../output-schemas';
+
+export const zohoBookingsUpdateServiceAction = createAction({
+ auth: zohoBookingsAuth,
+ name: 'zoho_bookings_update_service',
+ outputSchema: zohoBookingsStatusMessageOutputSchema,
+ displayName: 'Update Service',
+ description: 'Update a one-on-one service.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ "Change a one-on-one service's name, duration, cost, buffers, description, assigned staff, meeting mode or status (active or inactive). Only the fields you pass change; Staff IDs replaces the whole assigned list. Use List Services for the ID.",
+ idempotent: true,
+ },
+ props: {
+ serviceId: zohoBookingsAiProps.serviceId({ required: true }),
+ name: Property.ShortText({ displayName: 'Name', required: false }),
+ status: Property.StaticDropdown({
+ displayName: 'Status',
+ required: false,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'Active', value: 'active' },
+ { label: 'Inactive', value: 'in_active' },
+ ],
+ },
+ }),
+ ...zohoBookingsAiProps.serviceFields(),
+ },
+ async run({ auth, propsValue }) {
+ return await zohoBookingsApi.updateService({ auth, ...propsValue });
+ },
+});
diff --git a/packages/pieces/community/zoho-bookings/src/lib/actions/ai/update-workspace.ts b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/update-workspace.ts
new file mode 100644
index 00000000000..c05a7ced8f0
--- /dev/null
+++ b/packages/pieces/community/zoho-bookings/src/lib/actions/ai/update-workspace.ts
@@ -0,0 +1,74 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+
+import { zohoBookingsAuth } from '../../auth';
+import { zohoBookingsAiProps } from '../../common/ai-props';
+import { zohoBookingsApi } from '../../common/api';
+import { zohoBookingsStatusMessageOutputSchema } from '../../output-schemas';
+
+export const zohoBookingsUpdateWorkspaceAction = createAction({
+ auth: zohoBookingsAuth,
+ name: 'zoho_bookings_update_workspace',
+ outputSchema: zohoBookingsStatusMessageOutputSchema,
+ displayName: 'Update Workspace',
+ description: "Update a workspace's name, status, description or settings.",
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ "Change a workspace's name, status (active or inactive), description, notification senders or policies. Only the fields you pass change; at least one is required. Use List Workspaces for the ID.",
+ idempotent: true,
+ },
+ props: {
+ workspaceId: zohoBookingsAiProps.workspaceId({ required: true }),
+ name: Property.ShortText({ displayName: 'Name', required: false }),
+ status: Property.StaticDropdown({
+ displayName: 'Status',
+ required: false,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'Active', value: 'active' },
+ { label: 'Inactive', value: 'in_active' },
+ ],
+ },
+ }),
+ description: Property.LongText({
+ displayName: 'Description',
+ description: 'Up to 2000 characters.',
+ required: false,
+ }),
+ mailNotifications: Property.Json({
+ displayName: 'Mail Notifications',
+ description:
+ 'Sender settings, e.g. {"customer": {"email": "business", "replyto": "superadmin", "cc": "staff"}, "staff": {"email": "bookings", "replyto": "customer"}}.',
+ required: false,
+ }),
+ policiesAndPreferences: Property.Json({
+ displayName: 'Policies and Preferences',
+ description:
+ 'Workspace policies, e.g. {"scheduling_interval": 15, "customer_select_staff": "true", "prefix": "LA", "minimum_booking_notice": 30, "enable_cancel": "true"}.',
+ required: false,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const changes = {
+ ...(propsValue.name !== undefined ? { name: propsValue.name } : {}),
+ ...(propsValue.status !== undefined ? { status: propsValue.status } : {}),
+ ...(propsValue.description !== undefined ? { description: propsValue.description } : {}),
+ ...(propsValue.mailNotifications !== undefined
+ ? { mail_notifications: propsValue.mailNotifications }
+ : {}),
+ ...(propsValue.policiesAndPreferences !== undefined
+ ? { policies_and_preferences: propsValue.policiesAndPreferences }
+ : {}),
+ };
+ if (Object.keys(changes).length === 0) {
+ throw new Error('Provide at least one field to update.');
+ }
+ return await zohoBookingsApi.updateWorkspace({
+ auth,
+ workspaceId: propsValue.workspaceId,
+ changes,
+ });
+ },
+});
diff --git a/packages/pieces/community/zoho-bookings/src/lib/actions/book-appointment.ts b/packages/pieces/community/zoho-bookings/src/lib/actions/book-appointment.ts
index b8311367199..602a24ffef0 100644
--- a/packages/pieces/community/zoho-bookings/src/lib/actions/book-appointment.ts
+++ b/packages/pieces/community/zoho-bookings/src/lib/actions/book-appointment.ts
@@ -1,172 +1,38 @@
import { propsValidation } from '@activepieces/pieces-common';
import { createAction, Property } from '@activepieces/pieces-framework';
-import { httpClient, HttpMethod } from '@activepieces/pieces-common';
-import { formatDateTime, zohoBookingsAuth, zohoBookingsCommon } from '../common';
+import * as z from 'zod/mini';
+import { zohoBookingsAuth } from '../auth';
+import { zohoBookingsApi } from '../common/api';
+import { zohoBookingsProps } from '../common/props';
+import { bookAppointmentOutputSchema } from '../output-schemas';
-export const bookAppointment = createAction({
+export const bookAppointmentAction = createAction({
auth: zohoBookingsAuth,
name: 'bookAppointment',
+ outputSchema: bookAppointmentOutputSchema,
+ classification: 'WRITE',
displayName: 'Book Appointment',
description: 'Book an appointment for a customer for a desired service',
- audience: 'both',
+ audience: 'human',
aiMetadata: {
description:
'Create a new appointment in a Zoho Bookings workspace for a given service, customer (name/email/phone), and start time. Assign the booking to exactly one of staff, resource, or group (the call fails if none is supplied). Not idempotent: each call books a separate appointment.',
idempotent: false,
},
props: {
- workspace_id: Property.Dropdown({
- auth: zohoBookingsAuth,
- displayName: 'Workspace',
- description: 'Select the workspace for the appointment',
+ workspace_id: zohoBookingsProps.workspaceId({
required: true,
- refreshers: [],
- options: async ({ auth }) => {
- if (!auth) {
- return {
- disabled: true,
- placeholder: 'Authentication required',
- options: [],
- };
- }
-
- try {
- const location = (auth as any).props?.['location'] || 'zoho.com';
- const workspaces = await zohoBookingsCommon.fetchWorkspaces(
- (auth as any).access_token,
- location
- );
-
- return {
- options: workspaces.map((workspace: any) => ({
- label: workspace.name,
- value: workspace.id,
- })),
- };
- } catch (error) {
- return {
- disabled: true,
- placeholder: 'Failed to load workspaces',
- options: [],
- };
- }
- },
+ description: 'Select the workspace for the appointment',
}),
- service_id: Property.Dropdown({
- auth: zohoBookingsAuth,
- displayName: 'Service',
- description: 'Select the service for which the appointment is booked',
+ service_id: zohoBookingsProps.serviceId({
required: true,
- refreshers: ['workspace_id'],
- options: async ({ auth, workspace_id }) => {
- if (!workspace_id || !auth) {
- return {
- disabled: true,
- placeholder: 'Please enter workspace ID first',
- options: [],
- };
- }
-
- try {
- const location = (auth as any).props?.['location'] || 'zoho.com';
- const services = await zohoBookingsCommon.fetchServices(
- (auth as any).access_token,
- location,
- workspace_id as string
- );
-
- return {
- options: services.map((service: any) => ({
- label: `${service.name} (${service.duration})`,
- value: service.id,
- })),
- };
- } catch (error) {
- return {
- disabled: true,
- placeholder: 'Failed to load services',
- options: [],
- };
- }
- },
- }),
- staff_id: Property.Dropdown({
- auth: zohoBookingsAuth,
- displayName: 'Staff',
- description:
- 'Select the staff member (use this OR resource_id OR group_id)',
- required: false,
- refreshers: ['service_id'],
- options: async ({ auth, service_id }) => {
- if (!service_id || !auth) {
- return {
- disabled: true,
- placeholder: 'Please select service first',
- options: [],
- };
- }
-
- try {
- const location = (auth as any).props?.['location'] || 'zoho.com';
- const staff = await zohoBookingsCommon.fetchStaff(
- (auth as any).access_token,
- location,
- service_id as string
- );
-
- return {
- options: staff.map((member: any) => ({
- label: `${member.name} - ${member.designation || 'Staff'}`,
- value: member.id,
- })),
- };
- } catch (error) {
- return {
- disabled: true,
- placeholder: 'Failed to load staff',
- options: [],
- };
- }
- },
+ description: 'Select the service for which the appointment is booked',
}),
- resource_id: Property.Dropdown({
- auth: zohoBookingsAuth,
- displayName: 'Resource',
- description: 'Select the resource (use this OR staff_id OR group_id)',
+ staff_id: zohoBookingsProps.staffId({
required: false,
- refreshers: ['service_id'],
- options: async ({ auth, service_id }) => {
- if (!service_id || !auth) {
- return {
- disabled: true,
- placeholder: 'Please select service first',
- options: [],
- };
- }
-
- try {
- const location = auth.props?.['location'] as string || 'zoho.com';
- const resources = await zohoBookingsCommon.fetchResources(
- auth.access_token,
- location,
- service_id as string
- );
-
- return {
- options: resources.map((resource: any) => ({
- label: resource.name,
- value: resource.id,
- })),
- };
- } catch (error) {
- return {
- disabled: true,
- placeholder: 'Failed to load resources',
- options: [],
- };
- }
- },
+ description: 'Select the staff member (use this OR resource_id OR group_id)',
}),
+ resource_id: zohoBookingsProps.resourceId({ required: false }),
group_id: Property.ShortText({
displayName: 'Group ID',
description:
@@ -223,86 +89,45 @@ export const bookAppointment = createAction({
},
async run(context) {
const { auth, propsValue } = context;
- const location = auth.props?.['location'] as string || 'zoho.com';
- // Validate props using Zod schema
- await propsValidation.validateZod(
- propsValue,
- zohoBookingsCommon.bookAppointmentSchema
- );
+ await propsValidation.validateZod(propsValue, schema);
- // Validate that at least one of staff_id, resource_id, or group_id is provided
- if (
- !propsValue.staff_id &&
- !propsValue.resource_id &&
- !propsValue.group_id
- ) {
- throw new Error(
- 'Either staff_id, resource_id, or group_id must be provided'
- );
+ if (!propsValue.staff_id && !propsValue.resource_id && !propsValue.group_id) {
+ throw new Error('Either staff_id, resource_id, or group_id must be provided');
}
- // Prepare customer details
- const customer_details = {
- name: String(propsValue.customer_name),
- email: String(propsValue.customer_email),
- phone_number: String(propsValue.customer_phone),
- };
- const customer_details_json = JSON.stringify(customer_details);
- // Prepare form data
- const formData = new FormData();
- formData.append('service_id', propsValue.service_id as string);
- formData.append('from_time', formatDateTime(propsValue.from_time));
-
- formData.append('customer_details', customer_details_json);
-
- // Add optional staff/resource/group ID
- if (propsValue.staff_id != null && propsValue.staff_id) {
- formData.append('staff_id', propsValue.staff_id as string);
- }
- if (propsValue.resource_id != null && propsValue.resource_id) {
- formData.append('resource_id', propsValue.resource_id as string);
- }
- if (propsValue.group_id != null && propsValue.group_id) {
- formData.append('group_id', propsValue.group_id as string);
- }
-
- // Add optional fields
- if (propsValue.to_time) {
- formData.append('to_time', formatDateTime(propsValue.to_time));
- }
- if (propsValue.timezone) {
- formData.append('timezone', propsValue.timezone);
- }
- if (propsValue.notes) {
- formData.append('notes', propsValue.notes);
- }
- if (propsValue.additional_fields) {
- formData.append(
- 'additional_fields',
- JSON.stringify(propsValue.additional_fields)
- );
- }
- if (propsValue.cost_paid) {
- formData.append(
- 'payment_info',
- JSON.stringify({ cost_paid: propsValue.cost_paid.toString() })
- );
- }
-
- const response = await httpClient.sendRequest({
- method: HttpMethod.POST,
- url: `${zohoBookingsCommon.baseUrl(location)}/appointment`,
- headers: {
- Authorization: `Zoho-oauthtoken ${auth.access_token}`,
- 'Content-Type': 'application/x-www-form-urlencoded',
- },
- body: formData,
+ return await zohoBookingsApi.bookAppointment({
+ auth,
+ serviceId: propsValue.service_id,
+ fromTime: propsValue.from_time,
+ customerName: propsValue.customer_name,
+ customerEmail: propsValue.customer_email,
+ customerPhone: propsValue.customer_phone,
+ staffId: propsValue.staff_id,
+ resourceId: propsValue.resource_id,
+ groupId: propsValue.group_id,
+ toTime: propsValue.to_time,
+ timezone: propsValue.timezone,
+ notes: propsValue.notes,
+ additionalFields: propsValue.additional_fields,
+ costPaid: propsValue.cost_paid,
});
-
- if (response.body.response.status === 'failure') {
- throw new Error(`${response.body.response.errormessage}`);
- }
- return response.body.response;
},
});
+
+const schema = {
+ workspace_id: z.string().check(z.minLength(1)),
+ service_id: z.string().check(z.minLength(1)),
+ staff_id: z.optional(z.string()),
+ resource_id: z.optional(z.string()),
+ group_id: z.optional(z.string()),
+ from_time: z.string(),
+ to_time: z.optional(z.string()),
+ timezone: z.optional(z.string()),
+ customer_name: z.string().check(z.minLength(1)),
+ customer_email: z.string().check(z.email()),
+ customer_phone: z.string().check(z.minLength(1)),
+ notes: z.optional(z.string()),
+ additional_fields: z.optional(z.record(z.string(), z.unknown())),
+ cost_paid: z.optional(z.number().check(z.minimum(0))),
+};
diff --git a/packages/pieces/community/zoho-bookings/src/lib/actions/cancel-appointment.ts b/packages/pieces/community/zoho-bookings/src/lib/actions/cancel-appointment.ts
index fbe5eb53c72..52fc0449ff5 100644
--- a/packages/pieces/community/zoho-bookings/src/lib/actions/cancel-appointment.ts
+++ b/packages/pieces/community/zoho-bookings/src/lib/actions/cancel-appointment.ts
@@ -1,15 +1,20 @@
import { propsValidation } from '@activepieces/pieces-common';
import { createAction, Property } from '@activepieces/pieces-framework';
-import { httpClient, HttpMethod } from '@activepieces/pieces-common';
-import { bookingIdDropdown, zohoBookingsAuth, zohoBookingsCommon } from '../common';
+import * as z from 'zod/mini';
+import { zohoBookingsAuth } from '../auth';
+import { zohoBookingsApi } from '../common/api';
+import { zohoBookingsProps } from '../common/props';
+import { getAppointmentDetailsOutputSchema } from '../output-schemas';
-export const cancelAppointment = createAction({
+export const cancelAppointmentAction = createAction({
auth: zohoBookingsAuth,
name: 'cancelAppointment',
+ outputSchema: getAppointmentDetailsOutputSchema,
+ classification: 'DESTRUCTIVE',
displayName: 'Cancel Appointment',
description:
'Update the status of a booking (cancel, complete, or mark as no-show)',
- audience: 'both',
+ audience: 'human',
aiMetadata: {
description:
'Cancel an existing Zoho Bookings appointment identified by its booking ID. Use the from/to time range to locate the booking ID first. Not idempotent: it submits a status-change request each call, though re-cancelling an already-cancelled booking has no further effect.',
@@ -28,33 +33,20 @@ export const cancelAppointment = createAction({
'The ending time for the appointment (format: mm-dd-yyyy HH:mm:ss)',
required: false,
}),
- booking_id: bookingIdDropdown,
+ booking_id: zohoBookingsProps.bookingId({ required: true }),
},
async run(context) {
const { auth, propsValue } = context;
- const location = auth.props?.['location'] as string || 'zoho.com';
- // Validate props using Zod schema
- await propsValidation.validateZod(
- propsValue,
- zohoBookingsCommon.cancelAppointmentSchema
- );
+ await propsValidation.validateZod(propsValue, schema);
- // Prepare form data
- const formData = new FormData();
- formData.append('booking_id', propsValue.booking_id as string);
- formData.append('action', 'cancel');
-
- const response = await httpClient.sendRequest({
- method: HttpMethod.POST,
- url: `${zohoBookingsCommon.baseUrl(location)}/updateappointment`,
- headers: {
- Authorization: `Zoho-oauthtoken ${auth.access_token}`,
- contentType: 'application/x-www-form-urlencoded',
- },
- body: formData,
+ return await zohoBookingsApi.cancelAppointment({
+ auth,
+ bookingId: propsValue.booking_id,
});
-
- return response.body;
},
});
+
+const schema = {
+ booking_id: z.string().check(z.minLength(1)),
+};
diff --git a/packages/pieces/community/zoho-bookings/src/lib/actions/fetch-availability.ts b/packages/pieces/community/zoho-bookings/src/lib/actions/fetch-availability.ts
index cd95df82b36..835ba50c236 100644
--- a/packages/pieces/community/zoho-bookings/src/lib/actions/fetch-availability.ts
+++ b/packages/pieces/community/zoho-bookings/src/lib/actions/fetch-availability.ts
@@ -1,229 +1,76 @@
import { propsValidation } from '@activepieces/pieces-common';
import { createAction, Property } from '@activepieces/pieces-framework';
-import { httpClient, HttpMethod } from '@activepieces/pieces-common';
-import { zohoBookingsAuth, zohoBookingsCommon } from '../common';
+import * as z from 'zod/mini';
+import { zohoBookingsAuth } from '../auth';
+import { zohoBookingsApi } from '../common/api';
+import { zohoBookingsProps } from '../common/props';
+import { fetchAvailabilityOutputSchema } from '../output-schemas';
-export const fetchAvailability = createAction({
+export const fetchAvailabilityAction = createAction({
auth: zohoBookingsAuth,
name: 'fetchAvailability',
+ outputSchema: fetchAvailabilityOutputSchema,
+ classification: 'SEARCH',
displayName: 'Fetch Availability',
description: 'Fetch availability of appointments across services',
- audience: 'both',
+ audience: 'human',
aiMetadata: {
description:
'Look up open appointment slots for a service in a Zoho Bookings workspace on a given date. Scope the lookup to exactly one of staff, group, or resource (the call fails if none is supplied). Use this before booking to find valid times. Read-only and idempotent.',
idempotent: true,
},
props: {
- workspace_id: Property.Dropdown({
- auth: zohoBookingsAuth,
- displayName: 'Workspace',
- description: 'Select the workspace to fetch availability for',
+ workspace_id: zohoBookingsProps.workspaceId({
required: true,
- refreshers: [],
- options: async ({ auth }) => {
- if (!auth) {
- return {
- disabled: true,
- placeholder: 'Authentication required',
- options: [],
- };
- }
-
- try {
- const location = (auth as any).props?.['location'] || 'zoho.com';
- const workspaces = await zohoBookingsCommon.fetchWorkspaces(
- (auth as any).access_token,
- location
- );
-
- return {
- options: workspaces.map((workspace: any) => ({
- label: workspace.name,
- value: workspace.id,
- })),
- };
- } catch (error) {
- return {
- disabled: true,
- placeholder: 'Failed to load workspaces',
- options: [],
- };
- }
- },
+ description: 'Select the workspace to fetch availability for',
}),
- service_id: Property.Dropdown({
- auth: zohoBookingsAuth,
- displayName: 'Service',
- description: 'Select the service for which availability is to be fetched',
+ service_id: zohoBookingsProps.serviceId({
required: true,
- refreshers: ['workspace_id'],
- options: async ({ auth, workspace_id }) => {
- if (!workspace_id || !auth) {
- return {
- disabled: true,
- placeholder: 'Please enter workspace ID first',
- options: [],
- };
- }
-
- try {
- const location = (auth as any).props?.['location'] || 'zoho.com';
- const services = await zohoBookingsCommon.fetchServices(
- (auth as any).access_token,
- location,
- workspace_id as string
- );
-
- return {
- options: services.map((service: any) => ({
- label: `${service.name} (${service.duration})`,
- value: service.id,
- })),
- };
- } catch (error) {
- return {
- disabled: true,
- placeholder: 'Failed to load services',
- options: [],
- };
- }
- },
+ description: 'Select the service for which availability is to be fetched',
}),
- staff_id: Property.Dropdown({
- auth: zohoBookingsAuth,
- displayName: 'Staff',
- description: 'Select the staff member (use this OR group_id OR resource_id)',
+ staff_id: zohoBookingsProps.staffId({
required: false,
- refreshers: ['service_id'],
- options: async ({ auth, service_id }) => {
- if (!service_id || !auth) {
- return {
- disabled: true,
- placeholder: 'Please select service first',
- options: [],
- };
- }
-
- try {
- const location = (auth as any).props?.['location'] || 'zoho.com';
- const staff = await zohoBookingsCommon.fetchStaff(
- (auth as any).access_token,
- location,
- service_id as string
- );
-
- return {
- options: staff.map((member: any) => ({
- label: `${member.name} - ${member.designation || 'Staff'}`,
- value: member.id,
- })),
- };
- } catch (error) {
- return {
- disabled: true,
- placeholder: 'Failed to load staff',
- options: [],
- };
- }
- },
+ description: 'Select the staff member (use this OR group_id OR resource_id)',
}),
group_id: Property.ShortText({
displayName: 'Group ID',
- description: 'The unique ID of the staff group associated with the service (use this OR staff_id OR resource_id)',
+ description:
+ 'The unique ID of the staff group associated with the service (use this OR staff_id OR resource_id)',
required: false,
}),
- resource_id: Property.Dropdown({
- auth: zohoBookingsAuth,
- displayName: 'Resource',
- description: 'Select the resource (use this OR staff_id OR group_id)',
- required: false,
- refreshers: ['service_id'],
- options: async ({ auth, service_id }) => {
- if (!service_id || !auth) {
- return {
- disabled: true,
- placeholder: 'Please select service first',
- options: [],
- };
- }
-
- try {
- const location = (auth as any).props?.['location'] || 'zoho.com';
- const resources = await zohoBookingsCommon.fetchResources(
- (auth as any).access_token,
- location,
- service_id as string
- );
-
- return {
- options: resources.map((resource: any) => ({
- label: resource.name,
- value: resource.id,
- })),
- };
- } catch (error) {
- return {
- disabled: true,
- placeholder: 'Failed to load resources',
- options: [],
- };
- }
- },
- }),
+ resource_id: zohoBookingsProps.resourceId({ required: false }),
selected_date: Property.DateTime({
displayName: 'Selected Date',
- description: 'The date on which services are checked for availability (format: mm-dd-yyyy)',
+ description:
+ 'The date on which services are checked for availability (format: mm-dd-yyyy)',
required: true,
}),
},
async run(context) {
const { auth, propsValue } = context;
- const location = auth.props?.['location'] as string || 'zoho.com';
- // Validate props using Zod schema
- await propsValidation.validateZod(propsValue, zohoBookingsCommon.fetchAvailabilitySchema);
+ await propsValidation.validateZod(propsValue, schema);
- // Validate that at least one of staff_id, group_id, or resource_id is provided
if (!propsValue.staff_id && !propsValue.group_id && !propsValue.resource_id) {
throw new Error('Either staff_id, group_id, or resource_id must be provided');
}
- // Format date to YYYY-MM-DD format
- const formatDate = (date: string) => {
- const d = new Date(date);
- const year = d.getFullYear();
- const month = (d.getMonth() + 1).toString().padStart(2, '0');
- const day = d.getDate().toString().padStart(2, '0');
- return `${year}-${month}-${day}`;
- };
-
- // Prepare query parameters
- const queryParams: Record<string, string> = {
- service_id: propsValue.service_id,
- selected_date: formatDate(propsValue.selected_date),
- };
-
- // Add the staff/group/resource ID (only one should be provided)
- if (propsValue.staff_id) {
- queryParams['staff_id'] = propsValue.staff_id;
- }
- if (propsValue.group_id) {
- queryParams['group_id'] = propsValue.group_id;
- }
- if (propsValue.resource_id) {
- queryParams['resource_id'] = propsValue.resource_id;
- }
-
- const response = await httpClient.sendRequest({
- method: HttpMethod.GET,
- url: `${zohoBookingsCommon.baseUrl(location)}/availableslots`,
- headers: {
- Authorization: `Zoho-oauthtoken ${auth.access_token}`,
- },
- queryParams,
+ return await zohoBookingsApi.getAvailableSlots({
+ auth,
+ serviceId: propsValue.service_id,
+ selectedDate: propsValue.selected_date,
+ staffId: propsValue.staff_id,
+ groupId: propsValue.group_id,
+ resourceId: propsValue.resource_id,
});
-
- return response.body;
},
-});
\ No newline at end of file
+});
+
+const schema = {
+ workspace_id: z.string().check(z.minLength(1)),
+ service_id: z.string().check(z.minLength(1)),
+ staff_id: z.optional(z.string()),
+ group_id: z.optional(z.string()),
+ resource_id: z.optional(z.string()),
+ selected_date: z.string(),
+};
diff --git a/packages/pieces/community/zoho-bookings/src/lib/actions/get-appointment-details.ts b/packages/pieces/community/zoho-bookings/src/lib/actions/get-appointment-details.ts
index 15516b486bd..b584d9b2706 100644
--- a/packages/pieces/community/zoho-bookings/src/lib/actions/get-appointment-details.ts
+++ b/packages/pieces/community/zoho-bookings/src/lib/actions/get-appointment-details.ts
@@ -1,14 +1,19 @@
import { propsValidation } from '@activepieces/pieces-common';
import { createAction, Property } from '@activepieces/pieces-framework';
-import { httpClient, HttpMethod } from '@activepieces/pieces-common';
-import { bookingIdDropdown, zohoBookingsAuth, zohoBookingsCommon } from '../common';
+import * as z from 'zod/mini';
+import { zohoBookingsAuth } from '../auth';
+import { zohoBookingsApi } from '../common/api';
+import { zohoBookingsProps } from '../common/props';
+import { getAppointmentDetailsOutputSchema } from '../output-schemas';
-export const getAppointmentDetails = createAction({
+export const getAppointmentDetailsAction = createAction({
auth: zohoBookingsAuth,
name: 'getAppointmentDetails',
+ outputSchema: getAppointmentDetailsOutputSchema,
+ classification: 'READ',
displayName: 'Get Appointment Details',
description: 'Get details of an appointment using its booking ID',
- audience: 'both',
+ audience: 'human',
aiMetadata: {
description:
'Retrieve the full details of a single Zoho Bookings appointment by its booking ID. Use the from/to time range to locate the booking ID first. Read-only and idempotent.',
@@ -25,27 +30,20 @@ export const getAppointmentDetails = createAction({
description: 'The end time of the appointment (in ISO 8601 format)',
required: false,
}),
- booking_id: bookingIdDropdown
+ booking_id: zohoBookingsProps.bookingId({ required: true }),
},
async run(context) {
const { auth, propsValue } = context;
- const location = auth.props?.['location'] as string || 'zoho.com';
- // Validate props using Zod schema
- await propsValidation.validateZod(propsValue, zohoBookingsCommon.getAppointmentDetailsSchema);
+ await propsValidation.validateZod(propsValue, schema);
- const response = await httpClient.sendRequest({
- method: HttpMethod.GET,
- url: `${zohoBookingsCommon.baseUrl(location)}/getappointment`,
- headers: {
- Authorization: `Zoho-oauthtoken ${auth.access_token}`,
-
- },
- queryParams: {
- booking_id: propsValue.booking_id as string,
- },
+ return await zohoBookingsApi.getAppointment({
+ auth,
+ bookingId: propsValue.booking_id,
});
-
- return response.body;
},
-});
\ No newline at end of file
+});
+
+const schema = {
+ booking_id: z.string().check(z.minLength(1)),
+};
diff --git a/packages/pieces/community/zoho-bookings/src/lib/actions/reschedule-appointment.ts b/packages/pieces/community/zoho-bookings/src/lib/actions/reschedule-appointment.ts
index f5eb35e522c..7ebde027025 100644
--- a/packages/pieces/community/zoho-bookings/src/lib/actions/reschedule-appointment.ts
+++ b/packages/pieces/community/zoho-bookings/src/lib/actions/reschedule-appointment.ts
@@ -1,21 +1,20 @@
import { propsValidation } from '@activepieces/pieces-common';
import { createAction, Property } from '@activepieces/pieces-framework';
-import { httpClient, HttpMethod } from '@activepieces/pieces-common';
-import {
- bookingIdDropdown,
- formatDateTime,
- zohoBookingsAuth,
- zohoBookingsCommon,
-} from '../common';
-import { access } from 'fs';
+import * as z from 'zod/mini';
+import { zohoBookingsAuth } from '../auth';
+import { zohoBookingsApi } from '../common/api';
+import { zohoBookingsProps } from '../common/props';
+import { rescheduleAppointmentOutputSchema } from '../output-schemas';
-export const rescheduleAppointment = createAction({
+export const rescheduleAppointmentAction = createAction({
auth: zohoBookingsAuth,
name: 'rescheduleAppointment',
+ outputSchema: rescheduleAppointmentOutputSchema,
+ classification: 'WRITE',
displayName: 'Reschedule Appointment',
description:
'Reschedule an appointment to a different time or to a different staff',
- audience: 'both',
+ audience: 'human',
aiMetadata: {
description:
'Move an existing Zoho Bookings appointment, identified by its booking ID, to a new start time and/or reassign it to a different staff member or group. Supply at least one of new start time, staff, or group. Use the from/to time range only to look up the booking ID to act on. Not idempotent: it mutates the booking each time, though repeating with the same target is effectively a no-op once applied.',
@@ -34,82 +33,12 @@ export const rescheduleAppointment = createAction({
'End of the date range used to fetch existing bookings (optional). Not sent to the reschedule API. Format: dd-MMM-yyyy HH:mm:ss',
required: false,
}),
- booking_id: bookingIdDropdown,
- service_id: Property.Dropdown({
- auth: zohoBookingsAuth,
- displayName: 'Service (Optional)',
- description: 'Select service to filter staff options',
+ booking_id: zohoBookingsProps.bookingId({ required: true }),
+ service_id: zohoBookingsProps.anyServiceId({ required: false }),
+ staff_id: zohoBookingsProps.anyStaffId({
required: false,
- refreshers: [],
- options: async ({ auth }) => {
- if (!auth) {
- return {
- disabled: true,
- placeholder: 'Authentication required',
- options: [],
- };
- }
-
- try {
- const location = (auth as any).props?.['location'] || 'zoho.com';
- const services = await zohoBookingsCommon.fetchServices(
- (auth as any).access_token,
- location
- );
-
- return {
- options: services.map((service: any) => ({
- label: `${service.name} (${service.duration})`,
- value: service.id,
- })),
- };
- } catch (error) {
- return {
- disabled: true,
- placeholder: 'Failed to load services',
- options: [],
- };
- }
- },
- }),
- staff_id: Property.Dropdown({
- auth: zohoBookingsAuth,
- displayName: 'Staff',
description:
'Select the staff to reschedule to (use this OR group_id OR start_time)',
- required: false,
- refreshers: ['service_id'],
- options: async ({ auth, service_id }) => {
- if (!auth) {
- return {
- disabled: true,
- placeholder: 'Authentication required',
- options: [],
- };
- }
-
- try {
- const location = (auth as any).props?.['location'] || 'zoho.com';
- const staff = await zohoBookingsCommon.fetchStaff(
- (auth as any).access_token,
- location,
- service_id as string
- );
-
- return {
- options: staff.map((member: any) => ({
- label: `${member.name} - ${member.designation || 'Staff'}`,
- value: member.id,
- })),
- };
- } catch (error) {
- return {
- disabled: true,
- placeholder: 'Failed to load staff',
- options: [],
- };
- }
- },
}),
group_id: Property.ShortText({
displayName: 'Group ID',
@@ -126,59 +55,27 @@ export const rescheduleAppointment = createAction({
},
async run(context) {
const { auth, propsValue } = context;
- const location = auth.props?.['location'] as string || 'zoho.com';
-
- // Validate props using Zod schema
- await propsValidation.validateZod(
- propsValue,
- zohoBookingsCommon.rescheduleAppointmentSchema
- );
- // Validate that at least one of staff_id, group_id, or start_time is provided
- if (
- !propsValue.staff_id &&
- !propsValue.group_id &&
- !propsValue.start_time
- ) {
- throw new Error(
- 'Either staff_id, group_id, or start_time must be provided'
- );
- }
-
- // Prepare form data
- const formData = new FormData();
- formData.append('booking_id', propsValue.booking_id as string);
+ await propsValidation.validateZod(propsValue, schema);
- // Add the reschedule parameter (only one should be provided)
- if (propsValue.staff_id) {
- formData.append('staff_id', propsValue.staff_id);
- }
- if (propsValue.group_id) {
- formData.append('group_id', propsValue.group_id);
- }
- if (propsValue.start_time) {
- formData.append('start_time', formatDateTime(propsValue.start_time));
+ if (!propsValue.staff_id && !propsValue.group_id && !propsValue.start_time) {
+ throw new Error('Either staff_id, group_id, or start_time must be provided');
}
- const response = await httpClient.sendRequest({
- method: HttpMethod.POST,
- url: `${zohoBookingsCommon.baseUrl(location)}/rescheduleappointment`,
- headers: {
- Authorization: `Zoho-oauthtoken ${auth.access_token}`,
- contentType: 'application/x-www-form-urlencoded',
- },
- body: formData,
+ return await zohoBookingsApi.rescheduleAppointment({
+ auth,
+ bookingId: propsValue.booking_id,
+ staffId: propsValue.staff_id,
+ groupId: propsValue.group_id,
+ startTime: propsValue.start_time,
});
- console.log(auth.access_token)
- const responseBody = response.body.response;
- if (responseBody.status !== 'success') {
- throw new Error(
- `Failed to reschedule appointment: ${responseBody.message || 'Unknown error'}`
- );
- }
- if (responseBody.returnvalue.Status == "failure") {
- throw new Error(responseBody.returnvalue.message || 'Failed to reschedule appointment');
- }
- return responseBody;
},
});
+
+const schema = {
+ booking_id: z.string().check(z.minLength(1)),
+ service_id: z.optional(z.string()),
+ staff_id: z.optional(z.string()),
+ group_id: z.optional(z.string()),
+ start_time: z.optional(z.string()),
+};
diff --git a/packages/pieces/community/zoho-bookings/src/lib/auth.ts b/packages/pieces/community/zoho-bookings/src/lib/auth.ts
new file mode 100644
index 00000000000..641f3ab6ceb
--- /dev/null
+++ b/packages/pieces/community/zoho-bookings/src/lib/auth.ts
@@ -0,0 +1,45 @@
+import { OAuth2GrantType, PieceAuth, Property } from '@activepieces/pieces-framework';
+
+export const zohoBookingsAuth = PieceAuth.OAuth2({
+ props: {
+ location: Property.StaticDropdown({
+ displayName: 'Data Center',
+ description: 'The data center location of your Zoho Bookings account',
+ required: true,
+ options: {
+ options: [
+ {
+ label: 'zoho.com (United States)',
+ value: 'zoho.com',
+ },
+ {
+ label: 'zoho.eu (Europe)',
+ value: 'zoho.eu',
+ },
+ {
+ label: 'zoho.in (India)',
+ value: 'zoho.in',
+ },
+ {
+ label: 'zoho.com.au (Australia)',
+ value: 'zoho.com.au',
+ },
+ {
+ label: 'zoho.jp (Japan)',
+ value: 'zoho.jp',
+ },
+ {
+ label: 'zoho.com.cn (China)',
+ value: 'zoho.com.cn',
+ },
+ ],
+ },
+ }),
+ },
+ description: 'Connect your Zoho Bookings account using OAuth2',
+ grantType: OAuth2GrantType.AUTHORIZATION_CODE,
+ required: true,
+ authUrl: 'https://accounts.{location}/oauth/v2/auth',
+ tokenUrl: 'https://accounts.{location}/oauth/v2/token',
+ scope: ['zohobookings.data.CREATE', 'zohobookings.data.READ'],
+});
diff --git a/packages/pieces/community/zoho-bookings/src/lib/common/ai-props.ts b/packages/pieces/community/zoho-bookings/src/lib/common/ai-props.ts
new file mode 100644
index 00000000000..9bc19e5f6ec
--- /dev/null
+++ b/packages/pieces/community/zoho-bookings/src/lib/common/ai-props.ts
@@ -0,0 +1,149 @@
+import { Property } from '@activepieces/pieces-framework';
+
+import type { PropParams } from './props';
+
+function bookingId<R extends boolean>({
+ required,
+ displayName = 'Booking ID',
+ description = 'Booking ID of the appointment, e.g. "#AN-00014". Use List Appointments or the result of Book Appointment to find it.',
+}: PropParams<R>) {
+ return Property.ShortText({ displayName, description, required });
+}
+
+function workspaceId<R extends boolean>({
+ required,
+ displayName = 'Workspace ID',
+ description = 'Workspace ID, e.g. "4512401000000032020". Use List Workspaces to find it.',
+}: PropParams<R>) {
+ return Property.ShortText({ displayName, description, required });
+}
+
+function serviceId<R extends boolean>({
+ required,
+ displayName = 'Service ID',
+ description = 'Service ID, e.g. "4512401000000032056". Use List Services to find it.',
+}: PropParams<R>) {
+ return Property.ShortText({ displayName, description, required });
+}
+
+function staffId<R extends boolean>({
+ required,
+ displayName = 'Staff ID',
+ description = 'Staff member ID. Use List Staff to find it.',
+}: PropParams<R>) {
+ return Property.ShortText({ displayName, description, required });
+}
+
+function resourceId<R extends boolean>({
+ required,
+ displayName = 'Resource ID',
+ description = 'Resource ID. Use List Resources to find it.',
+}: PropParams<R>) {
+ return Property.ShortText({ displayName, description, required });
+}
+
+function groupId<R extends boolean>({
+ required,
+ displayName = 'Group ID',
+ description = 'Staff group ID for a collective-booking service, as shown in Zoho Bookings.',
+}: PropParams<R>) {
+ return Property.ShortText({ displayName, description, required });
+}
+
+function dateTime<R extends boolean>({
+ required,
+ displayName,
+ description,
+}: PropParams<R> & { displayName: string }) {
+ return Property.DateTime({
+ displayName,
+ description: `${
+ description ?? ''
+ } ISO 8601 without an offset, e.g. 2026-11-03T14:30:00; sent to Zoho as that wall-clock time.`.trim(),
+ required,
+ });
+}
+
+function serviceFields() {
+ return {
+ duration: Property.Number({ displayName: 'Duration (minutes)', required: false }),
+ cost: Property.Number({ displayName: 'Cost', required: false }),
+ preBuffer: Property.Number({ displayName: 'Buffer Before (minutes)', required: false }),
+ postBuffer: Property.Number({ displayName: 'Buffer After (minutes)', required: false }),
+ description: Property.LongText({ displayName: 'Description', required: false }),
+ staffIds: Property.Array({
+ displayName: 'Staff IDs',
+ description: 'Staff to assign. Use List Staff.',
+ required: false,
+ }),
+ meetingMode: Property.StaticDropdown({
+ displayName: 'Meeting Mode',
+ required: false,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'Online', value: 'online' },
+ { label: 'Offline', value: 'offline' },
+ ],
+ },
+ }),
+ meetingType: Property.ShortText({
+ displayName: 'Meeting Type',
+ description:
+ 'Required when Meeting Mode is online: zohomeeting, zoom, teams or gmeet. When offline: an in-person location of the workspace, or empty.',
+ required: false,
+ }),
+ };
+}
+
+function customerFields() {
+ return {
+ name: Property.ShortText({
+ displayName: 'Name',
+ description:
+ 'Full name. Use this when the account stores a single name field; otherwise use First Name and Last Name.',
+ required: false,
+ }),
+ firstName: Property.ShortText({ displayName: 'First Name', required: false }),
+ lastName: Property.ShortText({ displayName: 'Last Name', required: false }),
+ email: Property.ShortText({ displayName: 'Email', required: false }),
+ phone: Property.ShortText({
+ displayName: 'Phone',
+ description: 'With country code, e.g. "+11345678901".',
+ required: false,
+ }),
+ };
+}
+
+function availabilityFor<R extends boolean>({
+ required,
+ displayName = 'Applies To',
+ description = 'Whose availability the overrides belong to.',
+}: PropParams<R>) {
+ return Property.StaticDropdown({
+ displayName,
+ description,
+ required,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'Business', value: 'business' },
+ { label: 'Staff member', value: 'staff' },
+ { label: 'Resource', value: 'resource' },
+ ],
+ },
+ });
+}
+
+export const zohoBookingsAiProps = {
+ bookingId,
+ workspaceId,
+ serviceId,
+ staffId,
+ resourceId,
+ groupId,
+ dateTime,
+ serviceFields,
+ customerFields,
+ availabilityFor,
+};
diff --git a/packages/pieces/community/zoho-bookings/src/lib/common/api.ts b/packages/pieces/community/zoho-bookings/src/lib/common/api.ts
new file mode 100644
index 00000000000..a745a8f26f0
--- /dev/null
+++ b/packages/pieces/community/zoho-bookings/src/lib/common/api.ts
@@ -0,0 +1,981 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+
+import { zohoBookingsClient } from './client';
+
+import type {
+ ZohoBookingsAppointment,
+ ZohoBookingsAppointmentsPage,
+ ZohoBookingsAuthValue,
+ ZohoBookingsBatchResult,
+ ZohoBookingsDateOverridesPage,
+ ZohoBookingsRescheduleResult,
+ ZohoBookingsResource,
+ ZohoBookingsResponse,
+ ZohoBookingsResult,
+ ZohoBookingsService,
+ ZohoBookingsStatusResult,
+ ZohoBookingsStaff,
+ ZohoBookingsWorkspace,
+} from './types';
+
+async function listWorkspaces({
+ auth,
+ workspaceId,
+}: {
+ auth: ZohoBookingsAuthValue;
+ workspaceId?: string;
+}): Promise<ZohoBookingsWorkspace[]> {
+ return await list<ZohoBookingsWorkspace>({
+ auth,
+ path: '/workspaces',
+ query: { ...(workspaceId ? { workspace_id: workspaceId } : {}) },
+ });
+}
+
+async function listServices({
+ auth,
+ workspaceId,
+ serviceId,
+ staffId,
+}: {
+ auth: ZohoBookingsAuthValue;
+ workspaceId?: string;
+ serviceId?: string;
+ staffId?: string;
+}): Promise<ZohoBookingsService[]> {
+ return await list<ZohoBookingsService>({
+ auth,
+ path: '/services',
+ query: {
+ ...(workspaceId ? { workspace_id: workspaceId } : {}),
+ ...(serviceId ? { service_id: serviceId } : {}),
+ ...(staffId ? { staff_id: staffId } : {}),
+ },
+ });
+}
+
+async function listResources({
+ auth,
+ serviceId,
+ resourceId,
+}: {
+ auth: ZohoBookingsAuthValue;
+ serviceId?: string;
+ resourceId?: string;
+}): Promise<ZohoBookingsResource[]> {
+ return await list<ZohoBookingsResource>({
+ auth,
+ path: '/resources',
+ query: {
+ ...(serviceId ? { service_id: serviceId } : {}),
+ ...(resourceId ? { resource_id: resourceId } : {}),
+ },
+ });
+}
+
+async function listStaff({
+ auth,
+ serviceId,
+ staffId,
+ staffEmail,
+ workspaceId,
+}: {
+ auth: ZohoBookingsAuthValue;
+ serviceId?: string;
+ staffId?: string;
+ staffEmail?: string;
+ workspaceId?: string;
+}): Promise<ZohoBookingsStaff[]> {
+ return await list<ZohoBookingsStaff>({
+ auth,
+ path: '/staffs',
+ query: {
+ ...(serviceId ? { service_id: serviceId } : {}),
+ ...(staffId ? { staff_id: staffId } : {}),
+ ...(staffEmail ? { staff_email: staffEmail } : {}),
+ ...(workspaceId ? { workspace_id: workspaceId } : {}),
+ },
+ });
+}
+
+async function listAppointments({
+ auth,
+ fromTime,
+}: {
+ auth: ZohoBookingsAuthValue;
+ fromTime?: string;
+}): Promise<ZohoBookingsAppointment[]> {
+ const result = await searchAppointments({ auth, fromTime });
+ const appointments = result.response;
+ return Array.isArray(appointments) ? appointments : [];
+}
+
+async function searchAppointments({
+ auth,
+ serviceId,
+ staffId,
+ resourceId,
+ fromTime,
+ toTime,
+ status,
+ page,
+ perPage,
+ includeCustomFields,
+ customerName,
+ customerEmail,
+ customerPhone,
+ createdFrom,
+ createdTill,
+}: SearchAppointmentsParams & {
+ auth: ZohoBookingsAuthValue;
+}): Promise<ZohoBookingsAppointmentsPage> {
+ const filters: Record<string, string | number> = {
+ ...(serviceId ? { service_id: serviceId } : {}),
+ ...(staffId ? { staff_id: staffId } : {}),
+ ...(resourceId ? { resource_id: resourceId } : {}),
+ ...(fromTime ? { from_time: formatDateTime(fromTime) } : {}),
+ ...(toTime ? { to_time: formatDateTime(toTime) } : {}),
+ ...(status ? { status } : {}),
+ ...(page !== undefined ? { page } : {}),
+ ...(perPage !== undefined ? { per_page: perPage } : {}),
+ ...(includeCustomFields ? { need_customer_more_info: 'true' } : {}),
+ ...(customerName ? { customer_name: customerName } : {}),
+ ...(customerEmail ? { customer_email: customerEmail } : {}),
+ ...(customerPhone ? { customer_phone_number: customerPhone } : {}),
+ ...(createdFrom ? { appointment_created_from: formatDateTime(createdFrom) } : {}),
+ ...(createdTill ? { appointment_created_till: formatDateTime(createdTill) } : {}),
+ };
+ const formData = new FormData();
+ formData.append('data', JSON.stringify(filters));
+ const response = await zohoBookingsClient.request<
+ ZohoBookingsResponse<ZohoBookingsAppointmentsPage>
+ >({
+ auth,
+ method: HttpMethod.POST,
+ path: '/fetchappointment',
+ headers: FORM_HEADERS,
+ body: formData,
+ });
+ assertSuccess({ response });
+ return response.response.returnvalue;
+}
+
+async function updateAppointment({
+ auth,
+ bookingId,
+ action,
+ data,
+}: {
+ auth: ZohoBookingsAuthValue;
+ bookingId: string;
+ action: string;
+ data?: Record<string, unknown>;
+}): Promise<ZohoBookingsResult> {
+ return await postForm({
+ auth,
+ path: '/updateappointment',
+ fields: {
+ booking_id: bookingId,
+ action,
+ ...(data ? { data: JSON.stringify(data) } : {}),
+ },
+ });
+}
+
+async function createWorkspace({
+ auth,
+ name,
+}: {
+ auth: ZohoBookingsAuthValue;
+ name: string;
+}): Promise<{ id?: string; name: string }> {
+ const result = await postForm<{ data?: { id?: string } }>({
+ auth,
+ path: '/createworkspace',
+ fields: { name },
+ });
+ return { id: result.data?.id, name };
+}
+
+async function updateWorkspace({
+ auth,
+ workspaceId,
+ changes,
+}: {
+ auth: ZohoBookingsAuthValue;
+ workspaceId: string;
+ changes: Record<string, unknown>;
+}): Promise<ZohoBookingsResult> {
+ return await postForm({
+ auth,
+ path: '/updateworkspace',
+ fields: { workspaceId, dataMap: JSON.stringify(changes) },
+ });
+}
+
+async function deleteWorkspace({
+ auth,
+ workspaceId,
+ ignorePastAppointments,
+}: {
+ auth: ZohoBookingsAuthValue;
+ workspaceId: string;
+ ignorePastAppointments?: boolean;
+}): Promise<ZohoBookingsResult> {
+ return await postForm({
+ auth,
+ path: '/deleteworkspace',
+ fields: {
+ workspaceId,
+ ...(ignorePastAppointments !== undefined
+ ? { ignorePastAppointment: String(ignorePastAppointments) }
+ : {}),
+ },
+ });
+}
+
+async function createService({
+ auth,
+ workspaceId,
+ name,
+ serviceType,
+ resourceIds,
+ ...details
+}: CreateServiceParams & { auth: ZohoBookingsAuthValue }): Promise<{ id?: string; name: string }> {
+ const service = {
+ name,
+ workspace_id: workspaceId,
+ ...(serviceType !== undefined ? { service_type: serviceType } : {}),
+ ...serviceDetails(details),
+ ...(resourceIds !== undefined ? { assigned_resources: resourceIds } : {}),
+ };
+ const result = await postForm<{ data?: { id?: string } }>({
+ auth,
+ path: '/createservice',
+ fields: { data: JSON.stringify(service) },
+ });
+ return { id: result.data?.id, name };
+}
+
+async function updateService({
+ auth,
+ serviceId,
+ name,
+ status,
+ ...details
+}: UpdateServiceParams & { auth: ZohoBookingsAuthValue }): Promise<ZohoBookingsResult> {
+ const service = {
+ id: serviceId,
+ ...(name !== undefined ? { name } : {}),
+ ...(status !== undefined ? { status } : {}),
+ ...serviceDetails(details),
+ };
+ return await postForm({ auth, path: '/editservice', fields: { data: JSON.stringify(service) } });
+}
+
+async function deleteService({
+ auth,
+ serviceId,
+}: {
+ auth: ZohoBookingsAuthValue;
+ serviceId: string;
+}): Promise<ZohoBookingsResult> {
+ return await postForm({ auth, path: '/deleteservice', fields: { id: serviceId } });
+}
+
+async function addStaff({
+ auth,
+ name,
+ email,
+ role,
+ gender,
+ dob,
+ phone,
+ designation,
+ additionalInfo,
+ serviceIds,
+}: AddStaffParams & { auth: ZohoBookingsAuthValue }): Promise<Record<string, unknown>> {
+ const staff = {
+ name,
+ email,
+ ...(role !== undefined ? { role } : {}),
+ ...(gender !== undefined ? { gender } : {}),
+ ...(dob !== undefined ? { dob: formatDateTime(dob) } : {}),
+ ...(phone !== undefined ? { phone } : {}),
+ ...(designation !== undefined ? { designation } : {}),
+ ...(additionalInfo !== undefined ? { additional_info: additionalInfo } : {}),
+ ...(serviceIds !== undefined ? { assigned_services: serviceIds } : {}),
+ };
+ const result = await postForm<ZohoBookingsBatchResult>({
+ auth,
+ path: '/addstaff',
+ fields: { staffMap: JSON.stringify({ data: [staff] }) },
+ });
+ return firstBatchItem({ result });
+}
+
+async function createResource({
+ auth,
+ name,
+ description,
+ workspaceIds,
+}: {
+ auth: ZohoBookingsAuthValue;
+ name: string;
+ description?: string;
+ workspaceIds: unknown[];
+}): Promise<Record<string, unknown>> {
+ const resource = {
+ name,
+ ...(description !== undefined ? { description } : {}),
+ assigned_workspaces: workspaceIds,
+ };
+ const result = await postForm<ZohoBookingsBatchResult>({
+ auth,
+ path: '/addresource',
+ fields: { resourceMap: JSON.stringify({ data: [resource] }) },
+ });
+ return firstBatchItem({ result });
+}
+
+async function updateResource({
+ auth,
+ resourceId,
+ name,
+ status,
+ description,
+ workspaceIds,
+ serviceIds,
+ userInCharge,
+ ignorePastAppointments,
+}: UpdateResourceParams & { auth: ZohoBookingsAuthValue }): Promise<ZohoBookingsResult> {
+ const resource = {
+ id: resourceId,
+ ...(name !== undefined ? { name } : {}),
+ ...(status !== undefined ? { status } : {}),
+ ...(description !== undefined ? { description } : {}),
+ ...(workspaceIds !== undefined ? { assigned_workspaces: workspaceIds } : {}),
+ ...(serviceIds !== undefined ? { assigned_services: serviceIds } : {}),
+ ...(userInCharge !== undefined ? { user_in_charge: userInCharge } : {}),
+ };
+ return await postForm({
+ auth,
+ path: '/updateresource',
+ fields: {
+ resourceMap: JSON.stringify({ data: resource }),
+ ...(ignorePastAppointments !== undefined
+ ? { ignorePastAppointments: String(ignorePastAppointments) }
+ : {}),
+ },
+ });
+}
+
+async function deleteResource({
+ auth,
+ resourceId,
+ ignorePastAppointments,
+}: {
+ auth: ZohoBookingsAuthValue;
+ resourceId: string;
+ ignorePastAppointments?: boolean;
+}): Promise<ZohoBookingsResult> {
+ return await postForm({
+ auth,
+ path: '/deleteresource',
+ fields: {
+ resourceMap: JSON.stringify({ id: resourceId }),
+ ...(ignorePastAppointments !== undefined
+ ? { ignorePastAppointments: String(ignorePastAppointments) }
+ : {}),
+ },
+ });
+}
+
+async function createCustomer({
+ auth,
+ ...customer
+}: CustomerFields & { auth: ZohoBookingsAuthValue }): Promise<Record<string, unknown>> {
+ const result = await postForm<ZohoBookingsBatchResult>({
+ auth,
+ path: '/addcustomer',
+ fields: { customerMap: JSON.stringify({ data: [customerPayload(customer)] }) },
+ });
+ return firstBatchItem({ result });
+}
+
+async function updateCustomer({
+ auth,
+ customerId,
+ ...customer
+}: CustomerFields & {
+ auth: ZohoBookingsAuthValue;
+ customerId: string;
+}): Promise<Record<string, unknown>> {
+ const result = await postForm<{ message?: Record<string, unknown> | string }>({
+ auth,
+ path: '/updatecustomer',
+ fields: {
+ customerMap: JSON.stringify({ data: { id: customerId, ...customerPayload(customer) } }),
+ },
+ });
+ return typeof result.message === 'object' ? result.message : result;
+}
+
+async function deleteCustomer({
+ auth,
+ customerId,
+}: {
+ auth: ZohoBookingsAuthValue;
+ customerId: string;
+}): Promise<ZohoBookingsResult> {
+ return await postForm({
+ auth,
+ path: '/deletecustomer',
+ fields: { customerMap: JSON.stringify({ id: customerId }) },
+ });
+}
+
+async function listDateOverrides({
+ auth,
+ availabilityFor,
+ availabilityForId,
+ type,
+ fromTime,
+ toTime,
+ page,
+}: ListDateOverridesParams & {
+ auth: ZohoBookingsAuthValue;
+}): Promise<ZohoBookingsDateOverridesPage> {
+ const response = await zohoBookingsClient.request<
+ ZohoBookingsResponse<ZohoBookingsDateOverridesPage>
+ >({
+ auth,
+ method: HttpMethod.GET,
+ path: '/fetchdateoverrides',
+ query: {
+ availability_for: availabilityFor,
+ ...(availabilityForId ? { availability_for_id: availabilityForId } : {}),
+ ...(type ? { type } : {}),
+ ...(fromTime ? { from_time: fromTime } : {}),
+ ...(toTime ? { to_time: toTime } : {}),
+ ...(page !== undefined ? { page: String(page) } : {}),
+ },
+ });
+ assertSuccess({ response });
+ return response.response.returnvalue;
+}
+
+async function createDateOverrides({
+ auth,
+ availabilityFor,
+ availabilityForId,
+ overrides,
+}: {
+ auth: ZohoBookingsAuthValue;
+ availabilityFor: string;
+ availabilityForId?: string;
+ overrides: unknown[];
+}): Promise<ZohoBookingsResult> {
+ const data = {
+ availability_for: availabilityFor,
+ ...(availabilityForId ? { availability_for_id: availabilityForId } : {}),
+ overrides,
+ };
+ return await postForm({
+ auth,
+ path: '/createdateoverrides',
+ fields: { data: JSON.stringify(data) },
+ });
+}
+
+async function updateDateOverrides({
+ auth,
+ overrides,
+}: {
+ auth: ZohoBookingsAuthValue;
+ overrides: unknown[];
+}): Promise<ZohoBookingsResult> {
+ return await postForm({
+ auth,
+ path: '/updatedateoverrides',
+ fields: { data: JSON.stringify({ overrides }) },
+ });
+}
+
+async function deleteDateOverrides({
+ auth,
+ ids,
+}: {
+ auth: ZohoBookingsAuthValue;
+ ids: string[];
+}): Promise<ZohoBookingsResult> {
+ return await postForm({
+ auth,
+ path: '/deletedateoverrides',
+ fields: { data: JSON.stringify({ ids }) },
+ });
+}
+
+async function bookAppointment({
+ auth,
+ serviceId,
+ fromTime,
+ customerName,
+ customerEmail,
+ customerPhone,
+ staffId,
+ resourceId,
+ groupId,
+ toTime,
+ timezone,
+ notes,
+ additionalFields,
+ costPaid,
+}: BookAppointmentParams & { auth: ZohoBookingsAuthValue }): Promise<
+ ZohoBookingsResponse['response']
+> {
+ const customer_details = {
+ name: String(customerName),
+ email: String(customerEmail),
+ phone_number: String(customerPhone),
+ };
+ const formData = new FormData();
+ formData.append('service_id', serviceId);
+ formData.append('from_time', formatDateTime(fromTime));
+ formData.append('customer_details', JSON.stringify(customer_details));
+
+ if (staffId) {
+ formData.append('staff_id', staffId);
+ }
+ if (resourceId) {
+ formData.append('resource_id', resourceId);
+ }
+ if (groupId) {
+ formData.append('group_id', groupId);
+ }
+ if (toTime) {
+ formData.append('to_time', formatDateTime(toTime));
+ }
+ if (timezone) {
+ formData.append('timezone', timezone);
+ }
+ if (notes) {
+ formData.append('notes', notes);
+ }
+ if (additionalFields) {
+ formData.append('additional_fields', JSON.stringify(additionalFields));
+ }
+ if (costPaid) {
+ formData.append('payment_info', JSON.stringify({ cost_paid: costPaid.toString() }));
+ }
+
+ const response = await zohoBookingsClient.request<ZohoBookingsResponse>({
+ auth,
+ method: HttpMethod.POST,
+ path: '/appointment',
+ headers: FORM_HEADERS,
+ body: formData,
+ });
+
+ if (response.response.status === 'failure') {
+ throw new Error(`${response.response.errormessage}`);
+ }
+ return response.response;
+}
+
+async function cancelAppointment({
+ auth,
+ bookingId,
+}: {
+ auth: ZohoBookingsAuthValue;
+ bookingId: string;
+}): Promise<ZohoBookingsResponse> {
+ const formData = new FormData();
+ formData.append('booking_id', bookingId);
+ formData.append('action', 'cancel');
+
+ return await zohoBookingsClient.request<ZohoBookingsResponse>({
+ auth,
+ method: HttpMethod.POST,
+ path: '/updateappointment',
+ headers: LEGACY_FORM_HEADERS,
+ body: formData,
+ });
+}
+
+async function getAvailableSlots({
+ auth,
+ serviceId,
+ selectedDate,
+ staffId,
+ groupId,
+ resourceId,
+}: GetAvailableSlotsParams & { auth: ZohoBookingsAuthValue }): Promise<ZohoBookingsResponse> {
+ const query: Record<string, string> = {
+ service_id: serviceId,
+ selected_date: formatDate(selectedDate),
+ };
+ if (staffId) {
+ query['staff_id'] = staffId;
+ }
+ if (groupId) {
+ query['group_id'] = groupId;
+ }
+ if (resourceId) {
+ query['resource_id'] = resourceId;
+ }
+
+ const response = await zohoBookingsClient.request<ZohoBookingsResponse>({
+ auth,
+ method: HttpMethod.GET,
+ path: '/availableslots',
+ query,
+ });
+ assertSuccess({ response });
+ return response;
+}
+
+async function getAppointment({
+ auth,
+ bookingId,
+}: {
+ auth: ZohoBookingsAuthValue;
+ bookingId: string;
+}): Promise<ZohoBookingsResponse> {
+ const response = await zohoBookingsClient.request<ZohoBookingsResponse>({
+ auth,
+ method: HttpMethod.GET,
+ path: '/getappointment',
+ query: { booking_id: bookingId },
+ });
+ assertSuccess({ response });
+ return response;
+}
+
+async function rescheduleAppointment({
+ auth,
+ bookingId,
+ staffId,
+ groupId,
+ startTime,
+}: RescheduleAppointmentParams & {
+ auth: ZohoBookingsAuthValue;
+}): Promise<ZohoBookingsResponse<ZohoBookingsRescheduleResult>['response']> {
+ const formData = new FormData();
+ formData.append('booking_id', bookingId);
+ if (staffId) {
+ formData.append('staff_id', staffId);
+ }
+ if (groupId) {
+ formData.append('group_id', groupId);
+ }
+ if (startTime) {
+ formData.append('start_time', formatDateTime(startTime));
+ }
+
+ const response = await zohoBookingsClient.request<
+ ZohoBookingsResponse<ZohoBookingsRescheduleResult>
+ >({
+ auth,
+ method: HttpMethod.POST,
+ path: '/rescheduleappointment',
+ headers: LEGACY_FORM_HEADERS,
+ body: formData,
+ });
+
+ const responseBody = response.response;
+ if (responseBody.status !== 'success') {
+ throw new Error(`Failed to reschedule appointment: ${responseBody.message || 'Unknown error'}`);
+ }
+ if (responseBody.returnvalue.Status == 'failure') {
+ throw new Error(responseBody.returnvalue.message || 'Failed to reschedule appointment');
+ }
+ return responseBody;
+}
+
+async function postForm<T = ZohoBookingsResult>({
+ auth,
+ path,
+ fields,
+}: {
+ auth: ZohoBookingsAuthValue;
+ path: string;
+ fields: Record<string, string>;
+}): Promise<T> {
+ const formData = new FormData();
+ for (const [key, value] of Object.entries(fields)) {
+ formData.append(key, value);
+ }
+ const response = await zohoBookingsClient.request<ZohoBookingsResponse<T>>({
+ auth,
+ method: HttpMethod.POST,
+ path,
+ headers: FORM_HEADERS,
+ body: formData,
+ });
+ assertSuccess({ response });
+ return response.response.returnvalue;
+}
+
+async function list<T>({
+ auth,
+ path,
+ query,
+}: {
+ auth: ZohoBookingsAuthValue;
+ path: string;
+ query: Record<string, string>;
+}): Promise<T[]> {
+ const response = await zohoBookingsClient.request<
+ ZohoBookingsResponse<{ data?: T[]; status?: string; mesage?: string }>
+ >({
+ auth,
+ method: HttpMethod.GET,
+ path,
+ headers: JSON_HEADERS,
+ query,
+ });
+ const result = response?.response?.returnvalue;
+ if (result?.status === 'failure' && result.mesage?.startsWith('There is no')) {
+ return [];
+ }
+ assertSuccess({ response });
+ return response?.response?.returnvalue?.data || [];
+}
+
+function assertSuccess({ response }: { response: ZohoBookingsResponse<unknown> }): void {
+ const body = response?.response;
+ const result: ZohoBookingsStatusResult =
+ typeof body?.returnvalue === 'object' && body.returnvalue !== null ? body.returnvalue : {};
+ const failed = [response?.status, body?.status, result.status].some(
+ (status) => status === 'failure' || status === 'error',
+ );
+ if (failed) {
+ throw new Error(
+ String(
+ body?.errormessage ??
+ body?.message ??
+ result.message ??
+ result.mesage ??
+ result.errorMessage ??
+ response?.message ??
+ 'Zoho Bookings reported a failure',
+ ),
+ );
+ }
+}
+
+function firstBatchItem({ result }: { result: ZohoBookingsBatchResult }): Record<string, unknown> {
+ const item = result.response?.[0];
+ if (item?.status !== 'success') {
+ throw new Error(String(item?.message ?? JSON.stringify(result)));
+ }
+ return typeof item.message === 'object' ? item.message : item;
+}
+
+function serviceDetails({
+ duration,
+ cost,
+ preBuffer,
+ postBuffer,
+ description,
+ staffIds,
+ meetingMode,
+ meetingType,
+}: ServiceDetails): Record<string, unknown> {
+ return {
+ ...(duration !== undefined ? { duration: String(duration) } : {}),
+ ...(cost !== undefined ? { cost: String(cost) } : {}),
+ ...(preBuffer !== undefined ? { pre_buffer: String(preBuffer) } : {}),
+ ...(postBuffer !== undefined ? { post_buffer: String(postBuffer) } : {}),
+ ...(description !== undefined ? { description } : {}),
+ ...(staffIds !== undefined ? { assigned_staffs: staffIds } : {}),
+ ...(meetingMode !== undefined ? { meeting_mode: meetingMode } : {}),
+ ...(meetingType !== undefined ? { meeting_type: meetingType } : {}),
+ };
+}
+
+function customerPayload({
+ name,
+ firstName,
+ lastName,
+ email,
+ phone,
+}: CustomerFields): Record<string, string> {
+ return {
+ ...(name !== undefined ? { name } : {}),
+ ...(firstName !== undefined ? { first_name: firstName } : {}),
+ ...(lastName !== undefined ? { last_name: lastName } : {}),
+ ...(email !== undefined ? { email } : {}),
+ ...(phone !== undefined ? { contact_number: phone } : {}),
+ };
+}
+
+function formatDateTime(date: string): string {
+ const d = new Date(date);
+ const day = d.getUTCDate().toString().padStart(2, '0');
+ const month = MONTHS[d.getUTCMonth()];
+ const year = d.getUTCFullYear();
+ const hours = d.getUTCHours().toString().padStart(2, '0');
+ const minutes = d.getUTCMinutes().toString().padStart(2, '0');
+ const seconds = d.getUTCSeconds().toString().padStart(2, '0');
+ return `${day}-${month}-${year} ${hours}:${minutes}:${seconds}`;
+}
+
+function formatDate(date: string): string {
+ const d = new Date(date);
+ const year = d.getUTCFullYear();
+ const month = (d.getUTCMonth() + 1).toString().padStart(2, '0');
+ const day = d.getUTCDate().toString().padStart(2, '0');
+ return `${year}-${month}-${day}`;
+}
+
+export const zohoBookingsApi = {
+ listWorkspaces,
+ listServices,
+ listResources,
+ listStaff,
+ listAppointments,
+ searchAppointments,
+ updateAppointment,
+ createWorkspace,
+ updateWorkspace,
+ deleteWorkspace,
+ createService,
+ updateService,
+ deleteService,
+ addStaff,
+ createResource,
+ updateResource,
+ deleteResource,
+ createCustomer,
+ updateCustomer,
+ deleteCustomer,
+ listDateOverrides,
+ createDateOverrides,
+ updateDateOverrides,
+ deleteDateOverrides,
+ bookAppointment,
+ cancelAppointment,
+ getAvailableSlots,
+ getAppointment,
+ rescheduleAppointment,
+};
+
+const MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
+
+const JSON_HEADERS = { 'Content-Type': 'application/json' };
+const FORM_HEADERS = { 'Content-Type': 'application/x-www-form-urlencoded' };
+const LEGACY_FORM_HEADERS = { contentType: 'application/x-www-form-urlencoded' };
+
+type BookAppointmentParams = {
+ serviceId: string;
+ fromTime: string;
+ customerName: string;
+ customerEmail: string;
+ customerPhone: string;
+ staffId?: string;
+ resourceId?: string;
+ groupId?: string;
+ toTime?: string;
+ timezone?: string;
+ notes?: string;
+ additionalFields?: unknown;
+ costPaid?: number;
+};
+
+type GetAvailableSlotsParams = {
+ serviceId: string;
+ selectedDate: string;
+ staffId?: string;
+ groupId?: string;
+ resourceId?: string;
+};
+
+type RescheduleAppointmentParams = {
+ bookingId: string;
+ staffId?: string;
+ groupId?: string;
+ startTime?: string;
+};
+
+type SearchAppointmentsParams = {
+ serviceId?: string;
+ staffId?: string;
+ resourceId?: string;
+ fromTime?: string;
+ toTime?: string;
+ status?: string;
+ page?: number;
+ perPage?: number;
+ includeCustomFields?: boolean;
+ customerName?: string;
+ customerEmail?: string;
+ customerPhone?: string;
+ createdFrom?: string;
+ createdTill?: string;
+};
+
+type ServiceDetails = {
+ duration?: number;
+ cost?: number;
+ preBuffer?: number;
+ postBuffer?: number;
+ description?: string;
+ staffIds?: unknown[];
+ meetingMode?: string;
+ meetingType?: string;
+};
+
+type CreateServiceParams = ServiceDetails & {
+ workspaceId: string;
+ name: string;
+ serviceType?: string;
+ resourceIds?: unknown[];
+};
+
+type UpdateServiceParams = ServiceDetails & {
+ serviceId: string;
+ name?: string;
+ status?: string;
+};
+
+type AddStaffParams = {
+ name: string;
+ email: string;
+ role?: string;
+ gender?: string;
+ dob?: string;
+ phone?: string;
+ designation?: string;
+ additionalInfo?: string;
+ serviceIds?: unknown[];
+};
+
+type UpdateResourceParams = {
+ resourceId: string;
+ name?: string;
+ status?: string;
+ description?: string;
+ workspaceIds?: unknown[];
+ serviceIds?: unknown[];
+ userInCharge?: string;
+ ignorePastAppointments?: boolean;
+};
+
+type CustomerFields = {
+ name?: string;
+ firstName?: string;
+ lastName?: string;
+ email?: string;
+ phone?: string;
+};
+
+type ListDateOverridesParams = {
+ availabilityFor: string;
+ availabilityForId?: string;
+ type?: string;
+ fromTime?: string;
+ toTime?: string;
+ page?: number;
+};
diff --git a/packages/pieces/community/zoho-bookings/src/lib/common/client.ts b/packages/pieces/community/zoho-bookings/src/lib/common/client.ts
new file mode 100644
index 00000000000..50cbdb284d1
--- /dev/null
+++ b/packages/pieces/community/zoho-bookings/src/lib/common/client.ts
@@ -0,0 +1,45 @@
+import { HttpHeaders, HttpMethod, httpClient, QueryParams } from '@activepieces/pieces-common';
+
+import type { ZohoBookingsAuthValue } from './types';
+
+function baseUrl({ auth }: { auth: ZohoBookingsAuthValue }): string {
+ const location = auth.props?.location || 'zoho.com';
+ return `https://www.zohoapis.${location.substring(5).trim()}/bookings/v1/json`;
+}
+
+async function request<T>({
+ auth,
+ method,
+ path,
+ query,
+ body,
+ headers,
+}: RequestParams & { auth: ZohoBookingsAuthValue }): Promise<T> {
+ const response = await httpClient.sendRequest<string>({
+ method,
+ url: `${baseUrl({ auth })}${path}`,
+ headers: {
+ Authorization: `Zoho-oauthtoken ${auth.access_token}`,
+ ...headers,
+ },
+ queryParams: query,
+ body,
+ responseType: 'text',
+ });
+ return JSON.parse(
+ response.body.replace(JSON_TOKEN, (token) => (LONG_INTEGER.test(token) ? `"${token}"` : token)),
+ );
+}
+
+export const zohoBookingsClient = { baseUrl, request };
+
+const JSON_TOKEN = /"(?:[^"\\]|\\.)*"|-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g;
+const LONG_INTEGER = /^-?\d{16,}$/;
+
+type RequestParams = {
+ method: HttpMethod;
+ path: string;
+ query?: QueryParams;
+ body?: unknown;
+ headers?: HttpHeaders;
+};
diff --git a/packages/pieces/community/zoho-bookings/src/lib/common/index.ts b/packages/pieces/community/zoho-bookings/src/lib/common/index.ts
deleted file mode 100644
index 7b7a204bdf1..00000000000
--- a/packages/pieces/community/zoho-bookings/src/lib/common/index.ts
+++ /dev/null
@@ -1,258 +0,0 @@
-import { httpClient, HttpMethod } from '@activepieces/pieces-common';
-import { PieceAuth, Property } from '@activepieces/pieces-framework';
-import { OAuth2GrantType } from '@activepieces/pieces-framework';
-import * as schemas from './schemas';
-
-export const zohoBookingsAuth = PieceAuth.OAuth2({
- props: {
- location: Property.StaticDropdown({
- displayName: 'Data Center',
- description: 'The data center location of your Zoho Bookings account',
- required: true,
- options: {
- options: [
- {
- label: 'zoho.com (United States)',
- value: 'zoho.com',
- },
- {
- label: 'zoho.eu (Europe)',
- value: 'zoho.eu',
- },
- {
- label: 'zoho.in (India)',
- value: 'zoho.in',
- },
- {
- label: 'zoho.com.au (Australia)',
- value: 'zoho.com.au',
- },
- {
- label: 'zoho.jp (Japan)',
- value: 'zoho.jp',
- },
- {
- label: 'zoho.com.cn (China)',
- value: 'zoho.com.cn',
- },
- ],
- },
- }),
- },
- description: 'Connect your Zoho Bookings account using OAuth2',
- grantType: OAuth2GrantType.AUTHORIZATION_CODE,
- required: true,
- authUrl: 'https://accounts.{location}/oauth/v2/auth',
- tokenUrl: 'https://accounts.{location}/oauth/v2/token',
- scope: ['zohobookings.data.CREATE', 'zohobookings.data.READ'],
-});
-
-export const zohoBookingsCommon = {
- baseUrl: (location = 'zoho.com') => {
- return `https://www.zohoapis.${location
- .substring(5)
- .trim()}/bookings/v1/json`;
- },
- baseHeaders: (accessToken: string) => {
- return {
- Authorization: `Zoho-oauthtoken ${accessToken}`,
- 'Content-Type': 'application/json',
- };
- },
-
- // API Methods
- async fetchWorkspaces(accessToken: string, location: string) {
- const response = await httpClient.sendRequest({
- method: HttpMethod.GET,
- url: `${this.baseUrl(location)}/workspaces`,
- headers: this.baseHeaders(accessToken),
- });
-
- return response.body?.response?.returnvalue?.data || [];
- },
-
- async fetchServices(
- accessToken: string,
- location: string,
- workspaceId?: string
- ) {
- const queryParams: Record<string, string> = {};
- if (workspaceId) {
- queryParams['workspace_id'] = workspaceId;
- }
-
- const response = await httpClient.sendRequest({
- method: HttpMethod.GET,
- url: `${this.baseUrl(location)}/services`,
- headers: this.baseHeaders(accessToken),
- queryParams,
- });
-
- return response.body?.response?.returnvalue?.data || [];
- },
-
- async fetchResources(
- accessToken: string,
- location: string,
- serviceId?: string
- ) {
- const queryParams: Record<string, string> = {};
- if (serviceId) {
- queryParams['service_id'] = serviceId;
- }
-
- const response = await httpClient.sendRequest({
- method: HttpMethod.GET,
- url: `${this.baseUrl(location)}/resources`,
- headers: this.baseHeaders(accessToken),
- queryParams,
- });
-
- return response.body?.response?.returnvalue?.data || [];
- },
-
- async fetchStaff(accessToken: string, location: string, serviceId?: string) {
- const queryParams: Record<string, string> = {};
- if (serviceId) {
- queryParams['service_id'] = serviceId;
- }
-
- const response = await httpClient.sendRequest({
- method: HttpMethod.GET,
- url: `${this.baseUrl(location)}/staffs`,
- headers: this.baseHeaders(accessToken),
- queryParams,
- });
-
- return response.body?.response?.returnvalue?.data || [];
- },
-
- async fetchAppointments(
- accessToken: string,
- location: string,
- options?: {
- serviceId?: string;
- staffId?: string;
- status?: string;
- from_time?: string;
- to_time?: string;
- page?: number;
- perPage?: number;
- }
- ) {
- const payload: Record<string, string | number> = {};
-
- // if (options?.staffId !== undefined) payload['staff_id'] = Number(options.staffId);
- // if (options?.serviceId) payload['service_id'] = options.serviceId;
- if (options?.from_time) payload['from_time'] = options.from_time;
- // if (options?.to_time) payload['to_time'] = options.to_time;
- // if (options?.status) payload['status'] = options.status;
- // if (options?.page != null) payload['page'] = options.page;
- // if (options?.perPage != null) payload['per_page'] = options.perPage;
- // if (options?.need_customer_more_info != null) {
- // payload.need_customer_more_info = String(options.need_customer_more_info);
- // }
- // if (options?.customer_name) payload['customer_name'] = options.customer_name;
- // if (options?.customer_email) payload['customer_email'] = options.customer_email;
-
- // Send as multipart/form-data with a single `data` field
- const formData = new FormData();
- formData.append('data', JSON.stringify(payload));
- const response = await httpClient.sendRequest({
- method: HttpMethod.POST,
- url: `${this.baseUrl(location)}/fetchappointment`,
- headers: {
- Authorization: `Zoho-oauthtoken ${accessToken}`,
- 'Content-Type': 'application/x-www-form-urlencoded',
- },
- body: formData,
- });
- console.log(JSON.stringify(response.body.response));
-
- const appointments = response.body?.response?.returnvalue?.response;
- return Array.isArray(appointments) ? appointments : [];
- },
-
- // Schemas
- bookAppointmentSchema: schemas.bookAppointment,
- rescheduleAppointmentSchema: schemas.rescheduleAppointment,
- fetchAvailabilitySchema: schemas.fetchAvailability,
- getAppointmentDetailsSchema: schemas.getAppointmentDetails,
- cancelAppointmentSchema: schemas.cancelAppointment,
-};
-
-export const formatDateTime = (date: string) => {
- const d = new Date(date);
- const months = [
- 'Jan',
- 'Feb',
- 'Mar',
- 'Apr',
- 'May',
- 'Jun',
- 'Jul',
- 'Aug',
- 'Sep',
- 'Oct',
- 'Nov',
- 'Dec',
- ];
-
- const day = d.getDate().toString().padStart(2, '0');
- const month = months[d.getMonth()];
- const year = d.getFullYear();
- const hours = d.getHours().toString().padStart(2, '0');
- const minutes = d.getMinutes().toString().padStart(2, '0');
- const seconds = d.getSeconds().toString().padStart(2, '0');
-
- return `${day}-${month}-${year} ${hours}:${minutes}:${seconds}`;
-};
-
-export const bookingIdDropdown = Property.Dropdown({
- auth: zohoBookingsAuth,
- displayName: 'Appointment',
- description: 'Select the appointment to get details for',
- required: true,
- refreshers: ['from_time', 'to_time'],
- options: async ({ auth, from_time, to_time }) => {
- if (!auth) {
- return {
- disabled: true,
- placeholder: 'Authentication required',
- options: [],
- };
- }
- if (!from_time) {
- return {
- disabled: true,
- placeholder: 'Please select From Time first',
- options: [],
- };
- }
- const formattedFromTime = formatDateTime(from_time as string);
- try {
- const location = (auth as any).props?.['location'] || 'zoho.com';
- const appointments = await zohoBookingsCommon.fetchAppointments(
- (auth as any).access_token,
- location,
- {
- perPage: 50,
- from_time: formattedFromTime,
- to_time: to_time ? formatDateTime(to_time as string) : undefined,
- }
- );
- return {
- options: appointments.map((appointment: any) => ({
- label: `${appointment.booking_id} - ${appointment.customer_name} (${appointment.service_name}) - ${appointment.start_time} [${appointment.status}]`,
- value: appointment.booking_id,
- })),
- };
- } catch (error) {
- return {
- disabled: true,
- placeholder: 'Failed to load appointments',
- options: [],
- };
- }
- },
-});
diff --git a/packages/pieces/community/zoho-bookings/src/lib/common/props.ts b/packages/pieces/community/zoho-bookings/src/lib/common/props.ts
new file mode 100644
index 00000000000..0a33fb2ee70
--- /dev/null
+++ b/packages/pieces/community/zoho-bookings/src/lib/common/props.ts
@@ -0,0 +1,259 @@
+import { DropdownState, Property } from '@activepieces/pieces-framework';
+
+import { zohoBookingsAuth } from '../auth';
+import { zohoBookingsApi } from './api';
+
+function workspaceId<R extends boolean>({
+ required,
+ displayName = 'Workspace',
+ description = 'Select the workspace',
+}: PropParams<R>) {
+ return Property.Dropdown({
+ auth: zohoBookingsAuth,
+ displayName,
+ description,
+ required,
+ refreshers: [],
+ options: async ({ auth }) => {
+ if (!auth) {
+ return disabledOptions({ placeholder: 'Authentication required' });
+ }
+ try {
+ const workspaces = await zohoBookingsApi.listWorkspaces({ auth });
+ return {
+ disabled: false,
+ options: workspaces.map((workspace) => ({
+ label: workspace.name,
+ value: workspace.id,
+ })),
+ };
+ } catch (error) {
+ return disabledOptions({ placeholder: 'Failed to load workspaces' });
+ }
+ },
+ });
+}
+
+function serviceId<R extends boolean>({
+ required,
+ displayName = 'Service',
+ description = 'Select the service',
+}: PropParams<R>) {
+ return Property.Dropdown({
+ auth: zohoBookingsAuth,
+ displayName,
+ description,
+ required,
+ refreshers: ['workspace_id'],
+ options: async ({ auth, workspace_id }) => {
+ if (!workspace_id || !auth) {
+ return disabledOptions({ placeholder: 'Please enter workspace ID first' });
+ }
+ try {
+ const services = await zohoBookingsApi.listServices({
+ auth,
+ workspaceId: String(workspace_id),
+ });
+ return {
+ disabled: false,
+ options: services.map((service) => ({
+ label: `${service.name} (${service.duration})`,
+ value: service.id,
+ })),
+ };
+ } catch (error) {
+ return disabledOptions({ placeholder: 'Failed to load services' });
+ }
+ },
+ });
+}
+
+function anyServiceId<R extends boolean>({
+ required,
+ displayName = 'Service (Optional)',
+ description = 'Select service to filter staff options',
+}: PropParams<R>) {
+ return Property.Dropdown({
+ auth: zohoBookingsAuth,
+ displayName,
+ description,
+ required,
+ refreshers: [],
+ options: async ({ auth }) => {
+ if (!auth) {
+ return disabledOptions({ placeholder: 'Authentication required' });
+ }
+ try {
+ const services = await zohoBookingsApi.listServices({ auth });
+ return {
+ disabled: false,
+ options: services.map((service) => ({
+ label: `${service.name} (${service.duration})`,
+ value: service.id,
+ })),
+ };
+ } catch (error) {
+ return disabledOptions({ placeholder: 'Failed to load services' });
+ }
+ },
+ });
+}
+
+function staffId<R extends boolean>({
+ required,
+ displayName = 'Staff',
+ description = 'Select the staff member',
+}: PropParams<R>) {
+ return Property.Dropdown({
+ auth: zohoBookingsAuth,
+ displayName,
+ description,
+ required,
+ refreshers: ['service_id'],
+ options: async ({ auth, service_id }) => {
+ if (!service_id || !auth) {
+ return disabledOptions({ placeholder: 'Please select service first' });
+ }
+ try {
+ const staff = await zohoBookingsApi.listStaff({
+ auth,
+ serviceId: String(service_id),
+ });
+ return {
+ disabled: false,
+ options: staff.map((member) => ({
+ label: `${member.name} - ${member.designation || 'Staff'}`,
+ value: member.id,
+ })),
+ };
+ } catch (error) {
+ return disabledOptions({ placeholder: 'Failed to load staff' });
+ }
+ },
+ });
+}
+
+function anyStaffId<R extends boolean>({
+ required,
+ displayName = 'Staff',
+ description = 'Select the staff member',
+}: PropParams<R>) {
+ return Property.Dropdown({
+ auth: zohoBookingsAuth,
+ displayName,
+ description,
+ required,
+ refreshers: ['service_id'],
+ options: async ({ auth, service_id }) => {
+ if (!auth) {
+ return disabledOptions({ placeholder: 'Authentication required' });
+ }
+ try {
+ const staff = await zohoBookingsApi.listStaff({
+ auth,
+ serviceId: service_id ? String(service_id) : undefined,
+ });
+ return {
+ disabled: false,
+ options: staff.map((member) => ({
+ label: `${member.name} - ${member.designation || 'Staff'}`,
+ value: member.id,
+ })),
+ };
+ } catch (error) {
+ return disabledOptions({ placeholder: 'Failed to load staff' });
+ }
+ },
+ });
+}
+
+function resourceId<R extends boolean>({
+ required,
+ displayName = 'Resource',
+ description = 'Select the resource (use this OR staff_id OR group_id)',
+}: PropParams<R>) {
+ return Property.Dropdown({
+ auth: zohoBookingsAuth,
+ displayName,
+ description,
+ required,
+ refreshers: ['service_id'],
+ options: async ({ auth, service_id }) => {
+ if (!service_id || !auth) {
+ return disabledOptions({ placeholder: 'Please select service first' });
+ }
+ try {
+ const resources = await zohoBookingsApi.listResources({
+ auth,
+ serviceId: String(service_id),
+ });
+ return {
+ disabled: false,
+ options: resources.map((resource) => ({
+ label: resource.name,
+ value: resource.id,
+ })),
+ };
+ } catch (error) {
+ return disabledOptions({ placeholder: 'Failed to load resources' });
+ }
+ },
+ });
+}
+
+function bookingId<R extends boolean>({
+ required,
+ displayName = 'Appointment',
+ description = 'Select the appointment to get details for',
+}: PropParams<R>) {
+ return Property.Dropdown({
+ auth: zohoBookingsAuth,
+ displayName,
+ description,
+ required,
+ refreshers: ['from_time', 'to_time'],
+ options: async ({ auth, from_time }) => {
+ if (!auth) {
+ return disabledOptions({ placeholder: 'Authentication required' });
+ }
+ if (!from_time) {
+ return disabledOptions({ placeholder: 'Please select From Time first' });
+ }
+ try {
+ const appointments = await zohoBookingsApi.listAppointments({
+ auth,
+ fromTime: String(from_time),
+ });
+ return {
+ disabled: false,
+ options: appointments.map((appointment) => ({
+ label: `${appointment.booking_id} - ${appointment.customer_name} (${appointment.service_name}) - ${appointment.start_time} [${appointment.status}]`,
+ value: appointment.booking_id,
+ })),
+ };
+ } catch (error) {
+ return disabledOptions({ placeholder: 'Failed to load appointments' });
+ }
+ },
+ });
+}
+
+function disabledOptions({ placeholder }: { placeholder: string }): DropdownState<never> {
+ return { disabled: true, options: [], placeholder };
+}
+
+export const zohoBookingsProps = {
+ workspaceId,
+ serviceId,
+ anyServiceId,
+ staffId,
+ anyStaffId,
+ resourceId,
+ bookingId,
+};
+
+export type PropParams<R extends boolean> = {
+ required: R;
+ displayName?: string;
+ description?: string;
+};
diff --git a/packages/pieces/community/zoho-bookings/src/lib/common/schemas.ts b/packages/pieces/community/zoho-bookings/src/lib/common/schemas.ts
deleted file mode 100644
index 12b22419c2f..00000000000
--- a/packages/pieces/community/zoho-bookings/src/lib/common/schemas.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-import * as z from 'zod/mini'
-
-export const bookAppointment = {
- workspace_id: z.string().check(z.minLength(1)),
- service_id: z.string().check(z.minLength(1)),
- staff_id: z.optional(z.string()),
- resource_id: z.optional(z.string()),
- group_id: z.optional(z.string()),
- from_time: z.string(),
- to_time: z.optional(z.string()),
- timezone: z.optional(z.string()),
- customer_name: z.string().check(z.minLength(1)),
- customer_email: z.string().check(z.email()),
- customer_phone: z.string().check(z.minLength(1)),
- notes: z.optional(z.string()),
- additional_fields: z.optional(z.record(z.string(), z.unknown())),
- cost_paid: z.optional(z.number().check(z.minimum(0))),
-};
-
-export const rescheduleAppointment = {
- booking_id: z.string().check(z.minLength(1)),
- service_id: z.optional(z.string()),
- staff_id: z.optional(z.string()),
- group_id: z.optional(z.string()),
- start_time: z.optional(z.string()),
-};
-
-export const fetchAvailability = {
- workspace_id: z.string().check(z.minLength(1)),
- service_id: z.string().check(z.minLength(1)),
- staff_id: z.optional(z.string()),
- group_id: z.optional(z.string()),
- resource_id: z.optional(z.string()),
- selected_date: z.string(),
-};
-
-export const getAppointmentDetails = {
- booking_id: z.string().check(z.minLength(1)),
-};
-
-export const cancelAppointment = {
- booking_id: z.string().check(z.minLength(1)),
-};
\ No newline at end of file
diff --git a/packages/pieces/community/zoho-bookings/src/lib/common/types.ts b/packages/pieces/community/zoho-bookings/src/lib/common/types.ts
new file mode 100644
index 00000000000..7ed591cb02c
--- /dev/null
+++ b/packages/pieces/community/zoho-bookings/src/lib/common/types.ts
@@ -0,0 +1,65 @@
+import type { AppConnectionType } from '@activepieces/pieces-framework';
+
+export type ZohoBookingsAuthValue = {
+ type: AppConnectionType.OAUTH2;
+ access_token: string;
+ props?: { location?: string };
+};
+
+export type ZohoBookingsWorkspace = { id: string; name: string };
+export type ZohoBookingsService = { id: string; name: string; duration?: string };
+export type ZohoBookingsStaff = { id: string; name: string; designation?: string };
+export type ZohoBookingsResource = { id: string; name: string };
+export type ZohoBookingsAppointment = {
+ booking_id: string;
+ customer_name?: string;
+ service_name?: string;
+ start_time?: string;
+ status?: string;
+};
+
+export type ZohoBookingsAppointmentsPage = {
+ response?: ZohoBookingsAppointment[] | Record<string, unknown>;
+ next_page_available?: boolean;
+ page?: number;
+};
+
+export type ZohoBookingsResponse<T = ZohoBookingsResult> = {
+ status?: string;
+ message?: string;
+ response: {
+ status: string;
+ message?: string;
+ errormessage?: string;
+ returnvalue: T;
+ };
+};
+
+export type ZohoBookingsRescheduleResult = {
+ Status?: string;
+ message?: string;
+};
+
+export type ZohoBookingsResult = Record<string, unknown>;
+
+export type ZohoBookingsStatusResult = {
+ status?: unknown;
+ message?: unknown;
+ mesage?: unknown;
+ errorMessage?: unknown;
+};
+
+export type ZohoBookingsBatchResult = {
+ response?: {
+ status?: string;
+ message?: Record<string, unknown> | string;
+ [key: string]: unknown;
+ }[];
+};
+
+export type ZohoBookingsDateOverridesPage = {
+ availability_for?: string;
+ availability_for_id?: string;
+ overrides?: Record<string, unknown>[] | string;
+ next_page_available?: boolean;
+};
diff --git a/packages/pieces/community/zoho-bookings/src/lib/output-schemas.ts b/packages/pieces/community/zoho-bookings/src/lib/output-schemas.ts
new file mode 100644
index 00000000000..b4a80137616
--- /dev/null
+++ b/packages/pieces/community/zoho-bookings/src/lib/output-schemas.ts
@@ -0,0 +1,379 @@
+import { OutputSchema } from '@activepieces/pieces-framework';
+
+const appointmentFields: OutputSchema['fields'] = [
+ { key: 'booking_id', label: 'Booking ID' },
+ { key: 'status', label: 'Status' },
+ { key: 'start_time', label: 'Start Time' },
+ { key: 'end_time', label: 'End Time' },
+ { key: 'iso_start_time', label: 'Start Time (ISO)', format: 'datetime' },
+ { key: 'iso_end_time', label: 'End Time (ISO)', format: 'datetime' },
+ { key: 'time_zone', label: 'Time Zone' },
+ { key: 'duration', label: 'Duration' },
+ { key: 'pre_buffer', label: 'Pre Buffer (Minutes)', format: 'number' },
+ { key: 'post_buffer', label: 'Post Buffer (Minutes)', format: 'number' },
+ { key: 'booking_type', label: 'Booking Type' },
+ { key: 'service_id', label: 'Service ID' },
+ { key: 'service_name', label: 'Service Name' },
+ { key: 'service_description', label: 'Service Description' },
+ { key: 'workspace_id', label: 'Workspace ID' },
+ { key: 'workspace_name', label: 'Workspace Name' },
+ { key: 'staff_id', label: 'Staff ID' },
+ { key: 'staff_name', label: 'Staff Name' },
+ { key: 'staff_designation', label: 'Staff Designation' },
+ { key: 'staff_email', label: 'Staff Email', format: 'email' },
+ { key: 'staff_contact_number', label: 'Staff Phone' },
+ { key: 'customer_name', label: 'Customer Name' },
+ { key: 'customer_email', label: 'Customer Email', format: 'email' },
+ { key: 'customer_contact_no', label: 'Customer Phone' },
+ { key: 'customer_more_info', label: 'Customer Custom Fields' },
+ { key: 'customer_booking_time_zone', label: 'Customer Time Zone' },
+ { key: 'customer_booking_start_time', label: 'Customer Start Time' },
+ { key: 'notes', label: 'Notes' },
+ { key: 'cost', label: 'Cost' },
+ { key: 'cost_paid', label: 'Cost Paid' },
+ { key: 'due', label: 'Amount Due' },
+ { key: 'currency', label: 'Currency' },
+ { key: 'payment_status', label: 'Payment Status' },
+ { key: 'summary_url', label: 'Summary URL', format: 'url' },
+ { key: 'summary_embed_url', label: 'Summary Embed URL', format: 'url' },
+ { key: 'booked_on', label: 'Booked On', format: 'datetime' },
+ { key: 'last_updated_time', label: 'Last Updated', format: 'datetime' },
+ { key: 'booked_ip_address', label: 'Booked From IP' },
+ { key: 'customer_notification', label: 'Customer Notification' },
+ { key: 'triggered_from', label: 'Triggered From' },
+];
+
+const appointmentHistoryField: OutputSchema['fields'][number] = {
+ key: 'appointment_history',
+ label: 'Appointment History',
+ children: [
+ { key: 'old_start_time', label: 'Previous Start Time' },
+ { key: 'old_end_time', label: 'Previous End Time' },
+ { key: 'old_staff_id', label: 'Previous Staff ID' },
+ { key: 'old_staff_name', label: 'Previous Staff Name' },
+ { key: 'old_staff_email', label: 'Previous Staff Email', format: 'email' },
+ { key: 'old_staff_contact_number', label: 'Previous Staff Phone' },
+ ],
+};
+
+const triggeredByField: OutputSchema['fields'][number] = {
+ key: 'triggered_by',
+ label: 'Triggered By',
+ format: 'email',
+};
+
+const resourceBookingFields: OutputSchema['fields'] = [
+ { key: 'resource_id', label: 'Resource ID' },
+ { key: 'resource_name', label: 'Resource Name' },
+ { key: 'resource_description', label: 'Resource Description' },
+ { key: 'maintainer_email', label: 'Resource Maintainer Email', format: 'email' },
+];
+
+const changedAppointmentFields: OutputSchema['fields'] = [
+ ...appointmentFields,
+ appointmentHistoryField,
+];
+
+const bookedAppointmentFields: OutputSchema['fields'] = [
+ ...appointmentFields,
+ triggeredByField,
+ ...resourceBookingFields,
+];
+
+const statusMessageFields: OutputSchema['fields'] = [
+ { key: 'status', label: 'Status' },
+ { key: 'message', label: 'Message' },
+];
+
+const customerFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Customer ID' },
+ { key: 'name', label: 'Name' },
+ { key: 'email', label: 'Email', format: 'email' },
+ { key: 'contact_number', label: 'Phone' },
+ { key: 'type', label: 'Type' },
+ { key: 'status', label: 'Status' },
+];
+
+const dateOverrideFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Override ID' },
+ { key: 'type', label: 'Type' },
+ { key: 'mode', label: 'Mode' },
+ { key: 'dates', label: 'Dates' },
+ { key: 'from_date', label: 'From Date' },
+ { key: 'to_date', label: 'To Date' },
+ { key: 'all_day', label: 'All Day' },
+ {
+ key: 'available_times',
+ label: 'Hours',
+ labelKey: 'from_time',
+ listItems: [
+ { key: 'from_time', label: 'From' },
+ { key: 'to_time', label: 'To' },
+ ],
+ },
+ { key: 'reason', label: 'Reason' },
+];
+
+const createdOverrideFields: OutputSchema['fields'] = dateOverrideFields.map((field) =>
+ field.key === 'all_day' ? { ...field, format: 'boolean' } : field,
+);
+
+const resourceFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Resource ID' },
+ { key: 'name', label: 'Name' },
+ { key: 'description', label: 'Description' },
+ { key: 'assigned_workspaces', label: 'Workspace IDs' },
+ { key: 'user_in_charge', label: 'User in Charge', format: 'email' },
+ { key: 'status', label: 'Status' },
+];
+
+export const zohoBookingsListWorkspacesOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'workspaces',
+ label: 'Workspaces',
+ labelKey: 'name',
+ listItems: [
+ { key: 'id', label: 'Workspace ID' },
+ { key: 'name', label: 'Name' },
+ { key: 'embed_url', label: 'Embed URL', format: 'url' },
+ ],
+ },
+ { key: 'count', label: 'Count', format: 'number' },
+ ],
+};
+
+export const zohoBookingsCreatedRecordOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'id', label: 'ID' },
+ { key: 'name', label: 'Name' },
+ ],
+};
+
+export const zohoBookingsStatusMessageOutputSchema: OutputSchema = {
+ fields: statusMessageFields,
+};
+
+export const zohoBookingsListServicesOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'services',
+ label: 'Services',
+ labelKey: 'name',
+ listItems: [
+ { key: 'id', label: 'Service ID' },
+ { key: 'name', label: 'Name' },
+ { key: 'service_type', label: 'Service Type' },
+ { key: 'duration', label: 'Duration' },
+ { key: 'buffertime', label: 'Buffer Time' },
+ { key: 'pre_buffer', label: 'Pre Buffer (Minutes)', format: 'number' },
+ { key: 'post_buffer', label: 'Post Buffer (Minutes)', format: 'number' },
+ { key: 'price', label: 'Price', format: 'number' },
+ { key: 'currency', label: 'Currency' },
+ { key: 'description', label: 'Description' },
+ { key: 'assigned_staffs', label: 'Staff IDs' },
+ { key: 'assigned_workspace', label: 'Workspace ID' },
+ { key: 'let_customer_select_staff', label: 'Customer Selects Staff', format: 'boolean' },
+ { key: 'embed_url', label: 'Embed URL', format: 'url' },
+ ],
+ },
+ { key: 'count', label: 'Count', format: 'number' },
+ ],
+};
+
+export const zohoBookingsListStaffOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'staff',
+ label: 'Staff',
+ labelKey: 'name',
+ listItems: [
+ { key: 'id', label: 'Staff ID' },
+ { key: 'name', label: 'Name' },
+ { key: 'email', label: 'Email', format: 'email' },
+ { key: 'role', label: 'Role' },
+ { key: 'designation', label: 'Designation' },
+ { key: 'phone_number', label: 'Phone' },
+ { key: 'gender', label: 'Gender' },
+ { key: 'date_of_birth', label: 'Date of Birth' },
+ { key: 'additional_information', label: 'Additional Information' },
+ { key: 'photo', label: 'Photo', format: 'image' },
+ { key: 'assigned_services', label: 'Service IDs' },
+ { key: 'assigned_workspaces', label: 'Workspace IDs' },
+ { key: 'embed_url', label: 'Embed URL', format: 'url' },
+ ],
+ },
+ { key: 'count', label: 'Count', format: 'number' },
+ ],
+};
+
+export const zohoBookingsAddStaffOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'id', label: 'Staff ID' },
+ { key: 'name', label: 'Name' },
+ { key: 'email', label: 'Email', format: 'email' },
+ { key: 'status', label: 'Status' },
+ ],
+};
+
+export const zohoBookingsListResourcesOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'resources',
+ label: 'Resources',
+ labelKey: 'name',
+ listItems: [
+ { key: 'id', label: 'Resource ID' },
+ { key: 'name', label: 'Name' },
+ ],
+ },
+ { key: 'count', label: 'Count', format: 'number' },
+ ],
+};
+
+export const zohoBookingsCreateResourceOutputSchema: OutputSchema = {
+ fields: resourceFields,
+};
+
+export const zohoBookingsUpdateResourceOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'message',
+ label: 'Resource',
+ children: [...resourceFields, { key: 'assigned_services', label: 'Service IDs' }],
+ },
+ { key: 'status', label: 'Status' },
+ ],
+};
+
+export const zohoBookingsDeleteRecordOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'message', label: 'Message' },
+ { key: 'status', label: 'Status' },
+ ],
+};
+
+export const zohoBookingsCustomerOutputSchema: OutputSchema = {
+ fields: customerFields,
+};
+
+export const zohoBookingsBookAppointmentOutputSchema: OutputSchema = {
+ fields: bookedAppointmentFields,
+};
+
+export const zohoBookingsAppointmentOutputSchema: OutputSchema = {
+ fields: changedAppointmentFields,
+};
+
+export const zohoBookingsListAppointmentsOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'appointments',
+ label: 'Appointments',
+ labelKey: 'booking_id',
+ listItems: bookedAppointmentFields,
+ },
+ { key: 'count', label: 'Count', format: 'number' },
+ { key: 'page', label: 'Page', format: 'number' },
+ { key: 'next_page_available', label: 'Next Page Available', format: 'boolean' },
+ ],
+};
+
+export const zohoBookingsGetAvailableSlotsOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'time_zone', label: 'Time Zone' },
+ { key: 'slots', label: 'Slots' },
+ ],
+};
+
+export const zohoBookingsListDateOverridesOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'overrides',
+ label: 'Overrides',
+ labelKey: 'id',
+ listItems: dateOverrideFields,
+ },
+ { key: 'count', label: 'Count', format: 'number' },
+ { key: 'page', label: 'Page', format: 'number' },
+ { key: 'next_page_available', label: 'Next Page Available', format: 'boolean' },
+ ],
+};
+
+export const zohoBookingsCreateDateOverridesOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'status', label: 'Status' },
+ {
+ key: 'overrides',
+ label: 'Overrides',
+ labelKey: 'id',
+ listItems: createdOverrideFields,
+ },
+ ],
+};
+
+export const zohoBookingsUpdateDateOverridesOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'status', label: 'Status' },
+ {
+ key: 'overrides',
+ label: 'Overrides',
+ labelKey: 'id',
+ listItems: createdOverrideFields.filter(
+ (field) => field.key !== 'from_date' && field.key !== 'to_date',
+ ),
+ },
+ ],
+};
+
+export const getAppointmentDetailsOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'response',
+ label: 'Response',
+ children: [
+ { key: 'returnvalue', label: 'Appointment', children: changedAppointmentFields },
+ { key: 'status', label: 'Status' },
+ ],
+ },
+ ],
+};
+
+export const bookAppointmentOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'returnvalue',
+ label: 'Appointment',
+ children: [...appointmentFields, triggeredByField],
+ },
+ { key: 'status', label: 'Status' },
+ ],
+};
+
+export const rescheduleAppointmentOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'returnvalue', label: 'Appointment', children: changedAppointmentFields },
+ { key: 'status', label: 'Status' },
+ ],
+};
+
+export const fetchAvailabilityOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'response',
+ label: 'Response',
+ children: [
+ {
+ key: 'returnvalue',
+ label: 'Availability',
+ children: [
+ { key: 'time_zone', label: 'Time Zone' },
+ { key: 'reponse', label: 'Slots Available', format: 'boolean' },
+ { key: 'data', label: 'Slots' },
+ ],
+ },
+ { key: 'status', label: 'Status' },
+ ],
+ },
+ ],
+};