Skip to content
Filippo Romani edited this page Apr 15, 2023 · 2 revisions

You can use the Message object to easily interact with messages. For example, you can reply to a message using the reply method.

message = Message(instance=yourclient, id="MESSAGEID") # this is your message instance
message.reply("Hello world!")

API Reference

Message

Message()

You can also create a message object using the WhatsApp class. This method doesn't require to pass the instance parameter.

message = yourclient.create_message(args) # args are described below

Create a new message object.

Parameters

Message.reply(content)

Reply to a message. Required Message() initialization parameters:

  • instance
  • id

Message.send()

Send a message. Required Message() initialization parameters:

  • instance
  • to
  • content

Message.mark_as_read()

Mark a message as read. Required Message() initialization parameters:

  • instance
  • id

Properties

  • Message().image str - The image URL of the message.
  • Message().video str - The video URL of the message.
  • Message().audio str - The audio URL of the message.
  • Message().document str - The document URL of the message.
  • Message().location str - The location of the message.
  • Message().interactive str - The interactive reply of the message.

Each of these properties will return None if the message does not contain the specified content.