api

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2026 License: MIT Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package api defines the wire protocol shared by the CLI, the daemon and the MCP server.

Index

Constants

View Source
const (
	CodeInternal             = "internal"
	CodeUsage                = "usage"
	CodeNotLoggedIn          = "not_logged_in"
	CodeAlreadyLoggedIn      = "already_logged_in"
	CodeNotConnected         = "not_connected"
	CodeNotFound             = "not_found"
	CodeAmbiguous            = "ambiguous"
	CodeNotOnWhatsApp        = "not_on_whatsapp"
	CodePolicyDenied         = "policy_denied"
	CodeConfirmationRequired = "confirmation_required"
	CodeApprovalRequired     = "approval_required"
	CodeRateLimited          = "rate_limited"
	CodeTimeout              = "timeout"
	CodeDaemonUnavailable    = "daemon_unavailable"
	CodeWhatsApp             = "whatsapp_error"
	CodeUnsupported          = "unsupported"
)

Error codes. Each maps to a stable process exit code (see ExitCode).

Variables

This section is empty.

Functions

func ExitCode

func ExitCode(code string) int

ExitCode maps an error code to the process exit status documented in docs/agents.md.

Types

type AuditEntry

type AuditEntry struct {
	Time    string `json:"time"`
	Source  string `json:"source"`
	Profile string `json:"profile"`
	Method  string `json:"method"`
	Targets string `json:"targets,omitempty"`
	OK      bool   `json:"ok"`
	DryRun  bool   `json:"dry_run,omitempty"`
	Sends   int    `json:"sends,omitempty"`
	Error   string `json:"error,omitempty"`
}

type AvatarParams

type AvatarParams struct {
	User    string `json:"user" jsonschema:"Person or group"`
	Out     string `json:"out,omitempty" jsonschema:"Output file path"`
	Preview bool   `json:"preview,omitempty" jsonschema:"Small thumbnail instead of full size"`
}

type BlockParams

type BlockParams struct {
	User    string `json:"user" jsonschema:"Person to block"`
	Unblock bool   `json:"unblock,omitempty" jsonschema:"Unblock instead"`
}

type Call

type Call struct {
	ID     string `json:"id"`
	From   string `json:"from"`
	Name   string `json:"name,omitempty"`
	Group  string `json:"group,omitempty"`
	Media  string `json:"media,omitempty"`
	Time   string `json:"time"`
	Status string `json:"status"`
}

type CallRejectParams

type CallRejectParams struct {
	ID   string `json:"id" jsonschema:"Call ID"`
	From string `json:"from,omitempty" jsonschema:"Caller (optional if the call is in local history)"`
}

type Candidate

type Candidate struct {
	JID  string `json:"jid"`
	Name string `json:"name"`
	Kind string `json:"kind"`
}

type Channel

type Channel struct {
	JID         string `json:"jid"`
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	Subscribers int    `json:"subscribers"`
	Verified    bool   `json:"verified"`
	Invite      string `json:"invite,omitempty"`
	Role        string `json:"role,omitempty"`
	Muted       bool   `json:"muted"`
}

type ChannelCreateParams

type ChannelCreateParams struct {
	Name        string `json:"name" jsonschema:"Channel name"`
	Description string `json:"description,omitempty" jsonschema:"Description"`
	Photo       string `json:"photo,omitempty" jsonschema:"Path to a JPEG picture"`
}

type ChannelFollowParams

type ChannelFollowParams struct {
	Channel  string `json:"channel" jsonschema:"Channel JID, name or invite link"`
	Unfollow bool   `json:"unfollow,omitempty" jsonschema:"Unfollow instead"`
}

type ChannelMessage

type ChannelMessage struct {
	ServerID  int            `json:"server_id"`
	ID        string         `json:"id"`
	Time      string         `json:"time"`
	Type      string         `json:"type"`
	Text      string         `json:"text,omitempty"`
	Views     int            `json:"views"`
	Reactions map[string]int `json:"reactions,omitempty"`
}

type ChannelMessagesParams

type ChannelMessagesParams struct {
	Channel string `json:"channel" jsonschema:"Channel"`
	Count   int    `json:"count,omitempty" jsonschema:"How many (default 20)"`
	Before  int    `json:"before,omitempty" jsonschema:"Server ID to page back from"`
}

