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

@@ -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);