4
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2025-07-11 17:46:27 +00:00

Update vendor (#1498)

This commit is contained in:
Wim
2021-05-30 00:25:30 +02:00
committed by GitHub
parent 766f35554e
commit 4091b6f6b4
443 changed files with 33181 additions and 6411 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,12 @@
syntax = "proto2";
package proto;
message PaymentMoney {
optional int64 value = 1;
optional uint32 offset = 2;
optional string currencyCode = 3;
}
message HydratedQuickReplyButton {
optional string displayText = 1;
optional string id = 2;
@ -69,18 +75,46 @@ message InteractiveAnnotation {
}
}
message DeviceListMetadata {
optional bytes senderKeyHash = 1;
optional uint64 senderTimestamp = 2;
optional bytes recipientKeyHash = 8;
optional uint64 recipientTimestamp = 9;
}
message MessageContextInfo {
optional DeviceListMetadata deviceListMetadata = 1;
}
message AdReplyInfo {
optional string advertiserName = 1;
enum AD_REPLY_INFO_MEDIATYPE {
enum AdReplyInfoMediaType {
NONE = 0;
IMAGE = 1;
VIDEO = 2;
}
optional AD_REPLY_INFO_MEDIATYPE mediaType = 2;
optional AdReplyInfoMediaType mediaType = 2;
optional bytes jpegThumbnail = 16;
optional string caption = 17;
}
message ExternalAdReplyInfo {
optional string title = 1;
optional string body = 2;
enum ExternalAdReplyInfoMediaType {
NONE = 0;
IMAGE = 1;
VIDEO = 2;
}
optional ExternalAdReplyInfoMediaType mediaType = 3;
optional string thumbnailUrl = 4;
optional string mediaUrl = 5;
optional bytes thumbnail = 6;
optional string sourceType = 7;
optional string sourceId = 8;
optional string sourceUrl = 9;
}
message ContextInfo {
optional string stanzaId = 1;
optional string participant = 2;
@ -96,6 +130,8 @@ message ContextInfo {
optional MessageKey placeholderKey = 24;
optional uint32 expiration = 25;
optional int64 ephemeralSettingTimestamp = 26;
optional bytes ephemeralSharedSecret = 27;
optional ExternalAdReplyInfo externalAdReply = 28;
}
message SenderKeyDistributionMessage {
@ -125,6 +161,27 @@ message ImageMessage {
repeated uint32 scanLengths = 22;
optional bytes midQualityFileSha256 = 23;
optional bytes midQualityFileEncSha256 = 24;
optional bool viewOnce = 25;
optional string thumbnailDirectPath = 26;
optional bytes thumbnailSha256 = 27;
optional bytes thumbnailEncSha256 = 28;
}
message InvoiceMessage {
optional string note = 1;
optional string token = 2;
enum InvoiceMessageAttachmentType {
IMAGE = 0;
PDF = 1;
}
optional InvoiceMessageAttachmentType attachmentType = 3;
optional string attachmentMimetype = 4;
optional bytes attachmentMediaKey = 5;
optional int64 attachmentMediaKeyTimestamp = 6;
optional bytes attachmentFileSha256 = 7;
optional bytes attachmentFileEncSha256 = 8;
optional string attachmentDirectPath = 9;
optional bytes attachmentJpegThumbnail = 10;
}
message ContactMessage {
@ -156,7 +213,7 @@ message ExtendedTextMessage {
optional string title = 6;
optional fixed32 textArgb = 7;
optional fixed32 backgroundArgb = 8;
enum EXTENDED_TEXT_MESSAGE_FONTTYPE {
enum ExtendedTextMessageFontType {
SANS_SERIF = 0;
SERIF = 1;
NORICAN_REGULAR = 2;
@ -164,12 +221,12 @@ message ExtendedTextMessage {
BEBASNEUE_REGULAR = 4;
OSWALD_HEAVY = 5;
}
optional EXTENDED_TEXT_MESSAGE_FONTTYPE font = 9;
enum EXTENDED_TEXT_MESSAGE_PREVIEWTYPE {
optional ExtendedTextMessageFontType font = 9;
enum ExtendedTextMessagePreviewType {
NONE = 0;
VIDEO = 1;
}
optional EXTENDED_TEXT_MESSAGE_PREVIEWTYPE previewType = 10;
optional ExtendedTextMessagePreviewType previewType = 10;
optional bytes jpegThumbnail = 16;
optional ContextInfo contextInfo = 17;
optional bool doNotPlayInline = 18;
@ -187,8 +244,14 @@ message DocumentMessage {
optional bytes fileEncSha256 = 9;
optional string directPath = 10;
optional int64 mediaKeyTimestamp = 11;
optional bool contactVcard = 12;
optional string thumbnailDirectPath = 13;
optional bytes thumbnailSha256 = 14;
optional bytes thumbnailEncSha256 = 15;
optional bytes jpegThumbnail = 16;
optional ContextInfo contextInfo = 17;
optional uint32 thumbnailHeight = 18;
optional uint32 thumbnailWidth = 19;
}
message AudioMessage {
@ -224,12 +287,16 @@ message VideoMessage {
optional bytes jpegThumbnail = 16;
optional ContextInfo contextInfo = 17;
optional bytes streamingSidecar = 18;
enum VIDEO_MESSAGE_ATTRIBUTION {
enum VideoMessageAttribution {
NONE = 0;
GIPHY = 1;
TENOR = 2;
}
optional VIDEO_MESSAGE_ATTRIBUTION gifAttribution = 19;
optional VideoMessageAttribution gifAttribution = 19;
optional bool viewOnce = 20;
optional string thumbnailDirectPath = 21;
optional bytes thumbnailSha256 = 22;
optional bytes thumbnailEncSha256 = 23;
}
message Call {
@ -243,16 +310,25 @@ message Chat {
message ProtocolMessage {
optional MessageKey key = 1;
enum PROTOCOL_MESSAGE_TYPE {
enum ProtocolMessageType {
REVOKE = 0;
EPHEMERAL_SETTING = 3;
EPHEMERAL_SYNC_RESPONSE = 4;
HISTORY_SYNC_NOTIFICATION = 5;
APP_STATE_SYNC_KEY_SHARE = 6;
APP_STATE_SYNC_KEY_REQUEST = 7;
MSG_FANOUT_BACKFILL_REQUEST = 8;
INITIAL_SECURITY_NOTIFICATION_SETTING_SYNC = 9;
APP_STATE_FATAL_EXCEPTION_NOTIFICATION = 10;
}
optional PROTOCOL_MESSAGE_TYPE type = 2;
optional ProtocolMessageType type = 2;
optional uint32 ephemeralExpiration = 4;
optional int64 ephemeralSettingTimestamp = 5;
optional HistorySyncNotification historySyncNotification = 6;
optional AppStateSyncKeyShare appStateSyncKeyShare = 7;
optional AppStateSyncKeyRequest appStateSyncKeyRequest = 8;
optional InitialSecurityNotificationSettingSync initialSecurityNotificationSettingSync = 9;
optional AppStateFatalExceptionNotification appStateFatalExceptionNotification = 10;
}
message HistorySyncNotification {
@ -261,14 +337,54 @@ message HistorySyncNotification {
optional bytes mediaKey = 3;
optional bytes fileEncSha256 = 4;
optional string directPath = 5;
enum HISTORY_SYNC_NOTIFICATION_HISTORYSYNCTYPE {
enum HistorySyncNotificationHistorySyncType {
INITIAL_BOOTSTRAP = 0;
INITIAL_STATUS_V3 = 1;
FULL = 2;
RECENT = 3;
PUSH_NAME = 4;
}
optional HISTORY_SYNC_NOTIFICATION_HISTORYSYNCTYPE syncType = 6;
optional HistorySyncNotificationHistorySyncType syncType = 6;
optional uint32 chunkOrder = 7;
optional string originalMessageId = 8;
}
message AppStateSyncKey {
optional AppStateSyncKeyId keyId = 1;
optional AppStateSyncKeyData keyData = 2;
}
message AppStateSyncKeyId {
optional bytes keyId = 1;
}
message AppStateSyncKeyFingerprint {
optional uint32 rawId = 1;
optional uint32 currentIndex = 2;
repeated uint32 deviceIndexes = 3 [packed=true];
}
message AppStateSyncKeyData {
optional bytes keyData = 1;
optional AppStateSyncKeyFingerprint fingerprint = 2;
optional int64 timestamp = 3;
}
message AppStateSyncKeyShare {
repeated AppStateSyncKey keys = 1;
}
message AppStateSyncKeyRequest {
repeated AppStateSyncKeyId keyIds = 1;
}
message AppStateFatalExceptionNotification {
repeated string collectionNames = 1;
optional int64 timestamp = 2;
}
message InitialSecurityNotificationSettingSync {
optional bool securityNotificationEnabled = 1;
}
message ContactsArrayMessage {
@ -283,7 +399,7 @@ message HSMCurrency {
}
message HSMDateTimeComponent {
enum HSM_DATE_TIME_COMPONENT_DAYOFWEEKTYPE {
enum HSMDateTimeComponentDayOfWeekType {
MONDAY = 1;
TUESDAY = 2;
WEDNESDAY = 3;
@ -292,17 +408,17 @@ message HSMDateTimeComponent {
SATURDAY = 6;
SUNDAY = 7;
}
optional HSM_DATE_TIME_COMPONENT_DAYOFWEEKTYPE dayOfWeek = 1;
optional HSMDateTimeComponentDayOfWeekType dayOfWeek = 1;
optional uint32 year = 2;
optional uint32 month = 3;
optional uint32 dayOfMonth = 4;
optional uint32 hour = 5;
optional uint32 minute = 6;
enum HSM_DATE_TIME_COMPONENT_CALENDARTYPE {
enum HSMDateTimeComponentCalendarType {
GREGORIAN = 1;
SOLAR_HIJRI = 2;
}
optional HSM_DATE_TIME_COMPONENT_CALENDARTYPE calendar = 7;
optional HSMDateTimeComponentCalendarType calendar = 7;
}
message HSMDateTimeUnixEpoch {
@ -347,6 +463,7 @@ message RequestPaymentMessage {
optional uint64 amount1000 = 2;
optional string requestFrom = 3;
optional int64 expiryTimestamp = 5;
optional PaymentMoney amount = 6;
}
message DeclinePaymentRequestMessage {
@ -457,6 +574,66 @@ message ProductMessage {
optional ContextInfo contextInfo = 17;
}
message OrderMessage {
optional string orderId = 1;
optional bytes thumbnail = 2;
optional int32 itemCount = 3;
enum OrderMessageOrderStatus {
INQUIRY = 1;
}
optional OrderMessageOrderStatus status = 4;
enum OrderMessageOrderSurface {
CATALOG = 1;
}
optional OrderMessageOrderSurface surface = 5;
optional string message = 6;
optional string orderTitle = 7;
optional string sellerJid = 8;
optional string token = 9;
optional int64 totalAmount1000 = 10;
optional string totalCurrencyCode = 11;
optional ContextInfo contextInfo = 17;
}
message Row {
optional string title = 1;
optional string description = 2;
optional string rowId = 3;
}
message Section {
optional string title = 1;
repeated Row rows = 2;
}
message ListMessage {
optional string title = 1;
optional string description = 2;
optional string buttonText = 3;
enum ListMessageListType {
UNKNOWN = 0;
SINGLE_SELECT = 1;
}
optional ListMessageListType listType = 4;
repeated Section sections = 5;
}
message SingleSelectReply {
optional string selectedRowId = 1;
}
message ListResponseMessage {
optional string title = 1;
enum ListResponseMessageListType {
UNKNOWN = 0;
SINGLE_SELECT = 1;
}
optional ListResponseMessageListType listType = 2;
optional SingleSelectReply singleSelectReply = 3;
optional ContextInfo contextInfo = 4;
optional string description = 5;
}
message GroupInviteMessage {
optional string groupJid = 1;
optional string inviteCode = 2;
@ -467,13 +644,72 @@ message GroupInviteMessage {
optional ContextInfo contextInfo = 7;
}
message EphemeralSetting {
optional string chatJid = 1;
optional uint32 ephemeralExpiration = 2;
optional int64 ephemeralSettingTimestamp = 3;
}
message DeviceSentMessage {
optional string destinationJid = 1;
optional Message message = 2;
optional string phash = 3;
repeated EphemeralSetting broadcastEphemeralSettings = 4;
}
message DeviceSyncMessage {
optional bytes serializedXmlBytes = 1;
message FutureProofMessage {
optional Message message = 1;
}
message ButtonText {
optional string displayText = 1;
}
message Button {
optional string buttonId = 1;
optional ButtonText buttonText = 2;
enum ButtonType {
UNKNOWN = 0;
RESPONSE = 1;
}
optional ButtonType type = 3;
}
message ButtonsMessage {
optional string contentText = 6;
optional string footerText = 7;
optional ContextInfo contextInfo = 8;
repeated Button buttons = 9;
enum ButtonsMessageHeaderType {
UNKNOWN = 0;
EMPTY = 1;
TEXT = 2;
DOCUMENT = 3;
IMAGE = 4;
VIDEO = 5;
LOCATION = 6;
}
optional ButtonsMessageHeaderType headerType = 10;
oneof header {
string text = 1;
DocumentMessage documentMessage = 2;
ImageMessage imageMessage = 3;
VideoMessage videoMessage = 4;
LocationMessage locationMessage = 5;
}
}
message ButtonsResponseMessage {
optional string selectedButtonId = 1;
optional ContextInfo contextInfo = 3;
enum ButtonsResponseMessageType {
UNKNOWN = 0;
DISPLAY_TEXT = 1;
}
optional ButtonsResponseMessageType type = 4;
oneof response {
string selectedDisplayText = 2;
}
}
message Message {
@ -503,7 +739,15 @@ message Message {
optional TemplateButtonReplyMessage templateButtonReplyMessage = 29;
optional ProductMessage productMessage = 30;
optional DeviceSentMessage deviceSentMessage = 31;
optional DeviceSyncMessage deviceSyncMessage = 32;
optional MessageContextInfo messageContextInfo = 35;
optional ListMessage listMessage = 36;
optional FutureProofMessage viewOnceMessage = 37;
optional OrderMessage orderMessage = 38;
optional ListResponseMessage listResponseMessage = 39;
optional FutureProofMessage ephemeralMessage = 40;
optional InvoiceMessage invoiceMessage = 41;
optional ButtonsMessage buttonsMessage = 42;
optional ButtonsResponseMessage buttonsResponseMessage = 43;
}
message MessageKey {
@ -514,51 +758,52 @@ message MessageKey {
}
message WebFeatures {
enum WEB_FEATURES_FLAG {
enum WebFeaturesFlag {
NOT_STARTED = 0;
FORCE_UPGRADE = 1;
DEVELOPMENT = 2;
PRODUCTION = 3;
}
optional WEB_FEATURES_FLAG labelsDisplay = 1;
optional WEB_FEATURES_FLAG voipIndividualOutgoing = 2;
optional WEB_FEATURES_FLAG groupsV3 = 3;
optional WEB_FEATURES_FLAG groupsV3Create = 4;
optional WEB_FEATURES_FLAG changeNumberV2 = 5;
optional WEB_FEATURES_FLAG queryStatusV3Thumbnail = 6;
optional WEB_FEATURES_FLAG liveLocations = 7;
optional WEB_FEATURES_FLAG queryVname = 8;
optional WEB_FEATURES_FLAG voipIndividualIncoming = 9;
optional WEB_FEATURES_FLAG quickRepliesQuery = 10;
optional WEB_FEATURES_FLAG payments = 11;
optional WEB_FEATURES_FLAG stickerPackQuery = 12;
optional WEB_FEATURES_FLAG liveLocationsFinal = 13;
optional WEB_FEATURES_FLAG labelsEdit = 14;
optional WEB_FEATURES_FLAG mediaUpload = 15;
optional WEB_FEATURES_FLAG mediaUploadRichQuickReplies = 18;
optional WEB_FEATURES_FLAG vnameV2 = 19;
optional WEB_FEATURES_FLAG videoPlaybackUrl = 20;
optional WEB_FEATURES_FLAG statusRanking = 21;
optional WEB_FEATURES_FLAG voipIndividualVideo = 22;
optional WEB_FEATURES_FLAG thirdPartyStickers = 23;
optional WEB_FEATURES_FLAG frequentlyForwardedSetting = 24;
optional WEB_FEATURES_FLAG groupsV4JoinPermission = 25;
optional WEB_FEATURES_FLAG recentStickers = 26;
optional WEB_FEATURES_FLAG catalog = 27;
optional WEB_FEATURES_FLAG starredStickers = 28;
optional WEB_FEATURES_FLAG voipGroupCall = 29;
optional WEB_FEATURES_FLAG templateMessage = 30;
optional WEB_FEATURES_FLAG templateMessageInteractivity = 31;
optional WEB_FEATURES_FLAG ephemeralMessages = 32;
optional WEB_FEATURES_FLAG e2ENotificationSync = 33;
optional WEB_FEATURES_FLAG recentStickersV2 = 34;
}
message TabletNotificationsInfo {
optional uint64 timestamp = 2;
optional uint32 unreadChats = 3;
optional uint32 notifyMessageCount = 4;
repeated NotificationMessageInfo notifyMessage = 5;
optional WebFeaturesFlag labelsDisplay = 1;
optional WebFeaturesFlag voipIndividualOutgoing = 2;
optional WebFeaturesFlag groupsV3 = 3;
optional WebFeaturesFlag groupsV3Create = 4;
optional WebFeaturesFlag changeNumberV2 = 5;
optional WebFeaturesFlag queryStatusV3Thumbnail = 6;
optional WebFeaturesFlag liveLocations = 7;
optional WebFeaturesFlag queryVname = 8;
optional WebFeaturesFlag voipIndividualIncoming = 9;
optional WebFeaturesFlag quickRepliesQuery = 10;
optional WebFeaturesFlag payments = 11;
optional WebFeaturesFlag stickerPackQuery = 12;
optional WebFeaturesFlag liveLocationsFinal = 13;
optional WebFeaturesFlag labelsEdit = 14;
optional WebFeaturesFlag mediaUpload = 15;
optional WebFeaturesFlag mediaUploadRichQuickReplies = 18;
optional WebFeaturesFlag vnameV2 = 19;
optional WebFeaturesFlag videoPlaybackUrl = 20;
optional WebFeaturesFlag statusRanking = 21;
optional WebFeaturesFlag voipIndividualVideo = 22;
optional WebFeaturesFlag thirdPartyStickers = 23;
optional WebFeaturesFlag frequentlyForwardedSetting = 24;
optional WebFeaturesFlag groupsV4JoinPermission = 25;
optional WebFeaturesFlag recentStickers = 26;
optional WebFeaturesFlag catalog = 27;
optional WebFeaturesFlag starredStickers = 28;
optional WebFeaturesFlag voipGroupCall = 29;
optional WebFeaturesFlag templateMessage = 30;
optional WebFeaturesFlag templateMessageInteractivity = 31;
optional WebFeaturesFlag ephemeralMessages = 32;
optional WebFeaturesFlag e2ENotificationSync = 33;
optional WebFeaturesFlag recentStickersV2 = 34;
optional WebFeaturesFlag syncdRelease1 = 35;
optional WebFeaturesFlag recentStickersV3 = 36;
optional WebFeaturesFlag userNotice = 37;
optional WebFeaturesFlag syncdRelease11 = 38;
optional WebFeaturesFlag support = 39;
optional WebFeaturesFlag groupUiiCleanup = 40;
optional WebFeaturesFlag groupDogfoodingInternalOnly = 41;
optional WebFeaturesFlag settingsSync = 42;
}
message NotificationMessageInfo {
@ -576,14 +821,14 @@ message WebNotificationsInfo {
}
message PaymentInfo {
enum PAYMENT_INFO_CURRENCY {
enum PaymentInfoCurrency {
UNKNOWN_CURRENCY = 0;
INR = 1;
}
optional PAYMENT_INFO_CURRENCY currencyDeprecated = 1;
optional PaymentInfoCurrency currencyDeprecated = 1;
optional uint64 amount1000 = 2;
optional string receiverJid = 3;
enum PAYMENT_INFO_STATUS {
enum PaymentInfoStatus {
UNKNOWN_STATUS = 0;
PROCESSING = 1;
SENT = 2;
@ -597,13 +842,13 @@ message PaymentInfo {
WAITING_FOR_PAYER = 10;
WAITING = 11;
}
optional PAYMENT_INFO_STATUS status = 4;
optional PaymentInfoStatus status = 4;
optional uint64 transactionTimestamp = 5;
optional MessageKey requestMessageKey = 6;
optional uint64 expiryTimestamp = 7;
optional bool futureproofed = 8;
optional string currency = 9;
enum PAYMENT_INFO_TXNSTATUS {
enum PaymentInfoTxnStatus {
UNKNOWN = 0;
PENDING_SETUP = 1;
PENDING_RECEIVER_SETUP = 2;
@ -633,14 +878,17 @@ message PaymentInfo {
COLLECT_CANCELED = 26;
COLLECT_CANCELLING = 27;
}
optional PAYMENT_INFO_TXNSTATUS txnStatus = 10;
optional PaymentInfoTxnStatus txnStatus = 10;
optional bool useNoviFiatFormat = 11;
optional PaymentMoney primaryAmount = 12;
optional PaymentMoney exchangeAmount = 13;
}
message WebMessageInfo {
required MessageKey key = 1;
optional Message message = 2;
optional uint64 messageTimestamp = 3;
enum WEB_MESSAGE_INFO_STATUS {
enum WebMessageInfoStatus {
ERROR = 0;
PENDING = 1;
SERVER_ACK = 2;
@ -648,7 +896,7 @@ message WebMessageInfo {
READ = 4;
PLAYED = 5;
}
optional WEB_MESSAGE_INFO_STATUS status = 4;
optional WebMessageInfoStatus status = 4;
optional string participant = 5;
optional bool ignore = 16;
optional bool starred = 17;
@ -658,7 +906,7 @@ message WebMessageInfo {
optional bool multicast = 21;
optional bool urlText = 22;
optional bool urlNumber = 23;
enum WEB_MESSAGE_INFO_STUBTYPE {
enum WebMessageInfoStubType {
UNKNOWN = 0;
REVOKE = 1;
CIPHERTEXT = 2;
@ -732,8 +980,54 @@ message WebMessageInfo {
GROUP_V4_ADD_INVITE_SENT = 70;
GROUP_PARTICIPANT_ADD_REQUEST_JOIN = 71;
CHANGE_EPHEMERAL_SETTING = 72;
E2E_DEVICE_CHANGED = 73;
VIEWED_ONCE = 74;
E2E_ENCRYPTED_NOW = 75;
BLUE_MSG_BSP_FB_TO_BSP_PREMISE = 76;
BLUE_MSG_BSP_FB_TO_SELF_FB = 77;
BLUE_MSG_BSP_FB_TO_SELF_PREMISE = 78;
BLUE_MSG_BSP_FB_UNVERIFIED = 79;
BLUE_MSG_BSP_FB_UNVERIFIED_TO_SELF_PREMISE_VERIFIED = 80;
BLUE_MSG_BSP_FB_VERIFIED = 81;
BLUE_MSG_BSP_FB_VERIFIED_TO_SELF_PREMISE_UNVERIFIED = 82;
BLUE_MSG_BSP_PREMISE_TO_SELF_PREMISE = 83;
BLUE_MSG_BSP_PREMISE_UNVERIFIED = 84;
BLUE_MSG_BSP_PREMISE_UNVERIFIED_TO_SELF_PREMISE_VERIFIED = 85;
BLUE_MSG_BSP_PREMISE_VERIFIED = 86;
BLUE_MSG_BSP_PREMISE_VERIFIED_TO_SELF_PREMISE_UNVERIFIED = 87;
BLUE_MSG_CONSUMER_TO_BSP_FB_UNVERIFIED = 88;
BLUE_MSG_CONSUMER_TO_BSP_PREMISE_UNVERIFIED = 89;
BLUE_MSG_CONSUMER_TO_SELF_FB_UNVERIFIED = 90;
BLUE_MSG_CONSUMER_TO_SELF_PREMISE_UNVERIFIED = 91;
BLUE_MSG_SELF_FB_TO_BSP_PREMISE = 92;
BLUE_MSG_SELF_FB_TO_SELF_PREMISE = 93;
BLUE_MSG_SELF_FB_UNVERIFIED = 94;
BLUE_MSG_SELF_FB_UNVERIFIED_TO_SELF_PREMISE_VERIFIED = 95;
BLUE_MSG_SELF_FB_VERIFIED = 96;
BLUE_MSG_SELF_FB_VERIFIED_TO_SELF_PREMISE_UNVERIFIED = 97;
BLUE_MSG_SELF_PREMISE_TO_BSP_PREMISE = 98;
BLUE_MSG_SELF_PREMISE_UNVERIFIED = 99;
BLUE_MSG_SELF_PREMISE_VERIFIED = 100;
BLUE_MSG_TO_BSP_FB = 101;
BLUE_MSG_TO_CONSUMER = 102;
BLUE_MSG_TO_SELF_FB = 103;
BLUE_MSG_UNVERIFIED_TO_BSP_FB_VERIFIED = 104;
BLUE_MSG_UNVERIFIED_TO_BSP_PREMISE_VERIFIED = 105;
BLUE_MSG_UNVERIFIED_TO_SELF_FB_VERIFIED = 106;
BLUE_MSG_UNVERIFIED_TO_VERIFIED = 107;
BLUE_MSG_VERIFIED_TO_BSP_FB_UNVERIFIED = 108;
BLUE_MSG_VERIFIED_TO_BSP_PREMISE_UNVERIFIED = 109;
BLUE_MSG_VERIFIED_TO_SELF_FB_UNVERIFIED = 110;
BLUE_MSG_VERIFIED_TO_UNVERIFIED = 111;
BLUE_MSG_BSP_FB_UNVERIFIED_TO_BSP_PREMISE_VERIFIED = 112;
BLUE_MSG_BSP_FB_UNVERIFIED_TO_SELF_FB_VERIFIED = 113;
BLUE_MSG_BSP_FB_VERIFIED_TO_BSP_PREMISE_UNVERIFIED = 114;
BLUE_MSG_BSP_FB_VERIFIED_TO_SELF_FB_UNVERIFIED = 115;
BLUE_MSG_SELF_FB_UNVERIFIED_TO_BSP_PREMISE_VERIFIED = 116;
BLUE_MSG_SELF_FB_VERIFIED_TO_BSP_PREMISE_UNVERIFIED = 117;
E2E_IDENTITY_UNAVAILABLE = 118;
}
optional WEB_MESSAGE_INFO_STUBTYPE messageStubType = 24;
optional WebMessageInfoStubType messageStubType = 24;
optional bool clearMedia = 25;
repeated string messageStubParameters = 26;
optional uint32 duration = 27;
@ -743,5 +1037,14 @@ message WebMessageInfo {
optional PaymentInfo quotedPaymentInfo = 31;
optional uint64 ephemeralStartTimestamp = 32;
optional uint32 ephemeralDuration = 33;
}
optional bool ephemeralOffToOn = 34;
optional bool ephemeralOutOfSync = 35;
enum WebMessageInfoBizPrivacyStatus {
E2EE = 0;
FB = 2;
BSP = 1;
BSP_AND_FB = 3;
}
optional WebMessageInfoBizPrivacyStatus bizPrivacyStatus = 36;
optional string verifiedBizName = 37;
}

View File

@ -286,3 +286,37 @@ func (wac *Conn) handleBlockContact(action, jid string) (<-chan string, error) {
return wac.writeBinary(n, contact, ignore, tag)
}
// Search product details on order
func (wac *Conn) SearchProductDetails(id, orderId, token string) (<-chan string, error) {
data := []interface{}{"query", "order", map[string]string{
"id": id,
"orderId": orderId,
"imageHeight": strconv.Itoa(80),
"imageWidth": strconv.Itoa(80),
"token": token,
}}
return wac.writeJson(data)
}
// Order search and get product catalog reh
func (wac *Conn) SearchOrder(catalogWid, stanzaId string) (<-chan string, error) {
data := []interface{}{"query", "bizCatalog", map[string]string{
"catalogWid": catalogWid,
"limit": strconv.Itoa(10),
"height": strconv.Itoa(100),
"width": strconv.Itoa(100),
"stanza_id": stanzaId,
"type": "get_product_catalog_reh",
}}
return wac.writeJson(data)
}
// Company details for Whatsapp Business
func (wac *Conn) BusinessProfile(wid string) (<-chan string, error) {
query := map[string]string{
"wid": wid,
}
data := []interface{}{"query", "businessProfile", []map[string]string{query}}
return wac.writeJson(data)
}

View File

@ -1,14 +1,11 @@
module github.com/Rhymen/go-whatsapp
require (
github.com/Rhymen/go-whatsapp/examples/echo v0.0.0-20190325075644-cc2581bbf24d // indirect
github.com/Rhymen/go-whatsapp/examples/restoreSession v0.0.0-20190325075644-cc2581bbf24d // indirect
github.com/Rhymen/go-whatsapp/examples/sendImage v0.0.0-20190325075644-cc2581bbf24d // indirect
github.com/Rhymen/go-whatsapp/examples/sendTextMessages v0.0.0-20190325075644-cc2581bbf24d // indirect
github.com/golang/protobuf v1.3.0
github.com/golang/protobuf v1.4.1
github.com/gorilla/websocket v1.4.1
github.com/pkg/errors v0.8.1
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2
google.golang.org/protobuf v1.25.0
)
go 1.13

View File

@ -1,37 +1,71 @@
github.com/Baozisoftware/qrcode-terminal-go v0.0.0-20170407111555-c0650d8dff0f h1:2dk3eOnYllh+wUOuDhOoC2vUVoJF/5z478ryJ+wzEII=
github.com/Baozisoftware/qrcode-terminal-go v0.0.0-20170407111555-c0650d8dff0f/go.mod h1:4a58ifQTEe2uwwsaqbh3i2un5/CBPg+At/qHpt18Tmk=
github.com/Rhymen/go-whatsapp v0.0.0/go.mod h1:rdQr95g2C1xcOfM7QGOhza58HeI3I+tZ/bbluv7VazA=
github.com/Rhymen/go-whatsapp/examples/echo v0.0.0-20190325075644-cc2581bbf24d h1:m3wkrunHupL9XzzM+JZu1pgoDV1d9LFtD0gedNTHVDU=
github.com/Rhymen/go-whatsapp/examples/echo v0.0.0-20190325075644-cc2581bbf24d/go.mod h1:zgCiQtBtZ4P4gFWvwl9aashsdwOcbb/EHOGRmSzM8ME=
github.com/Rhymen/go-whatsapp/examples/restoreSession v0.0.0-20190325075644-cc2581bbf24d h1:muQlzqfZxjptOBjPdv+UoxVMr8Y1rPx7VMGPJIAFc5w=
github.com/Rhymen/go-whatsapp/examples/restoreSession v0.0.0-20190325075644-cc2581bbf24d/go.mod h1:5sCUSpG616ZoSJhlt9iBNI/KXBqrVLcNUJqg7J9+8pU=
github.com/Rhymen/go-whatsapp/examples/sendImage v0.0.0-20190325075644-cc2581bbf24d h1:xP//3V77YvHd1cj2Z3ttuQWAvs5WmIwBbjKe/t0g/tM=
github.com/Rhymen/go-whatsapp/examples/sendImage v0.0.0-20190325075644-cc2581bbf24d/go.mod h1:RdiyhanVEGXTam+mZ3k6Y3VDCCvXYCwReOoxGozqhHw=
github.com/Rhymen/go-whatsapp/examples/sendTextMessages v0.0.0-20190325075644-cc2581bbf24d h1:IRmRE0SPMByczwE2dhnTcVojje3w2TCSKwFrboLUbDg=
github.com/Rhymen/go-whatsapp/examples/sendTextMessages v0.0.0-20190325075644-cc2581bbf24d/go.mod h1:suwzklatySS3Q0+NCxCDh5hYfgXdQUWU1DNcxwAxStM=
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.0 h1:kbxbvI4Un1LUWKxufD+BiE6AEExYYgkQLQmLFqA1LFk=
github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0=
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.1 h1:ZFgWrT+bLgsYPirOnRfKLYJLvssAegOj/hgyMFdJZe0=
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w=
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM=
github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg=
github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ=
github.com/mattn/go-isatty v0.0.5 h1:tHXDdz1cpzGaovsTB+TVB8q90WEokoVmfMqoVcrLUgw=
github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/skip2/go-qrcode v0.0.0-20190110000554-dc11ecdae0a9 h1:lpEzuenPuO1XNTeikEmvqYFcU37GVLl8SRNblzyvGBE=
github.com/skip2/go-qrcode v0.0.0-20190110000554-dc11ecdae0a9/go.mod h1:PLPIyL7ikehBD1OAjmKKiOEhbvWyHGaNDjquXMcYABo=
golang.org/x/crypto v0.0.0-20190131182504-b8fe1690c613/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd h1:nTDtHvHSdCn1m6ITfMRqtOd/9+7a3s8RBNOZ3eYZzJA=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8=
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c=
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=

View File

@ -97,6 +97,22 @@ type ContactMessageHandler interface {
HandleContactMessage(message ContactMessage)
}
/*
The ProductMessageHandler interface needs to be implemented to receive product messages dispatched by the dispatcher.
*/
type ProductMessageHandler interface {
Handler
HandleProductMessage(message ProductMessage)
}
/*
The OrderMessageHandler interface needs to be implemented to receive order messages dispatched by the dispatcher.
*/
type OrderMessageHandler interface {
Handler
HandleOrderMessage(message OrderMessage)
}
/*
The JsonMessageHandler interface needs to be implemented to receive json messages dispatched by the dispatcher.
These json messages contain status updates of every kind sent by WhatsAppWeb servers. WhatsAppWeb uses these messages
@ -301,7 +317,7 @@ func (wac *Conn) handleWithCustomHandlers(message interface{}, handlers []Handle
}
}
}
case BatteryMessage:
for _, h := range handlers {
if x, ok := h.(BatteryMessageHandler); ok {
@ -312,7 +328,7 @@ func (wac *Conn) handleWithCustomHandlers(message interface{}, handlers []Handle
}
}
}
case Contact:
for _, h := range handlers {
if x, ok := h.(NewContactHandler); ok {
@ -324,6 +340,28 @@ func (wac *Conn) handleWithCustomHandlers(message interface{}, handlers []Handle
}
}
case ProductMessage:
for _, h := range handlers {
if x, ok := h.(ProductMessageHandler); ok {
if wac.shouldCallSynchronously(h) {
x.HandleProductMessage(m)
} else {
go x.HandleProductMessage(m)
}
}
}
case OrderMessage:
for _, h := range handlers {
if x, ok := h.(OrderMessageHandler); ok {
if wac.shouldCallSynchronously(h) {
x.HandleOrderMessage(m)
} else {
go x.HandleOrderMessage(m)
}
}
}
case *proto.WebMessageInfo:
for _, h := range handlers {
if x, ok := h.(RawMessageHandler); ok {

View File

@ -65,6 +65,10 @@ func (wac *Conn) Send(msg interface{}) (string, error) {
msgProto = GetLiveLocationProto(m)
case ContactMessage:
msgProto = getContactMessageProto(m)
case ProductMessage:
msgProto = getProductMessageProto(m)
case OrderMessage:
msgProto = getOrderMessageProto(m)
default:
return "ERROR", fmt.Errorf("cannot match type %T, use message types declared in the package", msg)
}
@ -258,7 +262,7 @@ func getInfoProto(info *MessageInfo) *proto.WebMessageInfo {
}
info.FromMe = true
status := proto.WebMessageInfo_WEB_MESSAGE_INFO_STATUS(info.Status)
status := proto.WebMessageInfo_WebMessageInfoStatus(info.Status)
return &proto.WebMessageInfo{
Key: &proto.MessageKey{
@ -802,6 +806,113 @@ func getContactMessageProto(msg ContactMessage) *proto.WebMessageInfo {
return p
}
/*
OrderMessage represents a order message.
*/
type OrderMessage struct {
Info MessageInfo
OrderId string
Thumbnail []byte
ItemCount int32
Status proto.OrderMessage_OrderMessageOrderStatus
Surface proto.OrderMessage_OrderMessageOrderSurface
Message string
OrderTitle string
SellerJid string
Token string
TotalAmount1000 int64
TotalCurrencyCode string
ContextInfo ContextInfo
}
func getOrderMessage(msg *proto.WebMessageInfo) OrderMessage {
order := msg.GetMessage().GetOrderMessage()
orderMessage := OrderMessage{
Info: getMessageInfo(msg),
OrderId: order.GetOrderId(),
Thumbnail: order.GetThumbnail(),
ItemCount: order.GetItemCount(),
Status: order.GetStatus(),
Surface: order.GetSurface(),
Message: order.GetMessage(),
OrderTitle: order.GetOrderTitle(),
SellerJid: order.GetSellerJid(),
Token: order.GetToken(),
TotalAmount1000: order.GetTotalAmount1000(),
TotalCurrencyCode: order.GetTotalCurrencyCode(),
ContextInfo: getMessageContext(order.GetContextInfo()),
}
return orderMessage
}
func getOrderMessageProto(msg OrderMessage) *proto.WebMessageInfo {
p := getInfoProto(&msg.Info)
contextInfo := getContextInfoProto(&msg.ContextInfo)
p.Message = &proto.Message{
OrderMessage: &proto.OrderMessage{
Thumbnail: msg.Thumbnail,
ItemCount: &msg.ItemCount,
Status: &msg.Status,
Surface: &msg.Surface,
Message: &msg.Message,
OrderTitle: &msg.OrderTitle,
SellerJid: &msg.SellerJid,
Token: &msg.Token,
TotalAmount1000: &msg.TotalAmount1000,
TotalCurrencyCode: &msg.TotalCurrencyCode,
ContextInfo: contextInfo,
},
}
return p
}
/*
ProductMessage represents a product message.
*/
type ProductMessage struct {
Info MessageInfo
Product *proto.ProductSnapshot
BusinessOwnerJid string
Catalog *proto.CatalogSnapshot
ContextInfo ContextInfo
}
func getProductMessage(msg *proto.WebMessageInfo) ProductMessage {
prod := msg.GetMessage().GetProductMessage()
productMessage := ProductMessage{
Info: getMessageInfo(msg),
Product: prod.GetProduct(),
BusinessOwnerJid: prod.GetBusinessOwnerJid(),
Catalog: prod.GetCatalog(),
ContextInfo: getMessageContext(prod.GetContextInfo()),
}
return productMessage
}
func getProductMessageProto(msg ProductMessage) *proto.WebMessageInfo {
p := getInfoProto(&msg.Info)
contextInfo := getContextInfoProto(&msg.ContextInfo)
p.Message = &proto.Message{
ProductMessage: &proto.ProductMessage{
Product: msg.Product,
BusinessOwnerJid: &msg.BusinessOwnerJid,
Catalog: msg.Catalog,
ContextInfo: contextInfo,
},
}
return p
}
func ParseProtoMessage(msg *proto.WebMessageInfo) interface{} {
switch {
@ -836,6 +947,12 @@ func ParseProtoMessage(msg *proto.WebMessageInfo) interface{} {
case msg.GetMessage().GetContactMessage() != nil:
return getContactMessage(msg)
case msg.GetMessage().GetProductMessage() != nil:
return getProductMessage(msg)
case msg.GetMessage().GetOrderMessage() != nil:
return getOrderMessage(msg)
default:
//cannot match message
return ErrMessageTypeNotImplemented

View File

@ -2,9 +2,10 @@ package whatsapp
import (
"fmt"
"github.com/Rhymen/go-whatsapp/binary"
"strconv"
"time"
"github.com/Rhymen/go-whatsapp/binary"
)
// Pictures must be JPG 640x640 and 96x96, respectively
@ -41,3 +42,24 @@ func (wac *Conn) UploadProfilePic(image, preview []byte) (<-chan string, error)
}
return wac.writeBinary(n, profile, 136, tag)
}
func (wac *Conn) UpdateProfileName(name string) (<-chan string, error) {
tag := fmt.Sprintf("%d.--%d", time.Now().Unix(), wac.msgCount*19)
n := binary.Node{
Description: "action",
Attributes: map[string]string{
"type": "set",
"epoch": strconv.Itoa(wac.msgCount),
},
Content: []interface{}{
binary.Node{
Description: "profile",
Attributes: map[string]string{
"name": name,
},
Content: []binary.Node{},
},
},
}
return wac.writeBinary(n, profile, ignore, tag)
}

View File

@ -18,7 +18,7 @@ import (
)
//represents the WhatsAppWeb client version
var waVersion = []int{2, 2039, 9}
var waVersion = []int{2, 2110, 10}
/*
Session contains session individual information. To be able to resume the connection without scanning the qr code