Class: abstract
MessageEvent
Represents the message event for webhook events.
Implements
Extends
Extended by
MediaMessageEvent
ContactMessageEvent
InteractionEvent
AdInteractionEvent
LocationMessageEvent
OrderMessageEvent
ProductInquiryEvent
ReactionEvent
TextMessageEvent
Implements
Constructors
new MessageEvent()
new MessageEvent(Creates a new instance of the MessageEvent class.params
):MessageEvent
Parameters
• params The parameters for creating the MessageEvent. • params.client:Client
The client instance.
• params.from: string
The sender’s phone number.
• params.id: string
The message ID.
• params.isForwarded: boolean
Indicates if the message is forwarded.
• params.timestamp: string
The timestamp of the message.
Returns
MessageEvent
Overrides
BaseEvent
.constructor
Memberof
MessageEventSource
packages/wapi.js/src/webhook/events/base/index.ts:52Properties
client
client: Client
The client instance associated with the event.
Implementation of
MessageEventInterface
.client
Inherited from
BaseEvent
.client
Source
packages/wapi.js/src/webhook/events/base/index.ts:20context
context: MessageContext
The context of the message.
Implementation of
MessageEventInterface
.context
Source
packages/wapi.js/src/webhook/events/base/index.ts:37isForwarded
isForwarded: boolean
Source
packages/wapi.js/src/webhook/events/base/index.ts:39messageId
messageId: string
The ID of the message.
Implementation of
MessageEventInterface
.messageId
Source
packages/wapi.js/src/webhook/events/base/index.ts:36timestamp
timestamp: number
The timestamp of the message.
Implementation of
MessageEventInterface
.timestamp
Source
packages/wapi.js/src/webhook/events/base/index.ts:38Methods
react()
react(Reacts to the message with an emoji.params
):Promise
<object
|object
>
Parameters
• params The parameters for the reaction. • params.emoji:string
The emoji to react with.
• params.phoneNumber: string
The phone number of the sender.
Returns
Promise
<object
| object
>
- A promise that resolves with the reaction response.
Source
packages/wapi.js/src/webhook/events/base/index.ts:100read()
read():Marks the message as read.Promise
<object
|object
|object
|object
|object
>
Returns
Promise
<object
| object
| object
| object
| object
>
- A promise that resolves with the read response.
Memberof
MessageEventSource
packages/wapi.js/src/webhook/events/base/index.ts:121reply()
reply<Sends a reply to the message.T
>(props
):Promise
<object
|object
>
Type parameters
• T extendsBaseMessage
<string
>
Parameters
• props The properties for the reply. • props.message:T
The message to send as a reply.
Returns
Promise
<object
| object
>
- A promise that resolves when the reply is sent.
Throws
- If the context message ID is not found.