type ChannelMuteParams

type ChannelMuteParams struct {
	Channel string `json:"channel" jsonschema:"Channel"`
	Unmute  bool   `json:"unmute,omitempty" jsonschema:"Unmute instead"`
}

type ChannelReactParams

type ChannelReactParams struct {
	Channel  string `json:"channel" jsonschema:"Channel"`
	ServerID int    `json:"server_id" jsonschema:"Message server ID (from channel messages)"`
	Emoji    string `json:"emoji,omitempty" jsonschema:"Emoji; empty removes"`
}

type ChannelRef

type ChannelRef struct {
	Channel string `json:"channel" jsonschema:"Channel JID, name or invite link (whatsapp.com/channel/...)"`
}

type Chat

type Chat struct {
	JID           string     `json:"jid"`
	Name          string     `json:"name"`
	Kind          string     `json:"kind"` // dm, group, channel, broadcast, status
	LastMessageAt *time.Time `json:"last_message_at,omitempty"`
	LastMessage   string     `json:"last_message,omitempty"`
	Unread        int        `json:"unread"`
	Archived      bool       `json:"archived,omitempty"`
	Pinned        bool       `json:"pinned,omitempty"`
	MutedUntil    *time.Time `json:"muted_until,omitempty"`
	Disappearing  string     `json:"disappearing,omitempty"`
}

type ChatRef

type ChatRef struct {
	Chat string `json:"chat" jsonschema:"Chat: name, phone or JID"`
}

type CheckParams

type CheckParams struct {
	Phones []string `json:"phones" jsonschema:"Phone numbers with country code"`
}

type CheckResult

type CheckResult struct {
	Query        string `json:"query"`
	OnWhatsApp   bool   `json:"on_whatsapp"`
	JID          string `json:"jid,omitempty"`
	BusinessName string `json:"business_name,omitempty"`
}

type CommunityLinkParams

type CommunityLinkParams struct {
	Community string `json:"community" jsonschema:"Community"`
	Group     string `json:"group" jsonschema:"Group to link or unlink"`
	Unlink    bool   `json:"unlink,omitempty" jsonschema:"Unlink instead of link"`
}

type Contact

type Contact struct {
	JID          string `json:"jid"`
	Phone        string `json:"phone,omitempty"`
	Name         string `json:"name"`
	FirstName    string `json:"first_name,omitempty"`
	PushName     string `json:"push_name,omitempty"`
	BusinessName string `json:"business_name,omitempty"`
}

type ContactInput

type ContactInput struct {
	Name  string `json:"name" jsonschema:"Display name on the card"`
	Phone string `json:"phone,omitempty" jsonschema:"Phone number with country code"`
	VCard string `json:"vcard,omitempty" jsonschema:"Raw vCard text; overrides name/phone"`
}

type DeleteParams

type DeleteParams struct {
	Chat      string `json:"chat,omitempty" jsonschema:"Chat of the message (optional)"`
	ID        string `json:"id" jsonschema:"Message ID"`
	LocalOnly bool   `json:"local_only,omitempty" jsonschema:"Only remove from the local store, nothing is sent"`
}

type DownloadParams

type DownloadParams struct {
	Chat string `json:"chat,omitempty" jsonschema:"Chat of the message (optional)"`
	ID   string `json:"id" jsonschema:"Message ID with media"`
	Out  string `json:"out,omitempty" jsonschema:"Output file or folder; default is the account media folder"`
}

type DownloadResult

type DownloadResult struct {
	Path string `json:"path"`
	Mime string `json:"mime"`
	Size int64  `json:"size"`
}

type Draft

type Draft struct {
	ID         int64           `json:"id"`
	Status     string          `json:"status"`
	Method     string          `json:"method"`
	Summary    string          `json:"summary"`
	Preview    string          `json:"preview"`
	Reason     string          `json:"reason,omitempty"`
	Targets    []string        `json:"targets,omitempty"`
	Source     string          `json:"source"`
	Profile    string          `json:"profile"`
	Created    string          `json:"created"`
	Expires    string          `json:"expires"`
	ResolvedAt string          `json:"resolved_at,omitempty"`
	ResolvedBy string          `json:"resolved_by,omitempty"`
	Result     json.RawMessage `json:"result,omitempty"`
	Error      string          `json:"error,omitempty"`
	Code       string          `json:"code,omitempty"`
}

