LocationMessage
Wapi.js Docs / LocationMessage
Class: LocationMessage
Represents a location message.
Implements
Extends
BaseMessage
<"location"
>
Implements
Constructors
new LocationMessage()
new LocationMessage(
params
):LocationMessage
Creates a new LocationMessage instance.
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
Overrides
BaseMessage<"location">.constructor
Memberof
LocationMessage
Source
packages/wapi.js/src/structures/location/index.ts:31
Properties
data
data:
object
address?
optional
address:string
latitude
latitude:
number
longitude
longitude:
number
name?
optional
name:string
Implementation of
Source
packages/wapi.js/src/structures/location/index.ts:18
messaging_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:17
recipient_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: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
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 LocationMessage to a JSON object that can be sent as a request payload to the WhatsApp Cloud API.
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?
optional
biz_opaque_callback_data:string
context?
optional
context:object
context.message_id
message_id:
string
location
location:
object
=LocationDataPayloadSchemaType
location.address?
optional
address:string
location.latitude
latitude:
number
location.longitude
longitude:
number
location.name?
optional
name:string
messaging_product
messaging_product:
"whatsapp"
recipient_type
recipient_type:
"individual"
to
to:
string
type
type:
Location
Overrides
BaseMessage.toJson
Source
Was this page helpful?