Class: LocationMessage
Represents a location message.Implements
Extends
BaseMessage<"location">
Implements
Constructors
new LocationMessage()
new LocationMessage(Creates a new LocationMessage instance.params):LocationMessage
Parameters
• params The parameters for creating the LocationMessage. • params.address?:string= undefined
• params.latitude: number= undefined
• params.longitude: number= undefined
• params.name?: string= undefined
Returns
LocationMessage
Overrides
BaseMessage<"location">.constructor
Memberof
LocationMessageSource
packages/wapi.js/src/structures/location/index.ts:31Properties
data
data: object
address?
optionaladdress:string
latitude
latitude: number
longitude
longitude: number
name?
optionalname:string
Implementation of
LocationMessageInterface.data
Source
packages/wapi.js/src/structures/location/index.ts:18messaging_product
messaging_product: "whatsapp"
The messaging product.
Implementation of
LocationMessageInterface.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
LocationMessageInterface.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
LocationMessageInterface.type
Inherited from
BaseMessage.type
Source
packages/wapi.js/src/structures/message/index.ts:16Methods
parseConstructorPayload()
Parses the constructor payload using the provided schema.protectedparseConstructorPayload(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 LocationMessage to a JSON object that can be sent as a request payload to the WhatsApp Cloud API.params):object
Parameters
• params The parameters for converting the LocationMessage to JSON. • params.replyToMessageId?:string
The ID of the message being replied to.
• params.to: string
The recipient of the message.
Returns
object
- The JSON representation of the LocationMessage.
biz_opaque_callback_data?
optionalbiz_opaque_callback_data:string
context?
optionalcontext:object
context.message_id
message_id: string
location
location:object=LocationDataPayloadSchemaType
location.address?
optionaladdress:string
location.latitude
latitude: number
location.longitude
longitude: number
location.name?
optionalname:string
messaging_product
messaging_product: "whatsapp"
recipient_type
recipient_type: "individual"
to
to: string
type
type: Location
Overrides
BaseMessage.toJson