Skip to content
Download Beeper

Send a message

messages.send(strchat_id, MessageSendParams**kwargs) -> MessageSendResponse
POST/v1/chats/{chatID}/messages

Send a text message to a specific chat. Supports replying to existing messages. Returns a pending message ID.

ParametersExpand Collapse
chat_id: str

Chat ID. Input routes also accept the local chat ID from this installation when available.

attachment: Optional[Attachment]

Single attachment to send with the message

upload_id: str

Upload ID from uploadAsset endpoint. Required to reference uploaded files.

duration: Optional[float]

Duration in seconds (optional override of cached value)

file_name: Optional[str]

Filename (optional override of cached value)

mime_type: Optional[str]

MIME type (optional override of cached value)

size: Optional[AttachmentSize]

Dimensions (optional override of cached value)

height: float
width: float
type: Optional[Literal["image", "video", "audio", 4 more]]

Attachment type hint (image, video, audio, file, gif, voice-note, sticker). If omitted, auto-detected from mimeType

One of the following:
"image"
"video"
"audio"
"file"
"gif"
"voice-note"
"sticker"
reply_to_message_id: Optional[str]

Provide a message ID to send this as a reply to an existing message

text: Optional[str]

Draft text. Plain text and Markdown are converted to Beeper rich text with the same rules used by send and edit.

ReturnsExpand Collapse
class MessageSendResponse:
chat_id: str

Chat ID. Input routes also accept the local chat ID from this installation when available.

pending_message_id: str

Pending ID assigned to the message before the network confirms the send. Pass it to GET /v1/chats/{chatID}/messages/{messageID} to resolve, or wait for the matching message.upserted over the WebSocket.

Send a message

import os
from beeper_desktop_api import BeeperDesktop

client = BeeperDesktop(
    access_token=os.environ.get("BEEPER_ACCESS_TOKEN"),  # This is the default and can be omitted
)
response = client.messages.send(
    chat_id="!NCdzlIaMjZUmvmvyHU:beeper.com",
)
print(response.pending_message_id)
{
  "chatID": "!whatsapp_15550101002:ba_EvYDBBsZbRQAy3UOSWqG0LuTVkc.local-whatsapp.localhost",
  "pendingMessageID": "m1694783291234567"
}
Returns Examples
{
  "chatID": "!whatsapp_15550101002:ba_EvYDBBsZbRQAy3UOSWqG0LuTVkc.local-whatsapp.localhost",
  "pendingMessageID": "m1694783291234567"
}