Class: ContactMessage
Represents a contact message.Implements
Extends
BaseMessage
<"contacts"
>
Implements
Constructors
new ContactMessage()
new ContactMessage(Creates a new ContactMessage instance.params
):ContactMessage
Parameters
• params The parameters for creating a ContactMessage instance. • params.contacts:Contact
[]
The contacts in the message.
Returns
ContactMessage
Overrides
BaseMessage<"contacts">.constructor
Source
packages/wapi.js/src/structures/contact/index.ts:145Properties
contacts
contacts: Contact
[]
An array of contacts associated with the message.
Implementation of
ContactMessageInterface
.contacts
Source
packages/wapi.js/src/structures/contact/index.ts:137messaging_product
messaging_product: "whatsapp"
The messaging product.
Implementation of
ContactMessageInterface
.messaging_product
Inherited from
BaseMessage.messaging_product
Source
packages/wapi.js/src/structures/message/index.ts:17recipient_type
recipient_type: "individual"
The recipient type.
Implementation of
ContactMessageInterface
.recipient_type
Inherited from
BaseMessage.recipient_type
Source
packages/wapi.js/src/structures/message/index.ts:18type
type: MessageTypeEnum
The type of the message.
Implementation of
ContactMessageInterface
.type
Inherited from
BaseMessage.type
Source
packages/wapi.js/src/structures/message/index.ts:16Methods
addContact()
addContact(Adds a contact to the message.contact
):void
Parameters
• contact:Contact
The contact to add to the message.
Returns
void
Function
Memberof
ContactMessageSource
packages/wapi.js/src/structures/contact/index.ts:156parseConstructorPayload()
Parses the constructor payload using the provided schema.protected
parseConstructorPayload(schema
,payload
):any
Parameters
• schema:ZodType
<any
, ZodTypeDef
, any
>
The Zod schema used for parsing the payload.
• payload: any
The payload to be parsed.
Returns
any
The parsed data.
Inherited from
BaseMessage.parseConstructorPayload
Throws
An error if the parsing fails.Source
packages/wapi.js/src/structures/message/index.ts:42toJson()
toJson(Converts the ContactMessage instance to a JSON object.params
):object
Parameters
• params The parameters for converting the ContactMessage instance to JSON. • params.replyToMessageId?:string
The ID of the message to reply to.
• params.to: string
The recipient of the message.
Returns
object
- The JSON representation of the ContactMessage instance.
biz_opaque_callback_data?
optional
biz_opaque_callback_data:string
contacts
contacts: object
[]
context?
optional
context:object
context.message_id
message_id: string
messaging_product
messaging_product: "whatsapp"
recipient_type
recipient_type: "individual"
to
to: string
type
type: Contacts
Overrides
BaseMessage.toJson