import {z} from 'zod' export type PatchApiV3SequencesAiSdrSequenceIdSettingsArgs = {sequence_id: number, body: {offerId?: number | undefined, offerGenerationInputs?: ({companyName?: string | undefined, companyDescription?: string | undefined, icp?: string | undefined, reasonForOutreach?: string | undefined, caseStudies?: Array | undefined, painPoints?: Array | undefined, proofPoints?: Array | undefined, valuePropositions?: Array | undefined, callToActions?: Array | undefined}) | undefined, toneOfVoice?: ({language?: ('englishUS' | 'englishUK' | 'spanish' | 'albanian' | 'armenian' | 'bengali' | 'bosnian' | 'bulgarian' | 'catalan' | 'chinese' | 'croatian' | 'czech' | 'danish' | 'dutch' | 'estonian' | 'finnish' | 'french' | 'georgian' | 'german' | 'greek' | 'hindi' | 'hungarian' | 'icelandic' | 'indonesian' | 'italian' | 'japanese' | 'kazakh' | 'korean' | 'latvian' | 'lithuanian' | 'macedonian' | 'malay' | 'mongolian' | 'norwegian' | 'persian' | 'polish' | 'portugueseEU' | 'portugueseBR' | 'romanian' | 'serbian' | 'slovak' | 'slovenian' | 'swedish' | 'thai' | 'turkish' | 'ukrainian' | 'vietnamese' | 'arabic' | 'uzbek' | 'hebrew' | null) | undefined, toneOfVoice?: ('confident' | 'persuasive' | 'witty' | 'straightforward' | 'empathetic' | null) | undefined, messageLength?: ('superShort' | 'short' | 'medium' | 'long' | null) | undefined, gender?: ('man' | 'woman' | null) | undefined}) | undefined, providerLLM?: ('claude' | 'openAi' | 'gemini' | 'mistral') | undefined, personalizationPoints?: ({basicResearch?: (boolean | null) | undefined, companyResearch?: ({description?: (boolean | null) | undefined, mission?: (boolean | null) | undefined, techStack?: (boolean | null) | undefined, tenKReport?: (boolean | null) | undefined, recentReportForInvestors?: (boolean | null) | undefined, financialReport?: (boolean | null) | undefined, fundraisingResearch?: (boolean | null) | undefined, challenges?: (boolean | null) | undefined, recentNews?: (boolean | null) | undefined, predictChallengesAndCompetitors?: (boolean | null) | undefined, productsServicesDeepDive?: (boolean | null) | undefined, mergersAcquisitions?: (boolean | null) | undefined, customerReviews?: (boolean | null) | undefined} | null) | undefined, prospectResearch?: ({aboutSection?: (boolean | null) | undefined, hobbiesInterests?: (boolean | null) | undefined, quotes?: (boolean | null) | undefined, achievements?: (boolean | null) | undefined, careerSummary?: (boolean | null) | undefined, jobResponsibilitiesInCurrentCompany?: (boolean | null) | undefined, achievementsInCurrentCompany?: (boolean | null) | undefined} | null) | undefined, industryResearch?: ({recentIndustryNews?: (boolean | null) | undefined, industryTrends?: (boolean | null) | undefined, competitorsOverviewNews?: (boolean | null) | undefined} | null) | undefined, contactFields?: ({enabled?: (boolean | null) | undefined, defaultFields?: (Array<'firstName' | 'lastName' | 'title' | 'companySize' | 'industry' | 'city' | 'state' | 'country'> | null) | undefined, customFieldIds?: (Array | null) | undefined} | null) | undefined, customResearch?: ({enabled?: (boolean | null) | undefined, instructions?: (string | null) | undefined} | null) | undefined}) | undefined, autopilot?: ({filters?: ({accountListIds?: (Array<{value: number, type?: ('include' | 'exclude') | undefined}>) | undefined, industries?: (Array<{value: string, type?: ('include' | 'exclude') | undefined}>) | undefined, companyLocations?: (Array<{value: string, type?: ('include' | 'exclude') | undefined}>) | undefined, companySizes?: (Array<'none' | 'selfEmployed' | 'ten' | 'fifty' | 'twoHundred' | 'fiveHundred' | 'oneThousand' | 'fiveThousand' | 'tenThousand' | 'overTenThousand'>) | undefined, headcountGrowth?: ({min?: (number | null) | undefined, max?: (number | null) | undefined} | null) | undefined, departmentHeadcountGrowth?: ({min?: (number | null) | undefined, max?: (number | null) | undefined, department: string} | null) | undefined, minRevenue?: ('zeroMillion' | 'halfMillion' | 'oneMillion' | 'twoAndHalfMillion' | 'fiveMillion' | 'tenMillion' | 'twentyMillion' | 'fiftyMillion' | 'oneHundredMillion' | 'fiveHundredMillion' | 'oneThousandMillion' | 'overOneThousandMillion' | null) | undefined, maxRevenue?: ('zeroMillion' | 'halfMillion' | 'oneMillion' | 'twoAndHalfMillion' | 'fiveMillion' | 'tenMillion' | 'twentyMillion' | 'fiftyMillion' | 'oneHundredMillion' | 'fiveHundredMillion' | 'oneThousandMillion' | 'overOneThousandMillion' | null) | undefined, accountKeywords?: ({values?: (Array<{value: string, type?: ('include' | 'exclude') | undefined}>) | undefined, type?: ('or' | 'and') | undefined}) | undefined, isHiringOnLinkedIn?: boolean | undefined, contactLocations?: (Array<{value: string, type?: ('include' | 'exclude') | undefined}>) | undefined, jobTitles?: (Array<{value: string, type?: ('include' | 'exclude') | undefined}>) | undefined, departments?: (Array<{value: string, type?: ('include' | 'exclude') | undefined}>) | undefined, seniorities?: Array | undefined, yearsInCompany?: (Array<'none' | 'lessThanOneYear' | 'oneToTwoYears' | 'threeToFiveYears' | 'sixToTenYears' | 'moreThanTenYears'>) | undefined, contactKeywords?: ({values?: (Array<{value: string, type?: ('include' | 'exclude') | undefined}>) | undefined, type?: ('or' | 'and') | undefined}) | undefined, changedJobIn90Days?: boolean | undefined}) | undefined, referenceUrl?: string | undefined, maxPeoplePerCompany?: number | undefined, maxPeopleToAddPerDay?: number | undefined, searchContactPhones?: boolean | undefined, addContactsWithoutEmailAddresses?: boolean | undefined}) | undefined, intentSignals?: (Array<{type: 'linkedInPostEngagers' | 'competitorFollowers' | 'technologyUsed' | 'jobHiring', postEngagers?: ({mode: 'monitorProfiles' | 'monitorPosts', icpFitPercentage?: (20 | 40 | 60 | 80 | 100) | undefined, monitorProfiles?: ({monitorForDays: 2 | 3 | 5 | 7 | 15 | 30, profiles?: (Array<{linkedInUrl: string, numberOfPosts?: (3 | 5 | 10 | 15 | 20) | undefined}>) | undefined} | null) | undefined, monitorPosts?: ({postUrls?: Array | undefined} | null) | undefined} | null) | undefined, competitorFollowers?: ({linkedInUrls?: Array | undefined, entitiesToFind?: number | undefined, icpFitPercentage?: (20 | 40 | 60 | 80 | 100) | undefined} | null) | undefined, technologyUsed?: ({industryId?: (number | null) | undefined, technologies?: Array | undefined, useAndLogicInTechnologies?: boolean | undefined, entitiesToFind?: number | undefined} | null) | undefined, jobHiring?: ({keyword: string, industries?: Array | undefined, entitiesToFind?: number | undefined} | null) | undefined}>) | undefined}}; export type PatchApiV3SequencesAiSdrSequenceIdSettingsOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; export const patchApiV3SequencesAiSdrSequenceIdSettingsResponse = z.object({offerId: z.number().int().nullable().optional(), offerGenerationInputs: z.object({companyName: z.string().max(200).optional(), companyDescription: z.string().max(3000).optional(), icp: z.string().max(1000).optional(), reasonForOutreach: z.string().max(1000).optional(), caseStudies: z.array(z.string().min(1).max(1000)).optional(), painPoints: z.array(z.string().min(1).max(1000)).optional(), proofPoints: z.array(z.string().min(1).max(1000)).optional(), valuePropositions: z.array(z.string().min(1).max(1000)).optional(), callToActions: z.array(z.string().min(1).max(1000)).optional()}).optional(), toneOfVoice: z.object({language: z.enum(["englishUS", "englishUK", "spanish", "albanian", "armenian", "bengali", "bosnian", "bulgarian", "catalan", "chinese", "croatian", "czech", "danish", "dutch", "estonian", "finnish", "french", "georgian", "german", "greek", "hindi", "hungarian", "icelandic", "indonesian", "italian", "japanese", "kazakh", "korean", "latvian", "lithuanian", "macedonian", "malay", "mongolian", "norwegian", "persian", "polish", "portugueseEU", "portugueseBR", "romanian", "serbian", "slovak", "slovenian", "swedish", "thai", "turkish", "ukrainian", "vietnamese", "arabic", "uzbek", "hebrew"]).optional(), toneOfVoice: z.enum(["confident", "persuasive", "witty", "straightforward", "empathetic"]).optional(), messageLength: z.enum(["superShort", "short", "medium", "long"]).optional(), gender: z.enum(["man", "woman"]).optional()}).optional(), generatedStepTypes: z.array(z.enum(["email", "linkedIn", "call", "linkedInInMail", "linkedInAiVoice"])).optional(), providerLLM: z.enum(["claude", "openAi", "gemini", "mistral"]).optional(), personalizationPoints: z.object({basicResearch: z.boolean().nullable().optional(), companyResearch: z.object({description: z.boolean().nullable().optional(), mission: z.boolean().nullable().optional(), techStack: z.boolean().nullable().optional(), tenKReport: z.boolean().nullable().optional(), recentReportForInvestors: z.boolean().nullable().optional(), financialReport: z.boolean().nullable().optional(), fundraisingResearch: z.boolean().nullable().optional(), challenges: z.boolean().nullable().optional(), recentNews: z.boolean().nullable().optional(), predictChallengesAndCompetitors: z.boolean().nullable().optional(), productsServicesDeepDive: z.boolean().nullable().optional(), mergersAcquisitions: z.boolean().nullable().optional(), customerReviews: z.boolean().nullable().optional()}).nullable().optional(), prospectResearch: z.object({aboutSection: z.boolean().nullable().optional(), hobbiesInterests: z.boolean().nullable().optional(), quotes: z.boolean().nullable().optional(), achievements: z.boolean().nullable().optional(), careerSummary: z.boolean().nullable().optional(), jobResponsibilitiesInCurrentCompany: z.boolean().nullable().optional(), achievementsInCurrentCompany: z.boolean().nullable().optional()}).nullable().optional(), industryResearch: z.object({recentIndustryNews: z.boolean().nullable().optional(), industryTrends: z.boolean().nullable().optional(), competitorsOverviewNews: z.boolean().nullable().optional()}).nullable().optional(), contactFields: z.object({enabled: z.boolean().nullable().optional(), defaultFields: z.array(z.enum(["firstName", "lastName", "title", "companySize", "industry", "city", "state", "country"])).nullable().optional(), customFieldIds: z.array(z.number().int().gte(1)).nullable().optional()}).nullable().optional(), customResearch: z.object({enabled: z.boolean().nullable().optional(), instructions: z.string().max(2000).nullable().optional()}).nullable().optional()}).optional(), autopilot: z.object({status: z.enum(["enabled", "disabled", "paused", "disabledByLackOfContacts", "disabledByContactsLimitExceeded"]).optional(), isSearchInProgress: z.boolean().optional(), filters: z.object({accountListIds: z.array(z.object({value: z.number().int().gte(1), type: z.enum(["include", "exclude"]).optional()})).optional(), industries: z.array(z.object({value: z.string().max(200), type: z.enum(["include", "exclude"]).optional()})).optional(), companyLocations: z.array(z.object({value: z.string().max(200), type: z.enum(["include", "exclude"]).optional()})).optional(), companySizes: z.array(z.enum(["none", "selfEmployed", "ten", "fifty", "twoHundred", "fiveHundred", "oneThousand", "fiveThousand", "tenThousand", "overTenThousand"])).optional(), headcountGrowth: z.object({min: z.number().int().gte(0).nullable().optional(), max: z.number().int().gte(0).nullable().optional()}).nullable().optional(), departmentHeadcountGrowth: z.object({min: z.number().int().gte(0).nullable().optional(), max: z.number().int().gte(0).nullable().optional(), department: z.string().max(200)}).nullable().optional(), minRevenue: z.enum(["zeroMillion", "halfMillion", "oneMillion", "twoAndHalfMillion", "fiveMillion", "tenMillion", "twentyMillion", "fiftyMillion", "oneHundredMillion", "fiveHundredMillion", "oneThousandMillion", "overOneThousandMillion"]).nullable().optional(), maxRevenue: z.enum(["zeroMillion", "halfMillion", "oneMillion", "twoAndHalfMillion", "fiveMillion", "tenMillion", "twentyMillion", "fiftyMillion", "oneHundredMillion", "fiveHundredMillion", "oneThousandMillion", "overOneThousandMillion"]).nullable().optional(), accountKeywords: z.object({values: z.array(z.object({value: z.string().max(200), type: z.enum(["include", "exclude"]).optional()})).optional(), type: z.enum(["or", "and"]).optional()}).optional(), isHiringOnLinkedIn: z.boolean().optional(), contactLocations: z.array(z.object({value: z.string().max(200), type: z.enum(["include", "exclude"]).optional()})).optional(), jobTitles: z.array(z.object({value: z.string().max(200), type: z.enum(["include", "exclude"]).optional()})).optional(), departments: z.array(z.object({value: z.string().max(200), type: z.enum(["include", "exclude"]).optional()})).optional(), seniorities: z.array(z.string().min(1).max(200)).optional(), yearsInCompany: z.array(z.enum(["none", "lessThanOneYear", "oneToTwoYears", "threeToFiveYears", "sixToTenYears", "moreThanTenYears"])).optional(), contactKeywords: z.object({values: z.array(z.object({value: z.string().max(200), type: z.enum(["include", "exclude"]).optional()})).optional(), type: z.enum(["or", "and"]).optional()}).optional(), changedJobIn90Days: z.boolean().optional()}).optional(), referenceUrl: z.string().nullable().optional(), maxPeoplePerCompany: z.number().int().optional(), maxPeopleToAddPerDay: z.number().int().optional(), searchContactPhones: z.boolean().optional(), addContactsWithoutEmailAddresses: z.boolean().optional()}).optional(), playbookId: z.string().nullable().optional(), knowledgeBaseId: z.number().int().nullable().optional(), approvalMode: z.object({enabled: z.boolean().optional()}).optional(), intentSignals: z.array(z.object({type: z.enum(["linkedInPostEngagers", "competitorFollowers", "technologyUsed", "jobHiring"]), postEngagers: z.object({mode: z.enum(["monitorProfiles", "monitorPosts"]), icpFitPercentage: z.union([z.literal(20), z.literal(40), z.literal(60), z.literal(80), z.literal(100)]).optional(), monitorProfiles: z.object({monitorForDays: z.union([z.literal(2), z.literal(3), z.literal(5), z.literal(7), z.literal(15), z.literal(30)]), profiles: z.array(z.object({linkedInUrl: z.string().min(1).max(2048), numberOfPosts: z.union([z.literal(3), z.literal(5), z.literal(10), z.literal(15), z.literal(20)]).optional()})).optional()}).nullable().optional(), monitorPosts: z.object({postUrls: z.array(z.string().min(1).max(2048)).optional()}).nullable().optional()}).nullable().optional(), competitorFollowers: z.object({linkedInUrls: z.array(z.string().min(1).max(2048)).optional(), entitiesToFind: z.number().int().gte(100).lte(500).optional(), icpFitPercentage: z.union([z.literal(20), z.literal(40), z.literal(60), z.literal(80), z.literal(100)]).optional()}).nullable().optional(), technologyUsed: z.object({industryId: z.number().int().gte(1).nullable().optional(), technologies: z.array(z.string().min(1).max(200)).optional(), useAndLogicInTechnologies: z.boolean().optional(), entitiesToFind: z.number().int().gte(1).lte(500).optional()}).nullable().optional(), jobHiring: z.object({keyword: z.string().min(1).max(200), industries: z.array(z.number().int().gte(1)).optional(), entitiesToFind: z.number().int().gte(1).lte(500).optional()}).nullable().optional()})).optional()}); export const validateResponse = async ( schema: { readonly '~standard': { readonly validate: (value: unknown) => ({ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }) | Promise<{ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }> } }, value: unknown ): Promise => { const result = await schema['~standard'].validate(value) if (result.issues !== undefined) { const detail = result.issues .map(({ message, path }) => path?.length ? `${path.map((segment) => String(typeof segment === 'object' ? segment.key : segment)).join('.')}: ${message}` : message ) .join('; ') throw new Error(`Response does not match the schema: ${detail}`, { cause: { issues: result.issues } }) } return result.value }; /** * Update AI SDR sequence settings * * PATCH /v3/sequences/ai-sdr/{sequence_id}/settings */ export const patchApiV3SequencesAiSdrSequenceIdSettings = async (args: PatchApiV3SequencesAiSdrSequenceIdSettingsArgs, options?: PatchApiV3SequencesAiSdrSequenceIdSettingsOptions) => { const {baseUrl = "https://api.reply.io", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v3/sequences/ai-sdr/${encodeURIComponent(String(args.sequence_id))}/settings${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return validateResponse(patchApiV3SequencesAiSdrSequenceIdSettingsResponse, await res.json()) };