> ## Documentation Index
> Fetch the complete documentation index at: https://javascript.wapikit.com/llms.txt
> Use this file to discover all available pages before exploring further.

# LocationMessage

[Wapi.js Docs](../README.mdx) / LocationMessage

# Class: LocationMessage

Represents a location message.

## Implements

## Extends

* `BaseMessage`\<`"location"`>

## Implements

* [`LocationMessageInterface`](../interfaces/LocationMessageInterface.mdx)

## Constructors

### new LocationMessage()

> **new LocationMessage**(`params`): [`LocationMessage`](LocationMessage.mdx)

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

[`LocationMessage`](LocationMessage.mdx)

#### Overrides

`BaseMessage<"location">.constructor`

#### Memberof

LocationMessage

#### Source

[packages/wapi.js/src/structures/location/index.ts:31](https://github.com/sarthakjdev/wapi.js/blob/1b066ed4efaf997a4bb012da51514dfcb4165da6/packages/wapi.js/src/structures/location/index.ts#L31)

## Properties

### data

> **data**: `object`

#### address?

> `optional` **address**: `string`

#### latitude

> **latitude**: `number`

#### longitude

> **longitude**: `number`

#### name?

> `optional` **name**: `string`

#### Implementation of

[`LocationMessageInterface`](../interfaces/LocationMessageInterface.mdx).[`data`](../interfaces/LocationMessageInterface.mdx#data)

#### Source

[packages/wapi.js/src/structures/location/index.ts:18](https://github.com/sarthakjdev/wapi.js/blob/1b066ed4efaf997a4bb012da51514dfcb4165da6/packages/wapi.js/src/structures/location/index.ts#L18)

***

### messaging\_product

> **messaging\_product**: `"whatsapp"`

The messaging product.

#### Implementation of

[`LocationMessageInterface`](../interfaces/LocationMessageInterface.mdx).[`messaging_product`](../interfaces/LocationMessageInterface.mdx#messaging_product)

#### Inherited from

`BaseMessage.messaging_product`

#### Source

[packages/wapi.js/src/structures/message/index.ts:17](https://github.com/sarthakjdev/wapi.js/blob/1b066ed4efaf997a4bb012da51514dfcb4165da6/packages/wapi.js/src/structures/message/index.ts#L17)

***

### recipient\_type

> **recipient\_type**: `"individual"`

The recipient type.

#### Implementation of

[`LocationMessageInterface`](../interfaces/LocationMessageInterface.mdx).[`recipient_type`](../interfaces/LocationMessageInterface.mdx#recipient_type)

#### Inherited from

`BaseMessage.recipient_type`

#### Source

[packages/wapi.js/src/structures/message/index.ts:18](https://github.com/sarthakjdev/wapi.js/blob/1b066ed4efaf997a4bb012da51514dfcb4165da6/packages/wapi.js/src/structures/message/index.ts#L18)

***

### type

> **type**: `MessageTypeEnum`

The type of the message.

#### Implementation of

[`LocationMessageInterface`](../interfaces/LocationMessageInterface.mdx).[`type`](../interfaces/LocationMessageInterface.mdx#type)

#### Inherited from

`BaseMessage.type`

#### Source

[packages/wapi.js/src/structures/message/index.ts:16](https://github.com/sarthakjdev/wapi.js/blob/1b066ed4efaf997a4bb012da51514dfcb4165da6/packages/wapi.js/src/structures/message/index.ts#L16)

## 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](https://github.com/sarthakjdev/wapi.js/blob/1b066ed4efaf997a4bb012da51514dfcb4165da6/packages/wapi.js/src/structures/message/index.ts#L42)

***

### 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

[packages/wapi.js/src/structures/location/index.ts:48](https://github.com/sarthakjdev/wapi.js/blob/1b066ed4efaf997a4bb012da51514dfcb4165da6/packages/wapi.js/src/structures/location/index.ts#L48)