type DraftApproveParams

type DraftApproveParams struct {
	ID   int64   `json:"id" jsonschema:"Draft number"`
	Text *string `json:"text,omitempty" jsonschema:"Replace the message text before sending"`
}

type DraftListParams

type DraftListParams struct {
	Status string `json:"status,omitempty" jsonschema:"pending (default), sent, rejected, expired, failed or all"`
	Limit  int    `json:"limit,omitempty" jsonschema:"Max items (default 50)"`
}

type DraftRef

type DraftRef struct {
	ID int64 `json:"id" jsonschema:"Draft number"`
}

type DryRun

type DryRun struct {
	DryRun  bool     `json:"dry_run"`
	Action  string   `json:"action"`
	Targets []string `json:"targets,omitempty"`
	Summary string   `json:"summary"`
}

type EditParams

type EditParams struct {
	Chat string `json:"chat,omitempty" jsonschema:"Chat of the message (optional)"`
	ID   string `json:"id" jsonschema:"ID of your own message to edit (within 15 minutes of sending)"`
	Text string `json:"text" jsonschema:"Replacement text"`
}

type Empty

type Empty struct{}

type Error

type Error struct {
	Code    string `json:"code"`
	Message string `json:"message"`
	Hint    string `json:"hint,omitempty"`
	Details any    `json:"details,omitempty"`
}

Error is the structured error returned by every method.

func AsError

func AsError(err error) *Error

func Errf

func Errf(code, format string, args ...any) *Error

func (*Error) Error

func (e *Error) Error() string

func (*Error) Is

func (e *Error) Is(target error) bool

func (*Error) WithDetails

func (e *Error) WithDetails(d any) *Error

func (*Error) WithHint

func (e *Error) WithHint(h string) *Error

type Event

type Event struct {
	Type string    `json:"type"`
	Time time.Time `json:"time"`
	Chat string    `json:"chat,omitempty"`
	Data any       `json:"data,omitempty"`
}

Event is pushed to `wassup events`, webhooks and streaming calls.

type EventsParams

type EventsParams struct {
	Types []string `json:"types,omitempty" jsonschema:"Event types to include, e.g. message, reaction, receipt, call. Empty = all"`
	Chats []string `json:"chats,omitempty" jsonschema:"Only events from these chats"`
}

type ForwardParams

type ForwardParams struct {
	Chat string `json:"chat,omitempty" jsonschema:"Chat of the original message (optional)"`
	ID   string `json:"id" jsonschema:"Message ID to forward"`
	To   string `json:"to" jsonschema:"Destination chat"`
}

type Frame

type Frame struct {
	ID     int64           `json:"id"`
	Event  json.RawMessage `json:"event,omitempty"`
	Result json.RawMessage `json:"result,omitempty"`
	Error  *Error          `json:"error,omitempty"`
	Final  bool            `json:"final,omitempty"`
}

Frame is one line of JSON sent back. Streams send Event frames, then exactly one Final frame.

type Group

type Group struct {
	JID              string        `json:"jid"`
	Name             string        `json:"name"`
	Description      string        `json:"description,omitempty"`
	Owner            string        `json:"owner,omitempty"`
	Created          *time.Time    `json:"created,omitempty"`
	ParticipantCount int           `json:"participant_count"`
	Participants     []Participant `json:"participants,omitempty"`
	Announce         bool          `json:"announce"`
	Locked           bool          `json:"locked"`
	ApprovalRequired bool          `json:"approval_required"`
	MemberAddMode    string        `json:"member_add_mode,omitempty"`
	Disappearing     string        `json:"disappearing,omitempty"`
	IsCommunity      bool          `json:"is_community,omitempty"`
	Community        string        `json:"community,omitempty"`
	IsAdmin          bool          `json:"is_admin"`
}

type GroupCreateParams

type GroupCreateParams struct {
	Name         string   `json:"name" jsonschema:"Group name (max 100 characters)"`
	Participants []string `json:"participants" jsonschema:"People to add (phones, names or JIDs)"`
	Community    bool     `json:"community,omitempty" jsonschema:"Create a community instead of a group"`
	Parent       string   `json:"parent,omitempty" jsonschema:"Community to create the group inside"`
	Description  string   `json:"description,omitempty" jsonschema:"Group description"`
}

