ContactMessage
Wapi.js Docs / ContactMessage
Class: ContactMessage
Represents a contact message.
Implements
Extends
BaseMessage
<"contacts"
>
Implements
Constructors
new ContactMessage()
new ContactMessage(
params
):ContactMessage
Creates a new ContactMessage instance.
Parameters
• params
The parameters for creating a ContactMessage instance.
• params.contacts: Contact
[]
The contacts in the message.
Returns
Overrides
BaseMessage<"contacts">.constructor
Source
packages/wapi.js/src/structures/contact/index.ts:145
Properties
contacts
contacts:
Contact
[]
An array of contacts associated with the message.
Implementation of
ContactMessageInterface
.contacts
Source
packages/wapi.js/src/structures/contact/index.ts:137
messaging_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:17
recipient_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:18
type
type:
MessageTypeEnum
The type of the message.
Implementation of
Inherited from
BaseMessage.type
Source
packages/wapi.js/src/structures/message/index.ts:16
Methods
addContact()
addContact(
contact
):void
Adds a contact to the message.
Parameters
• contact: Contact
The contact to add to the message.
Returns
void
Function
Memberof
ContactMessage
Source
packages/wapi.js/src/structures/contact/index.ts:156
parseConstructorPayload()
protected
parseConstructorPayload(schema
,payload
):any
Parses the constructor payload using the provided schema.
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:42
toJson()
toJson(
params
):object
Converts the ContactMessage instance to a JSON 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
Function
Memberof
ContactMessage
Source
Was this page helpful?