ImageMessage
Wapi.js Docs / ImageMessage
Class: ImageMessage
Represents an image message.
Implements
Extends
BaseMessage
<MessageTypeEnum.Image
>
Implements
Constructors
new ImageMessage()
new ImageMessage(
params
):ImageMessage
Creates a new instance of the ImageMessage class.
Parameters
• params: object
| object
The parameters to initialize the image message.
Returns
Overrides
BaseMessage<MessageTypeEnum.Image>.constructor
Memberof
ImageMessage
Source
packages/wapi.js/src/structures/media/index.ts:174
Properties
data
data:
object
|object
Implementation of
Source
packages/wapi.js/src/structures/media/index.ts:164
messaging_product
messaging_product:
"whatsapp"
The messaging product.
Implementation of
ImageMessageInterface
.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
ImageMessageInterface
.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 image message to the WhatsApp Cloud API payload.
Parameters
• params
The parameters for the WhatsApp Cloud API payload.
• params.replyToMessageId?: string
The ID of the message being replied to.
• params.to: string
The recipient of the message.
Returns
object
- The WhatsApp Cloud API payload for the image message.
biz_opaque_callback_data?
optional
biz_opaque_callback_data:string
context?
optional
context:object
context.message_id
message_id:
string
image
image:
object
|object
messaging_product
messaging_product:
"whatsapp"
recipient_type
recipient_type:
"individual"
to
to:
string
type
type:
Image
Overrides
BaseMessage.toJson
Memberof
ImageMessage
Source
Was this page helpful?