Skip to content
Download Beeper

Send a message

client.Messages.Send(ctx, chatID, body) (*MessageSendResponse, error)
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
chatID string

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

body MessageSendParams
Attachment param.Field[MessageSendParamsAttachment]Optional

Single attachment to send with the message

UploadID string

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

Duration float64Optional

Duration in seconds (optional override of cached value)

FileName stringOptional

Filename (optional override of cached value)

MimeType stringOptional

MIME type (optional override of cached value)

Size MessageSendParamsAttachmentSizeOptional

Dimensions (optional override of cached value)

Height float64
Width float64
Type stringOptional

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

One of the following:
const MessageSendParamsAttachmentTypeImage MessageSendParamsAttachmentType = "image"
const MessageSendParamsAttachmentTypeVideo MessageSendParamsAttachmentType = "video"
const MessageSendParamsAttachmentTypeAudio MessageSendParamsAttachmentType = "audio"
const MessageSendParamsAttachmentTypeFile MessageSendParamsAttachmentType = "file"
const MessageSendParamsAttachmentTypeGif MessageSendParamsAttachmentType = "gif"
const MessageSendParamsAttachmentTypeVoiceNote MessageSendParamsAttachmentType = "voice-note"
const MessageSendParamsAttachmentTypeSticker MessageSendParamsAttachmentType = "sticker"
ReplyToMessageID param.Field[string]Optional

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

Text param.Field[string]Optional

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

ReturnsExpand Collapse
type MessageSendResponse struct{…}
ChatID string

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

PendingMessageID string

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

package main

import (
  "context"
  "fmt"

  "github.com/beeper/desktop-api-go"
  "github.com/beeper/desktop-api-go/option"
)

func main() {
  client := beeperdesktopapi.NewClient(
    option.WithAccessToken("My Access Token"),
  )
  response, err := client.Messages.Send(
    context.TODO(),
    "!NCdzlIaMjZUmvmvyHU:beeper.com",
    beeperdesktopapi.MessageSendParams{

    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.PendingMessageID)
}
{
  "chatID": "!whatsapp_15550101002:ba_EvYDBBsZbRQAy3UOSWqG0LuTVkc.local-whatsapp.localhost",
  "pendingMessageID": "m1694783291234567"
}
Returns Examples
{
  "chatID": "!whatsapp_15550101002:ba_EvYDBBsZbRQAy3UOSWqG0LuTVkc.local-whatsapp.localhost",
  "pendingMessageID": "m1694783291234567"
}