import z from "zod";
// Campaign Schemas
export const ListCampaignsSchema = {
from_datetime: z
.string()
.optional()
.describe("Start datetime for filtering campaigns"),
to_datetime: z
.string()
.optional()
.describe("End datetime for filtering campaigns"),
type: z.string().optional().describe("Campaign type filter"),
contact_number: z.string().optional().describe("Contact number to filter by"),
sales_dialer_number: z
.string()
.optional()
.describe("Sales dialer number to filter by"),
page: z.number().optional().describe("Page number for pagination"),
per_page: z.number().optional().describe("Number of campaigns per page"),
order: z.string().optional().describe("Order for sorting"),
last_campaign_id_fetched: z
.number()
.optional()
.describe("Last campaign ID fetched"),
};
export const GetCampaignSchema = {
id: z.number().describe("Unique identifier of the campaign"),
};
export const CreateCampaignSchema = {
name: z.string().describe("Provide a name for the campaign"),
country_code: z
.string()
.describe(
"Default country code for phone numbers where the country code is not present",
),
type: z
.enum(["Autodial", "Predictive", "Dynamic"])
.optional()
.describe("Select a type from Autodial, Predictive, or Dynamic"),
maximum_calls_per_agent: z
.number()
.optional()
.describe(
"Maximum number of calls allowed per agent (2-10, only for Predictive)",
),
default_number: z
.string()
.optional()
.describe("Set a default phone number for the campaign"),
call_forwarding_number: z
.string()
.optional()
.describe("Number to which incoming calls should be forwarded"),
assign_agents: z
.string()
.optional()
.describe("Comma separated IDs of agents to assign to the campaign"),
contact_dialing_order: z
.enum(["first_in_first_out", "last_in_first_out"])
.optional()
.describe("Order in which contacts are dialed"),
disposition_groups: z
.string()
.optional()
.describe("Comma separated IDs of Disposition Groups"),
call_scripts: z
.string()
.optional()
.describe("Comma separated IDs of Call Scripts"),
voicemail_message_id: z
.number()
.optional()
.describe("ID of the voicemail audio message"),
abandoning_message_id: z
.number()
.optional()
.describe("ID of the abandoning audio message"),
};
export const UpdateCampaignSchema = {
id: z.number().describe("Unique identifier of the campaign"),
name: z.string().optional().describe("Updated name of the campaign"),
type: z
.enum(["Autodial", "Predictive", "Dynamic"])
.optional()
.describe("Updated campaign type"),
maximum_calls_per_agent: z
.number()
.optional()
.describe("Updated maximum calls per agent"),
default_number: z
.string()
.optional()
.describe("Updated default phone number"),
call_forwarding_number: z
.string()
.optional()
.describe("Updated call forwarding number"),
assign_agents: z
.string()
.optional()
.describe("Updated comma separated agent IDs"),
contact_dialing_order: z
.enum(["first_in_first_out", "last_in_first_out"])
.optional()
.describe("Updated dialing order"),
disposition_groups: z
.string()
.optional()
.describe("Updated disposition groups"),
call_scripts: z.string().optional().describe("Updated call scripts"),
voicemail_message_id: z
.number()
.optional()
.describe("Updated voicemail message ID"),
abandoning_message_id: z
.number()
.optional()
.describe("Updated abandoning message ID"),
};
// Campaign Contacts Schemas
const CustomFieldSchema = z.object({
key: z.string().describe("Key of the custom field"),
value: z.string().describe("Value of the custom field"),
});
export const ListCampaignContactsSchema = {
campaign_id: z
.number()
.describe(
"Unique id of the campaign generated by Sales Dialer. You can find the Campaign ID in the Campaigns tab in your Sales Dialer account below the name of each Campaign. Please use only the numerical part as the ID",
),
contact_status: z
.enum(["Active", "Invalid", "DNCA"])
.optional()
.describe(
"Set contact status to 'Active', 'DNCA', or 'Invalid' to filter based on the status of a contact's number in a specific campaign",
),
progress_status: z
.enum(["Dialed", "Skipped", "Undialed"])
.optional()
.describe(
"Set progress status to 'Dialed', 'Undialed' or 'Skipped' to filter contacts in a campaign based on whether they have been contacted successfully or not",
),
per_page: z
.number()
.optional()
.describe(
"Number of contacts to be fetched per page. Default value will be 10.",
),
page: z
.number()
.optional()
.describe(
"Page number for which contacts are to be fetched. Default value will be 0.",
),
order: z
.enum(["asc", "desc"])
.optional()
.describe(
"Order in which the contacts list should appear (asc or desc). Sorting is done based on contact creation time and recent contacts are represented with larger ID values. Default value will be desc.",
),
};
export const AddContactToCampaignSchema = {
campaign_id: z
.number()
.describe("Id of the campaign to which the contact is to be added"),
contact_id: z
.number()
.optional()
.describe(
"Id of the contact to add in the campaign. This field, if sent, will be used to search for the contact. Please send only one of contact_id and phone_number fields.",
),
phone_number: z
.string()
.optional()
.describe(
"Phone number of the contact. This field, if sent, will be used by us to search the contact. Please send only one of contact_id and phone_number fields.",
),
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(
"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",
),
};