import z from "zod";
// Custom Field Schema
const CustomFieldSchema = z.object({
key: z.string().describe("Key of the custom field"),
value: z.string().describe("Value of the custom field"),
});
// Sales Dialer Contacts Schemas
export const ListSalesDialerContactsSchema = {
phone_number: z
.string()
.optional()
.describe("Find a contact using it's phone number"),
email: z.string().optional().describe("Find a contact using it's email id"),
status: z
.enum(["Active", "DNCA"])
.optional()
.describe(
"Search for contacts based on their status. The status can be out of: Active or DNCA (Do not call again)",
),
last_contact_id_fetched: z
.number()
.optional()
.describe(
"Id of the last contact fetched in the previous query. This Id ensures that you won't receive any duplicate data when using the 'next_page_link' parameter",
),
per_page: z
.number()
.optional()
.describe("Number of contacts to be fetched per page"),
page: z
.number()
.optional()
.describe("Page number for which contacts are to be fetched"),
order: z
.enum(["ASC", "DESC"])
.optional()
.describe(
"Order in which the contacts list should appear. Sorting is done based on contact creation time and recent contacts are represented with larger ID values",
),
};
export const GetSalesDialerContactSchema = {
id: z.number().describe("Unique identifier of the Sales Dialer contact"),
};
export const CreateSalesDialerContactSchema = {
name: z.string().describe("Name of the contact"),
phone_number: z.string().describe("Phone number of the contact"),
email: z.string().optional().describe("Email id of the contact"),
birthday: z
.string()
.optional()
.describe("Birth date of the contact in yyyy-mm-dd format"),
occupation: z.string().optional().describe("Occupation of the contact"),
address: z.string().optional().describe("Address of the contact"),
custom_fields: z
.array(CustomFieldSchema)
.optional()
.describe(
"Set values for the existing custom fields associated with the contacts. You can find the list of such custom fields along with their Key in your account settings under the 'Custom Fields' section",
),
};
export const UpdateSalesDialerContactSchema = {
id: z
.number()
.describe("Enter the Id of the contact which is to be updated."),
name: z.string().optional().describe("Name of the contact"),
email: z.string().optional().describe("Email id of the contact"),
birthday: z
.string()
.optional()
.describe("Birth date of the contact in yyyy-mm-dd format"),
occupation: z.string().optional().describe("Occupation of the contact"),
address: z.string().optional().describe("Address of the contact"),
custom_fields: z
.array(CustomFieldSchema)
.optional()
.describe("Array of custom field objects"),
};
// Bulk Import Schemas
const SdContactPayloadSchema = z.object({
name: z.string().describe("Name of the contact"),
phone_number: z.string().describe("Phone number of the contact"),
email: z.string().optional().describe("Email id of the contact"),
birthday: z
.string()
.optional()
.describe("Birth date of the contact in yyyy-mm-dd format"),
occupation: z.string().optional().describe("Occupation of the contact"),
address: z.string().optional().describe("Address of the contact"),
custom_fields: z
.array(CustomFieldSchema)
.optional()
.describe("Set values for existing custom fields"),
});
export const ImportSalesDialerContactsSchema = {
campaign_id: z
.number()
.optional()
.describe(
"If an Id is added for a campaign, the contacts will be added to the particular campaign. Existing contacts will be added directly, while the new ones will first be created and then added to the campaign.",
),
callback_url: z
.string()
.optional()
.describe("Callback URL to notify users when an import is complete."),
contacts: z
.array(SdContactPayloadSchema)
.describe(
"An array of objects containing information about a single Sales Dialer contact. Up to 250 contacts may be included in a single request. The suggested minimum number of contacts is 10.",
),
};
export const ImportSalesDialerContactsStatusSchema = {
batch_id: z
.string()
.describe(
"Unique id of the contact import batch generated by Sales Dialer. This id is returned in the response for the 'Bulk import contacts' API endpoint.",
),
};
// Bulk Add DNCA Schema
export const AddSalesDialerContactsDncaSchema = {
contact_numbers: z
.array(z.string())
.optional()
.describe(
"Comma separated list of contact numbers to be added to DNCA list. If any of the provided numbers is invalid, it will be skipped. You can monitor the response to track skipped numbers. Please send only one of contact_numbers and contact_ids fields.",
),
contact_ids: z
.array(z.number())
.optional()
.describe(
"Comma separated list of contact IDs to add in the campaign. Please send only one of contact_numbers and contact_ids fields.",
),
};
// Custom Fields Schema
export const ListSalesDialerCustomFieldsSchema = {
id: z
.number()
.optional()
.describe(
"Search for a custom field using the unique key generated by Sales Dialer.",
),
label: z
.string()
.optional()
.describe(
"Search for a custom field via the label of the field as defined by you in Sales Dialer.",
),
};