BaseMessage
<"text"
>new TextMessage(Creates a new instance of the TextMessage class.params
):TextMessage
true
Whether to allow preview of the message.
• params.text: string
The text content of the message.
TextMessage
BaseMessage<"text">.constructor
The data property of the text message.readonly
data:object
optional
allowPreview:true
text: string
TextMessageInterface
.data
messaging_product: "whatsapp"
The messaging product.
TextMessageInterface
.messaging_product
BaseMessage.messaging_product
recipient_type: "individual"
The recipient type.
TextMessageInterface
.recipient_type
BaseMessage.recipient_type
type: MessageTypeEnum
The type of the message.
TextMessageInterface
.type
BaseMessage.type
Parses the constructor payload using the provided schema.protected
parseConstructorPayload(schema
,payload
):any
ZodType
<any
, ZodTypeDef
, any
>
The Zod schema used for parsing the payload.
• payload: any
The payload to be parsed.
any
The parsed data.
BaseMessage.parseConstructorPayload
toJson(Converts the text message to a WhatsApp Cloud API payload.params
):object
string
The ID of the message to reply to.
• params.to: string
The recipient of the message.
object
The WhatsApp Cloud API payload for the text message.
optional
biz_opaque_callback_data:string
optional
context:object
message_id: string
messaging_product: "whatsapp"
preview_url: boolean
recipient_type: "individual"
text: object
body: string
optional
preview_url:boolean
to: string
type: Text
TextMessageInterface
.toJson
BaseMessage.toJson