Files
2026-07-13 13:34:48 +08:00

25 lines
1.3 KiB
TypeScript

import { z } from '@botpress/sdk'
import { EMAIL_ADDRESS_DESCRIPTION, EmailAddressSchema, NonBlankString } from './common'
/** The common send email input schema which will be exposed to users in Botpress Studio */
export const sendMailInputSchema = z.object({
from: EmailAddressSchema.describe(EMAIL_ADDRESS_DESCRIPTION).title('Email Sender'),
to: EmailAddressSchema.describe(EMAIL_ADDRESS_DESCRIPTION).title('Email Recipient'),
cc: z.array(EmailAddressSchema).optional().describe('List of carbon copy recipients').title('Carbon Copy'),
bcc: z
.array(EmailAddressSchema)
.optional()
.describe('List of blind carbon copy recipients')
.title('Blind Carbon Copy'),
subject: NonBlankString.describe('The subject of the email (e.g. How to build a bot with Botpress!)').title(
'Email Subject'
),
body: NonBlankString.describe('The markdown rich-text body of the email').title('Email Body'), // TODO: Think of an example to place here
replyTo: EmailAddressSchema.describe(EMAIL_ADDRESS_DESCRIPTION).title('Reply To').optional(),
})
/** The response schema for Resend's send email endpoint for successful requests. */
export const sendEmailOutputSchema = z.object({
emailId: NonBlankString.or(z.null()).describe('The id of a successfully sent email').title('Email ID'),
})