Skip to main content

Message

The Message interface represents a scheduled message in the system. It contains all the information needed to send a message to a recipient at a specific time.

Type Definition

export interface Message {
  id: string;
  content: string;
  sendToPhone: string;
  sendAfter: number;
  sendTo: {
    name: string;
  };
  createdAt: Date;
}

Properties

id
string
required
Unique identifier for the message.
content
string
required
The message content/body to be sent. Must not be empty.
sendToPhone
string
required
The recipient’s phone number in Bangladesh format.
sendAfter
number
required
Number of days to wait before sending the message. Minimum value is 1.
This represents days, not hours or minutes. A value of 7 means the message will be sent 7 days after creation.
sendTo
object
required
Information about the recipient.
createdAt
Date
required
Timestamp when the message was created in the system.

Usage

This type is used throughout the application: In Components:
  • Messages.tsx:55 - Mapping over messages array
  • Messages.tsx:77 - Message component props
In API Responses:
  • Returned from GET /messages/all endpoint
  • Used in message creation and update operations
Example Usage:
import { Message } from '@/components/Messages';

function MessageCard({ message }: { message: Message }) {
  return (
    <div>
      <h3>{message.content}</h3>
      <p>To: {message.sendTo.name} ({message.sendToPhone})</p>
      <p>Send after: {message.sendAfter} days</p>
    </div>
  );
}

Build docs developers (and LLMs) love