Versions in this module Expand all Collapse all v1 v1.0.0 Nov 2, 2021 Changes in this version + var ErrMessageTypeNotImplemented = errors.New("message type not implemented") + var ErrOptionsNotProvided = errors.New("new conn options not provided") type Conn + func NewConnWithOptions(opt *Options) (*Conn, error) + func (wac *Conn) BlockContact(jid string) (<-chan string, error) + func (wac *Conn) BusinessProfile(wid string) (<-chan string, error) + func (wac *Conn) IsConnected() bool + func (wac *Conn) IsLoggedIn() bool + func (wac *Conn) SearchOrder(catalogWid, stanzaId string) (<-chan string, error) + func (wac *Conn) SearchProductDetails(id, orderId, token string) (<-chan string, error) + func (wac *Conn) UnblockContact(jid string) (<-chan string, error) + func (wac *Conn) UpdateProfileName(name string) (<-chan string, error) + type Options struct + ClientVersion string + Handler []Handler + LongClientName string + Proxy func(*http.Request) (*url.URL, error) + ShortClientName string + Store *Store + Timeout time.Duration + type OrderMessage struct + ContextInfo ContextInfo + Info MessageInfo + ItemCount int32 + Message string + OrderId string + OrderTitle string + SellerJid string + Status proto.OrderMessage_OrderMessageOrderStatus + Surface proto.OrderMessage_OrderMessageOrderSurface + Thumbnail []byte + Token string + TotalAmount1000 int64 + TotalCurrencyCode string + type OrderMessageHandler interface + HandleOrderMessage func(message OrderMessage) + type ProductMessage struct + BusinessOwnerJid string + Catalog *proto.CatalogSnapshot + ContextInfo ContextInfo + Info MessageInfo + Product *proto.ProductSnapshot + type ProductMessageHandler interface + HandleProductMessage func(message ProductMessage) v0 v0.2.0 Nov 17, 2020 Changes in this version + const DeliveryAck + const Error + const Pending + const Played + const Read + const ServerAck + var ErrAlreadyConnected = errors.New("already connected") + var ErrAlreadyLoggedIn = errors.New("already logged in") + var ErrConnectionTimeout = errors.New("connection timed out") + var ErrInvalidHmac = errors.New("invalid hmac") + var ErrInvalidServerResponse = errors.New("invalid response received from server") + var ErrInvalidSession = errors.New("invalid session") + var ErrInvalidWebsocket = errors.New("invalid websocket") + var ErrInvalidWsData = errors.New("received invalid data") + var ErrInvalidWsState = errors.New("can't handle binary data when not logged in") + var ErrLoginInProgress = errors.New("login or restore already running") + var ErrMediaDownloadFailedWith404 = errors.New("download failed with status code 404") + var ErrMediaDownloadFailedWith410 = errors.New("download failed with status code 410") + var ErrMissingMessageTag = errors.New("no messageTag specified or to short") + var ErrNotConnected = errors.New("not connected") + var ErrServerRespondedWith404 = errors.New("server responded with status 404") + func CheckCurrentServerVersion() ([]int, error) + func Download(url string, mediaKey []byte, appInfo MediaType, fileLength int) ([]byte, error) + func GetLiveLocationProto(msg LiveLocationMessage) *proto.WebMessageInfo + func GetLocationProto(msg LocationMessage) *proto.WebMessageInfo + func ParseNodeMessage(msg binary.Node) interface + func ParseProtoMessage(msg *proto.WebMessageInfo) interface + type AudioMessage struct + Content io.Reader + ContextInfo ContextInfo + Info MessageInfo + Length uint32 + Ptt bool + Type string + func (m *AudioMessage) Download() ([]byte, error) + type AudioMessageHandler interface + HandleAudioMessage func(message AudioMessage) + type BatteryMessage struct + Percentage int + Plugged bool + Powersave bool + type BatteryMessageHandler interface + HandleBatteryMessage func(battery BatteryMessage) + type Chat struct + IsMarkedSpam string + IsMuted string + Jid string + LastMessageTime string + Name string + Unread string + type ChatListHandler interface + HandleChatList func(contacts []Chat) + type Conn struct + Info *Info + Proxy func(*http.Request) (*url.URL, error) + ServerLastSeen time.Time + Store *Store + func NewConn(timeout time.Duration) (*Conn, error) + func NewConnWithProxy(timeout time.Duration, proxy func(*http.Request) (*url.URL, error)) (*Conn, error) + func (wac *Conn) AddHandler(handler Handler) + func (wac *Conn) AddMember(jid string, participants []string) (<-chan string, error) + func (wac *Conn) AdminTest() (bool, error) + func (wac *Conn) Chats() (*binary.Node, error) + func (wac *Conn) Contacts() (*binary.Node, error) + func (wac *Conn) CreateGroup(subject string, participants []string) (<-chan string, error) + func (wac *Conn) DeleteMessage(remotejid, msgid string, fromMe bool) error + func (wac *Conn) Disconnect() (Session, error) + func (wac *Conn) Emoji() (*binary.Node, error) + func (wac *Conn) Exist(jid string) (<-chan string, error) + func (wac *Conn) GetClientVersion() []int + func (wac *Conn) GetConnected() bool + func (wac *Conn) GetGroupMetaData(jid string) (<-chan string, error) + func (wac *Conn) GetLoggedIn() bool + func (wac *Conn) GetProfilePicThumb(jid string) (<-chan string, error) + func (wac *Conn) GetStatus(jid string) (<-chan string, error) + func (wac *Conn) GroupAcceptInviteCode(code string) (jid string, err error) + func (wac *Conn) GroupInviteLink(jid string) (string, error) + func (wac *Conn) LeaveGroup(jid string) (<-chan string, error) + func (wac *Conn) LoadChatMessages(jid string, count int, messageId string, owner bool, after bool, ...) error + func (wac *Conn) LoadFullChatHistory(jid string, chunkSize int, pauseBetweenQueries time.Duration, ...) + func (wac *Conn) LoadFullChatHistoryAfter(jid string, messageId string, chunkSize int, pauseBetweenQueries time.Duration, ...) + func (wac *Conn) LoadMediaInfo(jid, messageId, owner string) (*binary.Node, error) + func (wac *Conn) LoadMessages(jid, messageId string, count int) (*binary.Node, error) + func (wac *Conn) LoadMessagesAfter(jid, messageId string, count int) (*binary.Node, error) + func (wac *Conn) LoadMessagesBefore(jid, messageId string, count int) (*binary.Node, error) + func (wac *Conn) Login(qrChan chan<- string) (Session, error) + func (wac *Conn) Logout() error + func (wac *Conn) Presence(jid string, presence Presence) (<-chan string, error) + func (wac *Conn) Read(jid, id string) (<-chan string, error) + func (wac *Conn) RemoveAdmin(jid string, participants []string) (<-chan string, error) + func (wac *Conn) RemoveHandler(handler Handler) bool + func (wac *Conn) RemoveHandlers() + func (wac *Conn) RemoveMember(jid string, participants []string) (<-chan string, error) + func (wac *Conn) Restore() error + func (wac *Conn) RestoreWithSession(session Session) (_ Session, err error) + func (wac *Conn) RevokeMessage(remotejid, msgid string, fromme bool) (revokeid string, err error) + func (wac *Conn) Search(search string, count, page int) (*binary.Node, error) + func (wac *Conn) Send(msg interface{}) (string, error) + func (wac *Conn) SetAdmin(jid string, participants []string) (<-chan string, error) + func (wac *Conn) SetClientName(long, short string, version string) error + func (wac *Conn) SetClientVersion(major int, minor int, patch int) + func (wac *Conn) SubscribePresence(jid string) (<-chan string, error) + func (wac *Conn) UpdateGroupSubject(subject string, jid string) (<-chan string, error) + func (wac *Conn) Upload(reader io.Reader, appInfo MediaType) (downloadURL string, mediaKey []byte, fileEncSha256 []byte, fileSha256 []byte, ...) + func (wac *Conn) UploadProfilePic(image, preview []byte) (<-chan string, error) + type Contact struct + Jid string + Name string + Notify string + Short string + type ContactListHandler interface + HandleContactList func(contacts []Contact) + type ContactMessage struct + ContextInfo ContextInfo + DisplayName string + Info MessageInfo + Vcard string + type ContactMessageHandler interface + HandleContactMessage func(message ContactMessage) + type ContextInfo struct + IsForwarded bool + Participant string + QuotedMessage *proto.Message + QuotedMessageID string + type DocumentMessage struct + Content io.Reader + ContextInfo ContextInfo + FileName string + Info MessageInfo + PageCount uint32 + Thumbnail []byte + Title string + Type string + func (m *DocumentMessage) Download() ([]byte, error) + type DocumentMessageHandler interface + HandleDocumentMessage func(message DocumentMessage) + type ErrConnectionClosed struct + Code int + Text string + func (e *ErrConnectionClosed) Error() string + type ErrConnectionFailed struct + Err error + func (e *ErrConnectionFailed) Error() string + type Handler interface + HandleError func(err error) + type ImageMessage struct + Caption string + Content io.Reader + ContextInfo ContextInfo + Info MessageInfo + Thumbnail []byte + Type string + func (m *ImageMessage) Download() ([]byte, error) + type ImageMessageHandler interface + HandleImageMessage func(message ImageMessage) + type Info struct + Battery int + Connected bool + Is24h bool + Lc string + Lg string + Phone *PhoneInfo + Platform string + Plugged bool + Pushname string + Tos int + Wid string + type JsonMessageHandler interface + HandleJsonMessage func(message string) + type LiveLocationMessage struct + AccuracyInMeters uint32 + Caption string + ContextInfo ContextInfo + DegreesClockwiseFromMagneticNorth uint32 + DegreesLatitude float64 + DegreesLongitude float64 + Info MessageInfo + JpegThumbnail []byte + SequenceNumber int64 + SpeedInMps float32 + func GetLiveLocationMessage(msg *proto.WebMessageInfo) LiveLocationMessage + type LiveLocationMessageHandler interface + HandleLiveLocationMessage func(message LiveLocationMessage) + type LocationMessage struct + Address string + ContextInfo ContextInfo + DegreesLatitude float64 + DegreesLongitude float64 + Info MessageInfo + JpegThumbnail []byte + Name string + Url string + func GetLocationMessage(msg *proto.WebMessageInfo) LocationMessage + type LocationMessageHandler interface + HandleLocationMessage func(message LocationMessage) + type MediaConn struct + MediaConn struct{ ... } + Status int + type MediaType string + const MediaAudio + const MediaDocument + const MediaImage + const MediaVideo + type MessageInfo struct + FromMe bool + Id string + PushName string + RemoteJid string + SenderJid string + Source *proto.WebMessageInfo + Status MessageStatus + Timestamp uint64 + type MessageOffsetInfo struct + FirstMessageId string + FirstMessageOwner bool + type MessageStatus int + type NewContactHandler interface + HandleNewContact func(contact Contact) + type PhoneInfo struct + DeviceManufacturer string + DeviceModel string + Mcc string + Mnc string + OsBuildNumber string + OsVersion string + WaVersion string + type Presence string + const PresenceAvailable + const PresenceComposing + const PresencePaused + const PresenceRecording + const PresenceUnavailable + type RawMessageHandler interface + HandleRawMessage func(message *proto.WebMessageInfo) + type Session struct + ClientId string + ClientToken string + EncKey []byte + MacKey []byte + ServerToken string + Wid string + type StickerMessage struct + Content io.Reader + ContextInfo ContextInfo + Info MessageInfo + Type string + func (m *StickerMessage) Download() ([]byte, error) + type StickerMessageHandler interface + HandleStickerMessage func(message StickerMessage) + type Store struct + Chats map[string]Chat + Contacts map[string]Contact + type SyncHandler interface + ShouldCallSynchronously func() bool + type TextMessage struct + ContextInfo ContextInfo + Info MessageInfo + Text string + type TextMessageHandler interface + HandleTextMessage func(message TextMessage) + type VideoMessage struct + Caption string + Content io.Reader + ContextInfo ContextInfo + GifPlayback bool + Info MessageInfo + Length uint32 + Thumbnail []byte + Type string + func (m *VideoMessage) Download() ([]byte, error) + type VideoMessageHandler interface + HandleVideoMessage func(message VideoMessage)