chore: added email and company form to cal.ai form (#14306)

* added email and company form

* i18n

* feat: add guest email and company

* chore: update and format prompt

* chore: hint var

* chore: fix err message

---------

Co-authored-by: Udit Takkar <[email protected]>
Co-authored-by: Udit Takkar <[email protected]>
This commit is contained in:
authored and GitHub committed 2024-04-04 11:57:43 +00:00
1 parent 99f9a121cb
commit a8d8c992a4
10 files changed
+96 -8

No files matched your search

@@ -65,6 +65,8 @@ export type FormValues = {
yourPhoneNumber: string;
numberToCall: string;
guestName: string;
guestEmail: string;
guestCompany: string;
};
customInputs: CustomInputParsed[];
schedule: number | null;
@@ -53,6 +53,8 @@ export type Event = {
yourPhoneNumber: string;
numberToCall: string;
guestName: string;
guestEmail: string;
guestCompany: string;
};
schedulingType: string;
length: number;
@@ -0,0 +1,10 @@
/*
Warnings:
- Added the required column `guestCompany` to the `AIPhoneCallConfiguration` table without a default value. This is not possible if the table is not empty.
- Added the required column `guestEmail` to the `AIPhoneCallConfiguration` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "AIPhoneCallConfiguration" ADD COLUMN "guestCompany" TEXT NOT NULL,
ADD COLUMN "guestEmail" TEXT NOT NULL;
+3 -1
View File
@@ -396,7 +396,7 @@ model OrganizationSettings {
isOrganizationVerified Boolean @default(false)
orgAutoAcceptEmail String
lockEventTypeCreationForUsers Boolean @default(false)
// It decides if instance ADMIN has reviewed the organization or not.
// It decides if instance ADMIN has reviewed the organization or not.
// It is used to allow super sensitive operations like 'impersonation of Org members by Org admin'
isAdminReviewed Boolean @default(false)
dSyncData DSyncData?
@@ -919,6 +919,8 @@ model AIPhoneCallConfiguration {
yourPhoneNumber String
numberToCall String
guestName String
guestEmail String
guestCompany String
enabled Boolean @default(false)
beginMessage String?
llmId String?
+6
View File
@@ -702,6 +702,12 @@ export const AIPhoneSettingSchema = z.object({
guestName: z.string().trim().min(1, {
message: "Please enter Guest Name",
}),
guestEmail: z.string().trim().email().min(1, {
message: "Please enter Guest Email",
}),
guestCompany: z.string().trim().min(1, {
message: "Please enter Guest Company",
}),
generalPrompt: z.string().trim().min(1, {
message: "Please enter prompt",
}),
@@ -16,6 +16,8 @@ export const EventTypeUpdateInput = _EventTypeModel
yourPhoneNumber: z.string().default(""),
numberToCall: z.string().default(""),
guestName: z.string().default(""),
guestEmail: z.string().default(""),
guestCompany: z.string().default(""),
})
.optional(),
calAiPhoneScript: z.string().optional(),
@@ -60,8 +60,17 @@ const createPhoneCallHandler = async ({ input, ctx }: CreatePhoneCallProps) => {
identifier: `createPhoneCall:${ctx.user.id}`,
});
const { yourPhoneNumber, numberToCall, guestName, eventTypeId, beginMessage, generalPrompt, calApiKey } =
input;
const {
yourPhoneNumber,
numberToCall,
guestName,
guestEmail,
guestCompany,
eventTypeId,
beginMessage,
generalPrompt,
calApiKey,
} = input;
const aiPhoneCallConfig = await ctx.prisma.aIPhoneCallConfiguration.upsert({
where: {
@@ -72,6 +81,8 @@ const createPhoneCallHandler = async ({ input, ctx }: CreatePhoneCallProps) => {
generalPrompt,
enabled: true,
guestName,
guestEmail,
guestCompany,
numberToCall,
yourPhoneNumber,
},
@@ -81,6 +92,8 @@ const createPhoneCallHandler = async ({ input, ctx }: CreatePhoneCallProps) => {
generalPrompt,
enabled: true,
guestName,
guestEmail,
guestCompany,
numberToCall,
yourPhoneNumber,
},
@@ -169,7 +182,7 @@ const createPhoneCallHandler = async ({ input, ctx }: CreatePhoneCallProps) => {
body: JSON.stringify({
from_number: yourPhoneNumber,
to_number: numberToCall,
retell_llm_dynamic_variables: { name: guestName },
retell_llm_dynamic_variables: { name: guestName, company: guestCompany, email: guestEmail },
}),
}).then(createPhoneSchema.parse);