type GroupInviteParams

type GroupInviteParams struct {
	Group string `json:"group" jsonschema:"Group"`
	Reset bool   `json:"reset,omitempty" jsonschema:"Revoke the old link and make a new one"`
}

type GroupListParams

type GroupListParams struct {
	Query string `json:"query,omitempty" jsonschema:"Filter by name"`
}

type GroupParticipantsParams

type GroupParticipantsParams struct {
	Group        string   `json:"group" jsonschema:"Group to change"`
	Action       string   `json:"action" jsonschema:"add, remove, promote or demote"`
	Participants []string `json:"participants" jsonschema:"People (phones, names or JIDs)"`
}

type GroupRef

type GroupRef struct {
	Group string `json:"group" jsonschema:"Group: name, JID or invite link"`
}

type GroupRequestsParams

type GroupRequestsParams struct {
	Group        string   `json:"group" jsonschema:"Group"`
	Action       string   `json:"action,omitempty" jsonschema:"list (default), approve or reject"`
	Participants []string `json:"participants,omitempty" jsonschema:"Who to approve or reject; empty = everyone pending"`
}

type GroupUpdateParams

type GroupUpdateParams struct {
	Group        string  `json:"group" jsonschema:"Group to change"`
	Name         string  `json:"name,omitempty" jsonschema:"New name"`
	Description  *string `json:"description,omitempty" jsonschema:"New description; empty string clears it"`
	Announce     *bool   `json:"announce,omitempty" jsonschema:"Only admins can send messages"`
	Locked       *bool   `json:"locked,omitempty" jsonschema:"Only admins can edit group info"`
	Approval     *bool   `json:"approval,omitempty" jsonschema:"Admins must approve new members"`
	MemberAdd    string  `json:"member_add,omitempty" jsonschema:"Who can add members: admins or all"`
	Photo        string  `json:"photo,omitempty" jsonschema:"Path to a new group photo"`
	RemovePhoto  bool    `json:"remove_photo,omitempty" jsonschema:"Remove the group photo"`
	Disappearing string  `json:"disappearing,omitempty" jsonschema:"off, 24h, 7d or 90d"`
}

type HistoryParams

type HistoryParams struct {
	Chat    string `json:"chat" jsonschema:"Chat to backfill"`
	Count   int    `json:"count,omitempty" jsonschema:"Messages to request from the phone (default 50, max 500)"`
	Timeout string `json:"timeout,omitempty" jsonschema:"How long to wait for the phone (default 30s)"`
}

type JoinParams

type JoinParams struct {
	Link string `json:"link" jsonschema:"Invite link (chat.whatsapp.com/...) or code"`
}

type LimitParams

type LimitParams struct {
	Limit int `json:"limit,omitempty" jsonschema:"Max items (default 50)"`
}

type ListChatsParams

type ListChatsParams struct {
	Query    string `json:"query,omitempty" jsonschema:"Filter by name"`
	Kind     string `json:"kind,omitempty" jsonschema:"dm, group, channel or broadcast"`
	Unread   bool   `json:"unread,omitempty" jsonschema:"Only chats with unread messages"`
	Archived string `json:"archived,omitempty" jsonschema:"exclude (default), include or only"`
	Limit    int    `json:"limit,omitempty" jsonschema:"Max chats (default 50)"`
}

type ListContactsParams

type ListContactsParams struct {
	Query string `json:"query,omitempty" jsonschema:"Filter by name or number"`
	Limit int    `json:"limit,omitempty" jsonschema:"Max results (default 100)"`
}

type ListMessagesParams

type ListMessagesParams struct {
	Chat   string `json:"chat,omitempty" jsonschema:"Chat to read; empty = all chats"`
	Limit  int    `json:"limit,omitempty" jsonschema:"Max messages (default 30, max 1000)"`
	Before string `json:"before,omitempty" jsonschema:"Only messages before this time (RFC3339, 2h, 3d) or message ID"`
	After  string `json:"after,omitempty" jsonschema:"Only messages after this time (RFC3339, 2h, 3d) or message ID"`
	From   string `json:"from,omitempty" jsonschema:"Only messages from this sender"`
	FromMe *bool  `json:"from_me,omitempty" jsonschema:"true = only yours, false = only others'"`
	Type   string `json:"type,omitempty" jsonschema:"text, image, video, audio, voice, document, sticker, location, contact, poll"`
	Unread bool   `json:"unread,omitempty" jsonschema:"Only messages received after the chat was last read"`
	Order  string `json:"order,omitempty" jsonschema:"asc (oldest first, default) or desc"`
}

