File

apps/recallassess/recallassess-api/src/api/client/contact-support/dto/inbound-email-webhook.dto.ts

Description

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.

Index

Properties

Properties

fromEmail
Type : string
Decorators :
@Expose()
@IsEmail()
@MaxLength(255)
@Transform( => )
Optional fromName
Type : string
Decorators :
@Expose()
@IsString()
@IsOptional()
@MaxLength(120)
@Transform( => )
Optional isAutoSubmitted
Type : boolean
Decorators :
@Expose()
@IsBoolean()
@IsOptional()
message
Type : string
Decorators :
@Expose()
@IsString()
@IsNotEmpty()
@MaxLength(50000)
@Transform( => )
Optional messageIdHeader
Type : string
Decorators :
@Expose()
@IsString()
@IsOptional()
@MaxLength(500)
Optional receivedAt
Type : string
Decorators :
@Expose()
@IsISO8601()
@IsOptional()
Optional subject
Type : string
Decorators :
@Expose()
@IsString()
@IsOptional()
@MaxLength(500)
@Transform( => )
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;
}

results matching ""

    No results matching ""