Hi, first of all thanks for this project — it's been really useful!
While integrating the group management endpoints I ran into the following issue.
Description:
Trying to remove a participant from a group always returns a 400 Bad Request:
curl -X DELETE \
'http://localhost:2785/api/sessions/<sessionId>/groups/<groupId>/participants' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: <key>' \
-d '{"participants": ["<participantId>@c.us"]}'
{
"message": ["property participants should not exist"],
"error": "Bad Request",
"statusCode": 400
}
Root cause:
The global ValidationPipe is configured with forbidNonWhitelisted: true, but the DTOs in group.controller.ts have no class-validator decorators. With whitelist: true active, NestJS strips every undecorated property before it reaches the handler, so dto.participants arrives as undefined and causes a secondary crash in the adapter:
TypeError: Cannot read properties of undefined (reading 'map')
at WhatsAppWebJsAdapter.removeParticipants
Note: commenting out forbidNonWhitelisted: true alone is not enough — whitelist: true still strips the properties. This likely affects all endpoints that receive a body across all modules.
Fix:
Add class-validator decorators to all DTOs. Example for ParticipantsDto:
import { IsArray, IsString } from 'class-validator';
class ParticipantsDto {
@IsArray()
@IsString({ each: true })
participants: string[];
}
class-validator and class-transformer are already in the project dependencies so no new packages are needed. Happy to open a PR if you'd like.
Hi, first of all thanks for this project — it's been really useful!
While integrating the group management endpoints I ran into the following issue.
Description:
Trying to remove a participant from a group always returns a
400 Bad Request:{ "message": ["property participants should not exist"], "error": "Bad Request", "statusCode": 400 }Root cause:
The global
ValidationPipeis configured withforbidNonWhitelisted: true, but the DTOs ingroup.controller.tshave noclass-validatordecorators. Withwhitelist: trueactive, NestJS strips every undecorated property before it reaches the handler, sodto.participantsarrives asundefinedand causes a secondary crash in the adapter:Note: commenting out
forbidNonWhitelisted: truealone is not enough —whitelist: truestill strips the properties. This likely affects all endpoints that receive a body across all modules.Fix:
Add
class-validatordecorators to all DTOs. Example forParticipantsDto:class-validatorandclass-transformerare already in the project dependencies so no new packages are needed. Happy to open a PR if you'd like.