Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
/**
* Response shapes for the status routes. These describe what the handlers already return — the
* payload is the raw handler value, not an envelope.
*
* Decorated properties avoid named utility types: emitDecoratorMetadata wraps a named type in a
* runtime guard whose other arm can never execute, leaving an uncoverable branch.
*/
export class StatusContactDto {
@ApiProperty({ description: 'Poster id.', example: '[email protected]' })
id!: string;
@ApiPropertyOptional({ description: "Name from the account's addressbook, when saved." })
name?: string;
@ApiPropertyOptional({ description: 'Name the poster set for themselves.', example: 'Ada' })
pushName?: string;
}
export class StatusDto {
@ApiProperty({ description: 'Status id.', example: 'ABCD1234' })
id!: string;
@ApiProperty({ type: StatusContactDto, description: 'Who posted it.' })
contact!: StatusContactDto;
@ApiProperty({
enum: ['text', 'image', 'video', 'voice'],
description:
'`voice` is an audio status posted as a voice note. Before voice posting existed, such a ' +
'status read back as `text`, because anything that was not an image or a video collapsed to it.',
example: 'image',
})
type!: string;
@ApiPropertyOptional({ description: 'Text of a text status, or the caption of an image or video status.' })
caption?: string;
@ApiPropertyOptional({
description:
'Same-origin path to GET /sessions/{sessionId}/status/{statusId}/media, which needs X-API-Key like ' +
'any other route. Present only when the stored status kept its media.',
example: '/api/sessions/0a941dac-a965-45e7-b318-74ae8be134f0/status/ABCD1234/media',
})
mediaUrl?: string;
@ApiPropertyOptional({ description: 'Background colour of a text or voice status.', example: '#0a5c36' })
backgroundColor?: string;
@ApiPropertyOptional({ description: 'Font index of a text or voice status.', example: 2 })
font?: number;
@ApiProperty({ description: 'ISO-8601 timestamp the status was posted.', example: '2026-08-07T12:00:00.000Z' })
timestamp!: string;
@ApiProperty({ description: 'ISO-8601 timestamp the status expires.', example: '2026-08-08T12:00:00.000Z' })
expiresAt!: string;
}
export class StatusListResponseDto {
@ApiProperty({ type: [StatusDto], description: 'Statuses, newest first.' })
statuses!: StatusDto[];
}
export class StatusResultDto {
@ApiProperty({ description: 'Id of the status that was posted.', example: 'ABCD1234' })
statusId!: string;
@ApiProperty({ description: 'ISO-8601 timestamp the engine stamped on it.', example: '2026-08-07T12:00:00.000Z' })
timestamp!: string;
@ApiProperty({ description: 'ISO-8601 timestamp it expires — 24 hours later.', example: '2026-08-08T12:00:00.000Z' })
expiresAt!: string;
}
export class StatusDeletedResponseDto {
@ApiProperty({ example: 'Status deleted successfully' })
message!: string;
}