apps/recallassess/recallassess-api/src/api/client/contact-support/dto/inbound-email-webhook.dto.ts
InboundEmailWebhookDto
Shape posted by the AWS SES inbound-email Lambda after it parses an incoming RFC 822 message. We deliberately keep the payload small and well-typed so the Lambda has minimal logic to maintain — header extraction + a couple of body cleanups, then POST.
Required fields:
Optional fields:
Properties |
|
| fromEmail |
Type : string
|
Decorators :
@Expose()
|
| Optional fromName |
Type : string
|
Decorators :
@Expose()
|
| Optional isAutoSubmitted |
Type : boolean
|
Decorators :
@Expose()
|
| message |
Type : string
|
Decorators :
@Expose()
|
| Optional messageIdHeader |
Type : string
|
Decorators :
@Expose()
|
| Optional receivedAt |
Type : string
|
Decorators :
@Expose()
|
| Optional subject |
Type : string
|
Decorators :
@Expose()
|
import { Exclude, Expose, Transform } from "class-transformer";
import {
IsBoolean,
IsEmail,
IsISO8601,
IsNotEmpty,
IsOptional,
IsString,
MaxLength,
} from "class-validator";
/**
* InboundEmailWebhookDto
*
* Shape posted by the AWS SES inbound-email Lambda after it parses an incoming
* RFC 822 message. We deliberately keep the payload small and well-typed so the
* Lambda has minimal logic to maintain — header extraction + a couple of body
* cleanups, then POST.
*
* Required fields:
* - fromEmail the sender's email address (parsed from the From: header)
* - message the email body text (HTML stripped + reply-quote chains trimmed)
*
* Optional fields:
* - fromName the sender's display name (parsed from the From: header).
* If omitted, the API derives a fallback from the local-part of fromEmail.
* - subject the email's Subject: header.
* - receivedAt RFC 3339 timestamp from the Date: header. Falls back to API receipt time.
* - isAutoSubmitted set by the Lambda when the email contained
* Auto-Submitted: auto-replied (or similar). Tells us to skip the
* visitor acknowledgement to avoid auto-reply ping-pong loops.
* - messageIdHeader the Message-ID: header value. Currently not stored but
* reserved for future thread-tracking features.
*/
@Exclude()
export class InboundEmailWebhookDto {
@Expose()
@IsEmail()
@MaxLength(255)
@Transform(({ value }) => (typeof value === "string" ? value.trim().toLowerCase() : value))
fromEmail!: string;
@Expose()
@IsString()
@IsOptional()
@MaxLength(120)
@Transform(({ value }) => (typeof value === "string" ? value.trim() : value))
fromName?: string;
@Expose()
@IsString()
@IsOptional()
@MaxLength(500)
@Transform(({ value }) => (typeof value === "string" ? value.trim() : value))
subject?: string;
@Expose()
@IsString()
@IsNotEmpty()
@MaxLength(50000)
@Transform(({ value }) => (typeof value === "string" ? value.trim() : value))
message!: string;
@Expose()
@IsISO8601()
@IsOptional()
receivedAt?: string;
@Expose()
@IsBoolean()
@IsOptional()
isAutoSubmitted?: boolean;
@Expose()
@IsString()
@IsOptional()
@MaxLength(500)
messageIdHeader?: string;
}