type Location

type Location struct {
	Lat     float64 `json:"lat"`
	Lng     float64 `json:"lng"`
	Name    string  `json:"name,omitempty"`
	Address string  `json:"address,omitempty"`
	URL     string  `json:"url,omitempty"`
	Live    bool    `json:"live,omitempty"`
}

type LocationInput

type LocationInput struct {
	Lat     float64 `json:"lat" jsonschema:"Latitude"`
	Lng     float64 `json:"lng" jsonschema:"Longitude"`
	Name    string  `json:"name,omitempty" jsonschema:"Place name"`
	Address string  `json:"address,omitempty" jsonschema:"Street address"`
}

type LoginParams

type LoginParams struct {
	Phone string `` /* 138-byte string literal not displayed */
}

type MarkReadParams

type MarkReadParams struct {
	Chat string   `json:"chat" jsonschema:"Chat to mark as read"`
	IDs  []string `json:"ids,omitempty" jsonschema:"Specific message IDs; default is every unread message"`
}

type Media

type Media struct {
	Mime     string `json:"mime,omitempty"`
	FileName string `json:"file_name,omitempty"`
	Size     int64  `json:"size,omitempty"`
	Seconds  int    `json:"seconds,omitempty"`
	Width    int    `json:"width,omitempty"`
	Height   int    `json:"height,omitempty"`
	Path     string `json:"path,omitempty"` // set once downloaded
}

type Message

type Message struct {
	ID         string     `json:"id"`
	Chat       string     `json:"chat"`
	ChatName   string     `json:"chat_name,omitempty"`
	Sender     string     `json:"sender,omitempty"`
	SenderName string     `json:"sender_name,omitempty"`
	FromMe     bool       `json:"from_me"`
	Time       time.Time  `json:"time"`
	Type       string     `json:"type"`
	Text       string     `json:"text,omitempty"`
	Media      *Media     `json:"media,omitempty"`
	Location   *Location  `json:"location,omitempty"`
	Poll       *Poll      `json:"poll,omitempty"`
	QuotedID   string     `json:"quoted_id,omitempty"`
	Mentions   []string   `json:"mentions,omitempty"`
	Forwarded  bool       `json:"forwarded,omitempty"`
	ViewOnce   bool       `json:"view_once,omitempty"`
	Edited     bool       `json:"edited,omitempty"`
	Revoked    bool       `json:"revoked,omitempty"`
	Starred    bool       `json:"starred,omitempty"`
	Status     string     `json:"status,omitempty"` // for your own messages: sent, delivered, read, played
	Transcript string     `json:"transcript,omitempty"`
	Reactions  []Reaction `json:"reactions,omitempty"`
}

type MessageRef

type MessageRef struct {
	Chat string `json:"chat,omitempty" jsonschema:"Chat of the message (optional if the ID is unique locally)"`
	ID   string `json:"id" jsonschema:"Message ID"`
}

MessageRef addresses one stored message.

type Meta

type Meta struct {
	Source  string `json:"source,omitempty"`  // cli, mcp or rpc
	Profile string `json:"profile,omitempty"` // policy profile name
	Yes     bool   `json:"yes,omitempty"`     // user confirmed risky actions
	DryRun  bool   `json:"dry_run,omitempty"` // report instead of doing
}

Meta travels with every request and feeds the policy engine.

type Participant

type Participant struct {
	JID        string `json:"jid"`
	Phone      string `json:"phone,omitempty"`
	LID        string `json:"lid,omitempty"`
	Name       string `json:"name,omitempty"`
	Admin      bool   `json:"admin,omitempty"`
	SuperAdmin bool   `json:"super_admin,omitempty"`
	Error      int    `json:"error,omitempty"`
}

type PinParams

type PinParams struct {
	Chat     string `json:"chat,omitempty" jsonschema:"Chat of the message (optional)"`
	ID       string `json:"id" jsonschema:"Message ID"`
	Unpin    bool   `json:"unpin,omitempty" jsonschema:"Unpin instead of pin"`
	Duration string `json:"duration,omitempty" jsonschema:"24h, 7d or 30d (default 7d)"`
}

