Skip to content

fix(message): allow bulk message media content properties#159

Open
WT-March wants to merge 1 commit into
rmyndharis:mainfrom
WT-March:fix/bulk-message-content-validation
Open

fix(message): allow bulk message media content properties#159
WT-March wants to merge 1 commit into
rmyndharis:mainfrom
WT-March:fix/bulk-message-content-validation

Conversation

@WT-March
Copy link
Copy Markdown

Problem

Every POST /sessions/:id/messages/send-bulk request was rejected with:

messages.0.content.property image should not exist
messages.0.content.property video should not exist
messages.0.content.property audio should not exist
messages.0.content.property document should not exist

even for plain text batches that never included any media key.

Cause

BulkMessageContentDto declares image / video / audio / document with only @ApiPropertyOptional() and no class-validator decorator. The global ValidationPipe runs with forbidNonWhitelisted: true, so class-validator treats those undecorated fields as non-whitelisted and rejects the nested content object.

Fix

Add @IsOptional() to the four media properties so they become whitelisted optional fields. Text and media bulk sends now validate correctly.

Test

Verified locally against a connected session: text bulk batch returns status=completed, sent=1, failed=0 and the message is delivered.

?? Generated with Claude Code

BulkMessageContentDto declared image/video/audio/document without any class-validator decorator. With the global ValidationPipe set to forbidNonWhitelisted, these undecorated properties were treated as non-whitelisted, so every send-bulk request was rejected with "property image should not exist" — even plain text batches that never included a media key.

Add @IsOptional() to image/video/audio/document so they are whitelisted optional properties. Text and media bulk sends now validate correctly.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant