Versions in this module Expand all Collapse all v1 v1.0.0 Oct 1, 2024 Changes in this version + const BusinessMessageLinkDirectPrefix + const BusinessMessageLinkPrefix + const ContactQRLinkDirectPrefix + const ContactQRLinkPrefix + const DisappearingTimer24Hours + const DisappearingTimer7Days + const DisappearingTimer90Days + const DisappearingTimerOff + const EditWindow + const FBArmadilloMessageVersion + const FBConsumerMessageVersion + const FBMessageApplicationVersion + const FBMessageVersion + const InviteLinkPrefix + const MinPreKeyCount + const NewsletterLinkPrefix + const NoiseHandshakeResponseTimeout + const QRChannelEventCode + const QRChannelEventError + const RemoveReactionText + const WACertIssuerSerial + const WantedPreKeyCount + var DefaultStatusPrivacy = []types.StatusPrivacy + var ErrAlreadyConnected = errors.New("websocket is already connected") + var ErrAppStateUpdate = errors.New("server returned error updating app state") + var ErrBroadcastListUnsupported = errors.New("sending to non-status broadcast lists is not yet supported") + var ErrBusinessMessageLinkNotFound = errors.New("that business message link does not exist or has been revoked") + var ErrContactQRLinkNotFound = errors.New("that contact QR link does not exist or has been revoked") + var ErrFileLengthMismatch = errors.New("file length does not match") + var ErrGroupInviteLinkUnauthorized = errors.New("you don't have the permission to get the group's invite link") + var ErrGroupNotFound = errors.New("that group does not exist") + var ErrIQBadRequest error = &IQError + var ErrIQDisconnected = &DisconnectedError + var ErrIQForbidden error = &IQError + var ErrIQGone error = &IQError + var ErrIQInternalServerError error = &IQError + var ErrIQLocked error = &IQError + var ErrIQNotAcceptable error = &IQError + var ErrIQNotAllowed error = &IQError + var ErrIQNotAuthorized error = &IQError + var ErrIQNotFound error = &IQError + var ErrIQPartialServerError error = &IQError + var ErrIQResourceLimit error = &IQError + var ErrIQServiceUnavailable error = &IQError + var ErrIQTimedOut = errors.New("info query timed out") + var ErrInvalidDisappearingTimer = errors.New("invalid disappearing timer provided") + var ErrInvalidImageFormat = errors.New("the given data is not a valid image") + var ErrInvalidInlineBotID = errors.New("invalid inline bot ID") + var ErrInvalidMediaEncSHA256 = errors.New("hash of media ciphertext doesn't match") + var ErrInvalidMediaHMAC = errors.New("invalid media hmac") + var ErrInvalidMediaSHA256 = errors.New("hash of media plaintext doesn't match") + var ErrInviteLinkInvalid = errors.New("that group invite link is not valid") + var ErrInviteLinkRevoked = errors.New("that group invite link has been revoked") + var ErrMediaDownloadFailedWith403 = DownloadHTTPError + var ErrMediaDownloadFailedWith404 = DownloadHTTPError + var ErrMediaDownloadFailedWith410 = DownloadHTTPError + var ErrMediaNotAvailableOnPhone = errors.New("media no longer available on phone") + var ErrMessageTimedOut = errors.New("timed out waiting for message send response") + var ErrNoPrivacyToken = errors.New("no privacy token stored") + var ErrNoPushName = errors.New("can't send presence without PushName set") + var ErrNoSession = errors.New("can't encrypt message for device: no signal session established") + var ErrNoURLPresent = errors.New("no url present") + var ErrNotConnected = errors.New("websocket not connected") + var ErrNotEncryptedReactionMessage = errors.New("given message isn't an encrypted reaction message") + var ErrNotInGroup = errors.New("you're not participating in that group") + var ErrNotLoggedIn = errors.New("the store doesn't contain a device JID") + var ErrNotPollUpdateMessage = errors.New("given message isn't a poll update message") + var ErrNothingDownloadableFound = errors.New("didn't find any attachments in message") + var ErrOriginalMessageSecretNotFound = errors.New("original message secret key not found") + var ErrPairInvalidDeviceIdentityHMAC = errors.New("invalid device identity HMAC in pair success message") + var ErrPairInvalidDeviceSignature = errors.New("invalid device signature in pair success message") + var ErrPairRejectedLocally = errors.New("local PrePairCallback rejected pairing") + var ErrProfilePictureNotSet = errors.New("that user or group does not have a profile picture") + var ErrProfilePictureUnauthorized = errors.New("the user has hidden their profile picture from you") + var ErrQRAlreadyConnected = errors.New("GetQRChannel must be called before connecting") + var ErrQRStoreContainsID = errors.New(...) + var ErrRecipientADJID = errors.New("message recipient must be a user JID with no device part") + var ErrServerReturnedError = errors.New("server returned error") + var ErrTooShortFile = errors.New("file too short") + var ErrUnknownMediaRetryError = errors.New("unknown media retry error") + var ErrUnknownMediaType = errors.New("unknown media type") + var ErrUnknownServer = errors.New("can't send message to unknown server") + var KeepAliveIntervalMax = 30 * time.Second + var KeepAliveIntervalMin = 20 * time.Second + var KeepAliveMaxFailTime = 3 * time.Minute + var KeepAliveResponseDeadline = 10 * time.Second + var QRChannelClientOutdated = QRChannelItem + var QRChannelErrUnexpectedEvent = QRChannelItem + var QRChannelScannedWithoutMultidevice = QRChannelItem + var QRChannelSuccess = QRChannelItem + var QRChannelTimeout = QRChannelItem + var RequestFromPhoneDelay = 5 * time.Second + var WACertPubKey = [...]byte + func DecryptMediaRetryNotification(evt *events.MediaRetry, mediaKey []byte) (*waProto.MediaRetryNotification, error) + func GenerateFacebookMessageID() int64 + func GenerateMessageID() types.MessageID + func GetLatestVersion(httpClient *http.Client) (*store.WAVersionContainer, error) + func HashPollOptions(optionNames []string) [][]byte + func ParseDisappearingTimerString(val string) (time.Duration, bool) + type Client struct + AutoReconnectErrors int + AutoReconnectHook func(error) bool + AutoTrustIdentity bool + AutomaticMessageRerequestFromPhone bool + DisableLoginAutoReconnect bool + DontSendSelfBroadcast bool + EmitAppStateEventsOnFullSync bool + EnableAutoReconnect bool + ErrorOnSubscribePresenceWithoutToken bool + GetClientPayload func() *waProto.ClientPayload + GetMessageForRetry func(requester, to types.JID, id types.MessageID) *waProto.Message + LastSuccessfulConnect time.Time + Log waLog.Logger + MessengerConfig *MessengerConfig + PrePairCallback func(jid types.JID, platform, businessName string) bool + PreRetryCallback func(receipt *events.Receipt, id types.MessageID, retryCount int, ...) bool + RefreshCAT func() error + Store *store.Device + func NewClient(deviceStore *store.Device, log waLog.Logger) *Client + func (cli *Client) AcceptTOSNotice(noticeID, stage string) error + func (cli *Client) AddEventHandler(handler EventHandler) uint32 + func (cli *Client) BuildEdit(chat types.JID, id types.MessageID, newContent *waProto.Message) *waProto.Message + func (cli *Client) BuildHistorySyncRequest(lastKnownMessageInfo *types.MessageInfo, count int) *waProto.Message + func (cli *Client) BuildMessageKey(chat, sender types.JID, id types.MessageID) *waProto.MessageKey + func (cli *Client) BuildPollCreation(name string, optionNames []string, selectableOptionCount int) *waProto.Message + func (cli *Client) BuildPollVote(pollInfo *types.MessageInfo, optionNames []string) (*waProto.Message, error) + func (cli *Client) BuildReaction(chat, sender types.JID, id types.MessageID, reaction string) *waProto.Message + func (cli *Client) BuildRevoke(chat, sender types.JID, id types.MessageID) *waProto.Message + func (cli *Client) BuildUnavailableMessageRequest(chat, sender types.JID, id string) *waProto.Message + func (cli *Client) Connect() error + func (cli *Client) CreateGroup(req ReqCreateGroup) (*types.GroupInfo, error) + func (cli *Client) CreateNewsletter(params CreateNewsletterParams) (*types.NewsletterMetadata, error) + func (cli *Client) DangerousInternals() *DangerousInternalClient + func (cli *Client) DecryptPollVote(vote *events.Message) (*waE2E.PollVoteMessage, error) + func (cli *Client) DecryptReaction(reaction *events.Message) (*waE2E.ReactionMessage, error) + func (cli *Client) Disconnect() + func (cli *Client) Download(msg DownloadableMessage) ([]byte, error) + func (cli *Client) DownloadAny(msg *waProto.Message) (data []byte, err error) + func (cli *Client) DownloadFB(transport *waMediaTransport.WAMediaTransport_Integral, mediaType MediaType) ([]byte, error) + func (cli *Client) DownloadFBToFile(transport *waMediaTransport.WAMediaTransport_Integral, mediaType MediaType, ...) error + func (cli *Client) DownloadMediaWithPath(directPath string, encFileHash, fileHash, mediaKey []byte, fileLength int, ...) (data []byte, err error) + func (cli *Client) DownloadMediaWithPathToFile(directPath string, encFileHash, fileHash, mediaKey []byte, fileLength int, ...) error + func (cli *Client) DownloadThumbnail(msg DownloadableThumbnail) ([]byte, error) + func (cli *Client) DownloadToFile(msg DownloadableMessage, file File) error + func (cli *Client) EncryptPollVote(pollInfo *types.MessageInfo, vote *waProto.PollVoteMessage) (*waProto.PollUpdateMessage, error) + func (cli *Client) FetchAppState(name appstate.WAPatchName, fullSync, onlyIfNotSynced bool) error + func (cli *Client) FollowNewsletter(jid types.JID) error + func (cli *Client) GenerateMessageID() types.MessageID + func (cli *Client) GetBlocklist() (*types.Blocklist, error) + func (cli *Client) GetBotListV2() ([]types.BotListInfo, error) + func (cli *Client) GetBotProfiles(botInfo []types.BotListInfo) ([]types.BotProfileInfo, error) + func (cli *Client) GetBusinessProfile(jid types.JID) (*types.BusinessProfile, error) + func (cli *Client) GetContactQRLink(revoke bool) (string, error) + func (cli *Client) GetGroupInfo(jid types.JID) (*types.GroupInfo, error) + func (cli *Client) GetGroupInfoFromInvite(jid, inviter types.JID, code string, expiration int64) (*types.GroupInfo, error) + func (cli *Client) GetGroupInfoFromLink(code string) (*types.GroupInfo, error) + func (cli *Client) GetGroupInviteLink(jid types.JID, reset bool) (string, error) + func (cli *Client) GetGroupRequestParticipants(jid types.JID) ([]types.JID, error) + func (cli *Client) GetJoinedGroups() ([]*types.GroupInfo, error) + func (cli *Client) GetLinkedGroupsParticipants(community types.JID) ([]types.JID, error) + func (cli *Client) GetNewsletterInfo(jid types.JID) (*types.NewsletterMetadata, error) + func (cli *Client) GetNewsletterInfoWithInvite(key string) (*types.NewsletterMetadata, error) + func (cli *Client) GetNewsletterMessageUpdates(jid types.JID, params *GetNewsletterUpdatesParams) ([]*types.NewsletterMessage, error) + func (cli *Client) GetNewsletterMessages(jid types.JID, params *GetNewsletterMessagesParams) ([]*types.NewsletterMessage, error) + func (cli *Client) GetPrivacySettings() (settings types.PrivacySettings) + func (cli *Client) GetProfilePictureInfo(jid types.JID, params *GetProfilePictureParams) (*types.ProfilePictureInfo, error) + func (cli *Client) GetQRChannel(ctx context.Context) (<-chan QRChannelItem, error) + func (cli *Client) GetStatusPrivacy() ([]types.StatusPrivacy, error) + func (cli *Client) GetSubGroups(community types.JID) ([]*types.GroupLinkTarget, error) + func (cli *Client) GetSubscribedNewsletters() ([]*types.NewsletterMetadata, error) + func (cli *Client) GetUserDevices(jids []types.JID) ([]types.JID, error) + func (cli *Client) GetUserDevicesContext(ctx context.Context, jids []types.JID) ([]types.JID, error) + func (cli *Client) GetUserInfo(jids []types.JID) (map[types.JID]types.UserInfo, error) + func (cli *Client) IsConnected() bool + func (cli *Client) IsLoggedIn() bool + func (cli *Client) IsOnWhatsApp(phones []string) ([]types.IsOnWhatsAppResponse, error) + func (cli *Client) JoinGroupWithInvite(jid, inviter types.JID, code string, expiration int64) error + func (cli *Client) JoinGroupWithLink(code string) (types.JID, error) + func (cli *Client) LeaveGroup(jid types.JID) error + func (cli *Client) LinkGroup(parent, child types.JID) error + func (cli *Client) Logout() error + func (cli *Client) MarkRead(ids []types.MessageID, timestamp time.Time, chat, sender types.JID, ...) error + func (cli *Client) NewsletterMarkViewed(jid types.JID, serverIDs []types.MessageServerID) error + func (cli *Client) NewsletterSendReaction(jid types.JID, serverID types.MessageServerID, reaction string, ...) error + func (cli *Client) NewsletterSubscribeLiveUpdates(ctx context.Context, jid types.JID) (time.Duration, error) + func (cli *Client) NewsletterToggleMute(jid types.JID, mute bool) error + func (cli *Client) PairPhone(phone string, showPushNotification bool, clientType PairClientType, ...) (string, error) + func (cli *Client) ParseWebMessage(chatJID types.JID, webMsg *waProto.WebMessageInfo) (*events.Message, error) + func (cli *Client) RejectCall(callFrom types.JID, callID string) error + func (cli *Client) RemoveEventHandler(id uint32) bool + func (cli *Client) RemoveEventHandlers() + func (cli *Client) ResolveBusinessMessageLink(code string) (*types.BusinessMessageLinkTarget, error) + func (cli *Client) ResolveContactQRLink(code string) (*types.ContactQRLinkTarget, error) + func (cli *Client) RevokeMessage(chat types.JID, id types.MessageID) (SendResponse, error) + func (cli *Client) SendAppState(patch appstate.PatchInfo) error + func (cli *Client) SendChatPresence(jid types.JID, state types.ChatPresence, media types.ChatPresenceMedia) error + func (cli *Client) SendFBMessage(ctx context.Context, to types.JID, message armadillo.RealMessageApplicationSub, ...) (resp SendResponse, err error) + func (cli *Client) SendMediaRetryReceipt(message *types.MessageInfo, mediaKey []byte) error + func (cli *Client) SendMessage(ctx context.Context, to types.JID, message *waE2E.Message, ...) (resp SendResponse, err error) + func (cli *Client) SendPresence(state types.Presence) error + func (cli *Client) SetDefaultDisappearingTimer(timer time.Duration) (err error) + func (cli *Client) SetDisappearingTimer(chat types.JID, timer time.Duration) (err error) + func (cli *Client) SetForceActiveDeliveryReceipts(active bool) + func (cli *Client) SetGroupAnnounce(jid types.JID, announce bool) error + func (cli *Client) SetGroupDescription(jid types.JID, description string) error + func (cli *Client) SetGroupJoinApprovalMode(jid types.JID, mode bool) error + func (cli *Client) SetGroupLocked(jid types.JID, locked bool) error + func (cli *Client) SetGroupMemberAddMode(jid types.JID, mode types.GroupMemberAddMode) error + func (cli *Client) SetGroupName(jid types.JID, name string) error + func (cli *Client) SetGroupPhoto(jid types.JID, avatar []byte) (string, error) + func (cli *Client) SetGroupTopic(jid types.JID, previousID, newID, topic string) error + func (cli *Client) SetPassive(passive bool) error + func (cli *Client) SetPrivacySetting(name types.PrivacySettingType, value types.PrivacySetting) (settings types.PrivacySettings, err error) + func (cli *Client) SetProxy(proxy Proxy, opts ...SetProxyOptions) + func (cli *Client) SetProxyAddress(addr string, opts ...SetProxyOptions) error + func (cli *Client) SetSOCKSProxy(px proxy.Dialer, opts ...SetProxyOptions) + func (cli *Client) SetStatusMessage(msg string) error + func (cli *Client) SubscribePresence(jid types.JID) error + func (cli *Client) ToggleProxyOnlyForLogin(only bool) + func (cli *Client) TryFetchPrivacySettings(ignoreCache bool) (*types.PrivacySettings, error) + func (cli *Client) UnfollowNewsletter(jid types.JID) error + func (cli *Client) UnlinkGroup(parent, child types.JID) error + func (cli *Client) UpdateBlocklist(jid types.JID, action events.BlocklistChangeAction) (*types.Blocklist, error) + func (cli *Client) UpdateGroupParticipants(jid types.JID, participantChanges []types.JID, action ParticipantChange) ([]types.GroupParticipant, error) + func (cli *Client) UpdateGroupRequestParticipants(jid types.JID, participantChanges []types.JID, action ParticipantRequestChange) ([]types.GroupParticipant, error) + func (cli *Client) Upload(ctx context.Context, plaintext []byte, appInfo MediaType) (resp UploadResponse, err error) + func (cli *Client) UploadNewsletter(ctx context.Context, data []byte, appInfo MediaType) (resp UploadResponse, err error) + func (cli *Client) UploadNewsletterReader(ctx context.Context, data io.ReadSeeker, appInfo MediaType) (resp UploadResponse, err error) + func (cli *Client) UploadReader(ctx context.Context, plaintext io.Reader, tempFile io.ReadWriteSeeker, ...) (resp UploadResponse, err error) + func (cli *Client) WaitForConnection(timeout time.Duration) bool + type CreateNewsletterParams struct + Description string + Name string + Picture []byte + type DangerousInfoQuery = infoQuery + type DangerousInfoQueryType = infoQueryType + type DangerousInternalClient struct + func (int *DangerousInternalClient) CancelResponse(reqID string, ch chan *waBinary.Node) + func (int *DangerousInternalClient) DecryptDM(child *waBinary.Node, from types.JID, isPreKey bool) ([]byte, error) + func (int *DangerousInternalClient) EncryptMessageForDevice(plaintext []byte, to types.JID, bundle *prekey.Bundle, ...) (*waBinary.Node, bool, error) + func (int *DangerousInternalClient) GetOwnID() types.JID + func (int *DangerousInternalClient) GetServerPreKeyCount() (int, error) + func (int *DangerousInternalClient) MakeDeviceIdentityNode() waBinary.Node + func (int *DangerousInternalClient) QueryMediaConn() (*MediaConn, error) + func (int *DangerousInternalClient) RefreshMediaConn(force bool) (*MediaConn, error) + func (int *DangerousInternalClient) RequestAppStateKeys(ctx context.Context, keyIDs [][]byte) + func (int *DangerousInternalClient) SendIQ(query DangerousInfoQuery) (*waBinary.Node, error) + func (int *DangerousInternalClient) SendIQAsync(query DangerousInfoQuery) (<-chan *waBinary.Node, error) + func (int *DangerousInternalClient) SendNode(node waBinary.Node) error + func (int *DangerousInternalClient) SendRetryReceipt(node *waBinary.Node, info *types.MessageInfo, forceIncludeIdentity bool) + func (int *DangerousInternalClient) WaitResponse(reqID string) chan *waBinary.Node + type DisconnectedError struct + Action string + Node *waBinary.Node + func (err *DisconnectedError) Error() string + func (err *DisconnectedError) Is(other error) bool + type DownloadHTTPError struct + func (dhe DownloadHTTPError) Error() string + func (dhe DownloadHTTPError) Is(other error) bool + type DownloadableMessage interface + GetDirectPath func() string + GetFileEncSHA256 func() []byte + GetFileSHA256 func() []byte + GetMediaKey func() []byte + type DownloadableThumbnail interface + GetMediaKey func() []byte + GetThumbnailDirectPath func() string + GetThumbnailEncSHA256 func() []byte + GetThumbnailSHA256 func() []byte + type ElementMissingError struct + In string + Tag string + func (eme *ElementMissingError) Error() string + type EventHandler func(evt interface{}) + type File interface + Stat func() (os.FileInfo, error) + Truncate func(size int64) error + type GetNewsletterMessagesParams struct + Before types.MessageServerID + Count int + type GetNewsletterUpdatesParams struct + After types.MessageServerID + Count int + Since time.Time + type GetProfilePictureParams struct + ExistingID string + IsCommunity bool + Preview bool + type IQError struct + Code int + ErrorNode *waBinary.Node + RawNode *waBinary.Node + Text string + func (iqe *IQError) Error() string + func (iqe *IQError) Is(other error) bool + type MediaConn struct + Auth string + AuthTTL int + FetchedAt time.Time + Hosts []MediaConnHost + MaxBuckets int + TTL int + func (mc *MediaConn) Expiry() time.Time + type MediaConnHost struct + Hostname string + type MediaType string + const MediaAppState + const MediaAudio + const MediaDocument + const MediaHistory + const MediaImage + const MediaLinkThumbnail + const MediaVideo + func GetMediaType(msg DownloadableMessage) MediaType + type MessageDebugTimings struct + GetDevices time.Duration + GetParticipants time.Duration + GroupEncrypt time.Duration + Marshal time.Duration + PeerEncrypt time.Duration + Queue time.Duration + Resp time.Duration + Retry time.Duration + Send time.Duration + func (mdt MessageDebugTimings) MarshalZerologObject(evt *zerolog.Event) + type MessengerConfig struct + BaseURL string + UserAgent string + type MsgSecretType string + const EncSecretBotMsg + const EncSecretPollVote + const EncSecretReaction + type PairClientType int + const PairClientChrome + const PairClientEdge + const PairClientElectron + const PairClientFirefox + const PairClientIE + const PairClientOpera + const PairClientOtherWebClient + const PairClientSafari + const PairClientUWP + const PairClientUnknown + type PairDatabaseError struct + DBErr error + Message string + func (err *PairDatabaseError) Error() string + func (err *PairDatabaseError) Unwrap() error + type PairProtoError struct + Message string + ProtoErr error + func (err *PairProtoError) Error() string + func (err *PairProtoError) Unwrap() error + type ParticipantChange string + const ParticipantChangeAdd + const ParticipantChangeDemote + const ParticipantChangePromote + const ParticipantChangeRemove + type ParticipantRequestChange string + const ParticipantChangeApprove + const ParticipantChangeReject + type Proxy = func(*http.Request) (*url.URL, error) + type QRChannelItem struct + Code string + Error error + Event string + Timeout time.Duration + type RecentMessage struct + func (rm RecentMessage) IsEmpty() bool + type ReqCreateGroup struct + CreateKey types.MessageID + Name string + Participants []types.JID + type SendRequestExtra struct + ID types.MessageID + InlineBotJID types.JID + MediaHandle string + Peer bool + Timeout time.Duration + type SendResponse struct + DebugTimings MessageDebugTimings + ID types.MessageID + ServerID types.MessageServerID + Timestamp time.Time + type SetProxyOptions struct + NoMedia bool + NoWebsocket bool + type UploadResponse struct + DirectPath string + FileEncSHA256 []byte + FileLength uint64 + FileSHA256 []byte + Handle string + MediaKey []byte + ObjectID string + URL string + type UsyncQueryExtras struct + BotListInfo []types.BotListInfo Other modules containing this package github.com/snaril/wsapp/v2