type Poll

type Poll struct {
	Question   string       `json:"question"`
	Options    []PollOption `json:"options"`
	Selectable int          `json:"selectable"`
}

type PollCreateParams

type PollCreateParams struct {
	To         string   `json:"to" jsonschema:"Recipient chat"`
	Question   string   `json:"question" jsonschema:"Poll question"`
	Options    []string `json:"options" jsonschema:"2 to 12 answer options"`
	Selectable int      `json:"selectable,omitempty" jsonschema:"How many options a voter may pick (default 1; 0 or more than options = any)"`
}

type PollOption

type PollOption struct {
	Name   string   `json:"name"`
	Votes  int      `json:"votes"`
	Voters []string `json:"voters,omitempty"`
}

type PollVoteParams

type PollVoteParams struct {
	Chat    string   `json:"chat,omitempty" jsonschema:"Chat containing the poll (optional if the ID is unique locally)"`
	ID      string   `json:"id" jsonschema:"Poll message ID"`
	Options []string `json:"options" jsonschema:"Option names to vote for; empty list clears your vote"`
}

type PresenceParams

type PresenceParams struct {
	Online bool `json:"online" jsonschema:"true = online, false = offline"`
}

type PrivacySetParams

type PrivacySetParams struct {
	Setting string `json:"setting" jsonschema:"groupadd, last, status, profile, readreceipts, online, calladd, messages, defense or stickers"`
	Value   string `json:"value" jsonschema:"all, contacts, contact_blacklist, none, match_last_seen, known, on_standard or off"`
}

type Profile

type Profile struct {
	JID        string `json:"jid"`
	Phone      string `json:"phone"`
	LID        string `json:"lid,omitempty"`
	Name       string `json:"name"`
	About      string `json:"about,omitempty"`
	PictureURL string `json:"picture_url,omitempty"`
	Business   string `json:"business_name,omitempty"`
	Platform   string `json:"platform,omitempty"`
}

type ProfileUpdateParams

type ProfileUpdateParams struct {
	Name        string  `json:"name,omitempty" jsonschema:"New display (push) name"`
	About       *string `json:"about,omitempty" jsonschema:"New about text"`
	Photo       string  `json:"photo,omitempty" jsonschema:"Path to a new profile photo"`
	RemovePhoto bool    `json:"remove_photo,omitempty" jsonschema:"Remove the profile photo"`
}

type ReactParams

type ReactParams struct {
	Chat  string `json:"chat,omitempty" jsonschema:"Chat of the message (optional)"`
	ID    string `json:"id" jsonschema:"Message ID to react to"`
	Emoji string `json:"emoji,omitempty" jsonschema:"Emoji; empty removes your reaction"`
}

type Reaction

type Reaction struct {
	Sender     string    `json:"sender"`
	SenderName string    `json:"sender_name,omitempty"`
	Emoji      string    `json:"emoji"`
	Time       time.Time `json:"time"`
}

type Request

type Request struct {
	ID     int64           `json:"id"`
	Method string          `json:"method"`
	Params json.RawMessage `json:"params,omitempty"`
	Meta   Meta            `json:"meta"`
}

Request is one line of JSON sent to the daemon socket.

type ResolveParams

type ResolveParams struct {
	Query string `json:"query" jsonschema:"Name, phone number or JID to resolve"`
}

type Resolved

type Resolved struct {
	Query string `json:"query"`
	JID   string `json:"jid"`
	Name  string `json:"name,omitempty"`
	Kind  string `json:"kind"`
	Phone string `json:"phone,omitempty"`
	Via   string `json:"via"` // self, jid, phone, contact, chat
}

type ScheduleListParams

type ScheduleListParams struct {
	Status string `json:"status,omitempty" jsonschema:"pending (default), sent, failed, cancelled, missed or all"`
}

type ScheduleParams

type ScheduleParams struct {
	SendParams
	At string `json:"at,omitempty" jsonschema:"When to send: RFC3339, 'YYYY-MM-DD HH:MM', 'HH:MM', '9am', 'tomorrow 9:30am' (local time)"`
	In string `json:"in,omitempty" jsonschema:"Or a delay from now, e.g. 45m, 2h, 1d"`
}

