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

# ContactMessage

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

# Class: ContactMessage

Represents a contact message.

## Implements

## Extends

* `BaseMessage`\<`"contacts"`>

## Implements

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

## Constructors

### new ContactMessage()

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

Creates a new ContactMessage instance.

#### Parameters

• **params**

The parameters for creating a ContactMessage instance.

• **params.contacts**: [`Contact`](Contact.mdx)\[]

The contacts in the message.

#### Returns

[`ContactMessage`](ContactMessage.mdx)

#### Overrides

`BaseMessage<"contacts">.constructor`

#### Source

[packages/wapi.js/src/structures/contact/index.ts:145](https://github.com/sarthakjdev/wapi.js/blob/1b066ed4efaf997a4bb012da51514dfcb4165da6/packages/wapi.js/src/structures/contact/index.ts#L145)

## Properties

### contacts

> **contacts**: [`Contact`](Contact.mdx)\[]

An array of contacts associated with the message.

#### Implementation of

[`ContactMessageInterface`](../interfaces/ContactMessageInterface.mdx).[`contacts`](../interfaces/ContactMessageInterface.mdx#contacts)

#### Source

[packages/wapi.js/src/structures/contact/index.ts:137](https://github.com/sarthakjdev/wapi.js/blob/1b066ed4efaf997a4bb012da51514dfcb4165da6/packages/wapi.js/src/structures/contact/index.ts#L137)

***

### messaging\_product

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

The messaging product.

#### Implementation of

[`ContactMessageInterface`](../interfaces/ContactMessageInterface.mdx).[`messaging_product`](../interfaces/ContactMessageInterface.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

[`ContactMessageInterface`](../interfaces/ContactMessageInterface.mdx).[`recipient_type`](../interfaces/ContactMessageInterface.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

[`ContactMessageInterface`](../interfaces/ContactMessageInterface.mdx).[`type`](../interfaces/ContactMessageInterface.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

### addContact()

> **addContact**(`contact`): `void`

Adds a contact to the message.

#### Parameters

• **contact**: [`Contact`](Contact.mdx)

The contact to add to the message.

#### Returns

`void`

#### Function

#### Memberof

ContactMessage

#### Source

[packages/wapi.js/src/structures/contact/index.ts:156](https://github.com/sarthakjdev/wapi.js/blob/1b066ed4efaf997a4bb012da51514dfcb4165da6/packages/wapi.js/src/structures/contact/index.ts#L156)

***

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

[packages/wapi.js/src/structures/contact/index.ts:169](https://github.com/sarthakjdev/wapi.js/blob/1b066ed4efaf997a4bb012da51514dfcb4165da6/packages/wapi.js/src/structures/contact/index.ts#L169)