type ScheduleRef

type ScheduleRef struct {
	ID int64 `json:"id" jsonschema:"Scheduled message number"`
}

type Scheduled

type Scheduled struct {
	ID      int64           `json:"id"`
	Due     string          `json:"due"`
	Status  string          `json:"status"`
	Summary string          `json:"summary"`
	To      string          `json:"to,omitempty"`
	Source  string          `json:"source"`
	Created string          `json:"created"`
	SentAt  string          `json:"sent_at,omitempty"`
	Result  json.RawMessage `json:"result,omitempty"`
	Error   string          `json:"error,omitempty"`
}

type SearchParams

type SearchParams struct {
	Query  string `json:"query" jsonschema:"Words to find; supports \"exact phrases\" and prefix*"`
	Chat   string `json:"chat,omitempty" jsonschema:"Limit to one chat"`
	From   string `json:"from,omitempty" jsonschema:"Limit to one sender"`
	Type   string `json:"type,omitempty" jsonschema:"Limit to a message type"`
	After  string `json:"after,omitempty" jsonschema:"Only after this time (RFC3339, 2h, 3d)"`
	Before string `json:"before,omitempty" jsonschema:"Only before this time"`
	Limit  int    `json:"limit,omitempty" jsonschema:"Max results (default 30)"`
}

type SendFailure

type SendFailure struct {
	To    string `json:"to"`
	Error *Error `json:"error"`
}

type SendManyParams

type SendManyParams struct {
	To    []string `json:"to" jsonschema:"Recipients, same formats as send"`
	Text  string   `json:"text,omitempty" jsonschema:"Message text or caption"`
	File  string   `json:"file,omitempty" jsonschema:"Absolute path of a file to attach"`
	As    string   `json:"as,omitempty" jsonschema:"auto, image, video, audio, voice, document or sticker"`
	Delay string   `json:"delay,omitempty" jsonschema:"Pause between recipients, e.g. 3s (default 2s plus jitter)"`
}

type SendManyResult

type SendManyResult struct {
	Sent   []SendResult  `json:"sent"`
	Failed []SendFailure `json:"failed,omitempty"`
}

type SendParams

type SendParams struct {
	To          string         `json:"to" jsonschema:"Recipient: phone number with country code, contact or group name, JID, or 'me' for your own chat"`
	Text        string         `json:"text,omitempty" jsonschema:"Message text, or the caption when a file is attached"`
	File        string         `json:"file,omitempty" jsonschema:"Absolute path of a file to attach"`
	As          string         `json:"as,omitempty" jsonschema:"How to send the file: auto (default), image, video, gif, audio, voice, document or sticker"`
	FileName    string         `json:"file_name,omitempty" jsonschema:"File name shown for documents"`
	ReplyTo     string         `json:"reply_to,omitempty" jsonschema:"Message ID to quote and reply to"`
	Mentions    []string       `json:"mentions,omitempty" jsonschema:"People to @mention (phones, names or JIDs). @<number> in the text is detected too"`
	MentionAll  bool           `json:"mention_all,omitempty" jsonschema:"Notify every group member without adding names to the text"`
	ViewOnce    bool           `json:"view_once,omitempty" jsonschema:"Send image, video or voice as view once"`
	NoPreview   bool           `json:"no_preview,omitempty" jsonschema:"Skip the link preview for URLs in the text"`
	Location    *LocationInput `json:"location,omitempty" jsonschema:"Send a map pin instead of text"`
	ContactCard *ContactInput  `json:"contact,omitempty" jsonschema:"Send a contact card"`
	Typing      bool           `json:"typing,omitempty" jsonschema:"Show typing... briefly before sending"`
}

type SendResult

type SendResult struct {
	ID       string    `json:"id"`
	Chat     string    `json:"chat"`
	ChatName string    `json:"chat_name,omitempty"`
	Time     time.Time `json:"time"`
	Type     string    `json:"type"`
	ServerID int       `json:"server_id,omitempty"`
}

type StarParams

type StarParams struct {
	Chat   string `json:"chat,omitempty" jsonschema:"Chat of the message (optional)"`
	ID     string `json:"id" jsonschema:"Message ID"`
	Unstar bool   `json:"unstar,omitempty" jsonschema:"Remove the star"`
}

type Status

type Status struct {
	Account       string     `json:"account"`
	State         string     `json:"state"`
	LoggedIn      bool       `json:"logged_in"`
	Connected     bool       `json:"connected"`
	JID           string     `json:"jid,omitempty"`
	LID           string     `json:"lid,omitempty"`
	Phone         string     `json:"phone,omitempty"`
	PushName      string     `json:"push_name,omitempty"`
	Platform      string     `json:"platform,omitempty"`
	LastError     string     `json:"last_error,omitempty"`
	ConnectedAt   *time.Time `json:"connected_at,omitempty"`
	DaemonPID     int        `json:"daemon_pid,omitempty"`
	DaemonStarted *time.Time `json:"daemon_started,omitempty"`
	Version       string     `json:"version"`
	WAVersion     string     `json:"wa_version,omitempty"`
	Messages      int        `json:"messages_stored"`
	Chats         int        `json:"chats_stored"`
	HistorySync   string     `json:"history_sync,omitempty"`
}

type StatusPostParams

type StatusPostParams struct {
	Text       string `json:"text,omitempty" jsonschema:"Text status, or caption for a media status"`
	File       string `json:"file,omitempty" jsonschema:"Image or video to post"`
	Background string `json:"background,omitempty" jsonschema:"Background color for text statuses, #RRGGBB"`
	Font       int    `json:"font,omitempty" jsonschema:"Font style 0-9 for text statuses"`
}

type Transcript

type Transcript struct {
	ID     string `json:"id"`
	Chat   string `json:"chat"`
	Text   string `json:"text"`
	Engine string `json:"engine"`
	Cached bool   `json:"cached,omitempty"`
}

type TypingParams

type TypingParams struct {
	Chat  string `json:"chat" jsonschema:"Chat to show the indicator in"`
	State string `json:"state,omitempty" jsonschema:"typing (default), recording or paused"`
}

type UpdateChatParams

type UpdateChatParams struct {
	Chat         string `json:"chat" jsonschema:"Chat to change"`
	Archive      *bool  `json:"archive,omitempty" jsonschema:"Archive (true) or unarchive (false)"`
	Pin          *bool  `json:"pin,omitempty" jsonschema:"Pin (true) or unpin (false)"`
	Mute         string `json:"mute,omitempty" jsonschema:"Mute for a duration like 8h or 7d, 'forever', or 'off' to unmute"`
	Read         *bool  `json:"read,omitempty" jsonschema:"Mark read (true) or unread (false)"`
	Disappearing string `json:"disappearing,omitempty" jsonschema:"Disappearing messages: off, 24h, 7d or 90d"`
}

type UserInfo

type UserInfo struct {
	JID          string   `json:"jid"`
	Phone        string   `json:"phone,omitempty"`
	LID          string   `json:"lid,omitempty"`
	Name         string   `json:"name,omitempty"`
	PushName     string   `json:"push_name,omitempty"`
	About        string   `json:"about,omitempty"`
	PictureID    string   `json:"picture_id,omitempty"`
	PictureURL   string   `json:"picture_url,omitempty"`
	Devices      int      `json:"devices"`
	Business     bool     `json:"business"`
	BusinessName string   `json:"business_name,omitempty"`
	Blocked      bool     `json:"blocked"`
	Email        string   `json:"email,omitempty"`
	Website      []string `json:"website,omitempty"`
	Address      string   `json:"address,omitempty"`
}

type UserRef

type UserRef struct {
	User string `json:"user" jsonschema:"Person: phone, contact name or JID"`
}

type WaitParams

type WaitParams struct {
	Chat          string `json:"chat,omitempty" jsonschema:"Only messages in this chat"`
	From          string `json:"from,omitempty" jsonschema:"Only messages from this sender"`
	Match         string `json:"match,omitempty" jsonschema:"Regular expression the text must match (case-insensitive)"`
	Timeout       string `json:"timeout,omitempty" jsonschema:"How long to wait, e.g. 90s or 10m (default 5m)"`
	IncludeFromMe bool   `json:"include_from_me,omitempty" jsonschema:"Also match messages you send from other devices"`
	Count         int    `json:"count,omitempty" jsonschema:"Return after this many matching messages (default 1)"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL