Skip to content

Instantly share code, notes, and snippets.

@chrisk8er
Last active July 27, 2022 05:39
Show Gist options
  • Save chrisk8er/6bd20dd712551c98919947d92d6071be to your computer and use it in GitHub Desktop.
Save chrisk8er/6bd20dd712551c98919947d92d6071be to your computer and use it in GitHub Desktop.

Connecting State

Opening Whatsapp page

Incoming webhook: {"erro":false,"text":"Starting browser...","status":"initBrowser","statusFind":"browser","onType":"connection","session":"user","token":""}
Incoming webhook: {"erro":false,"text":"Opening whatsapp page!","status":"initWhatsapp","statusFind":"browser","onType":"connection","session":"user","token":""}
Incoming webhook: {"erro":false,"text":"Website accessed successfully","status":"openedWhatsapp","statusFind":"browser","onType":"connection","session":"user","token":""}

Showing the QRCode

This will happen if the user doesn't connect before. Otherwise, it will not show. Whatsapp will send several QRCode images.

Incoming webhook: {"onType":"interfaceChange","session":"user","result":{"displayInfo":"CONNECTING","mode":"QR","info":"OPENING"},"token":""}
Incoming webhook: {"onType":"interfaceChange","session":"user","result":{"displayInfo":"CONNECTING","mode":"QR","info":"PAIRING"},"token":""}
Incoming webhook: {"onType":"interfaceChange","session":"user","result":{"displayInfo":"CONNECTING","mode":"QR","info":"NORMAL"},"token":""}
Incoming webhook: {"erro":false,"qrcode":"NORMAL","onType":"connection","session":"user","token":""}
Incoming webhook: {"erro":false,"qrcode":"","base64Image":"","onType":"qrcode","session":"user","token":""}

Syncing and downloading the new message:

This will happen when:

  • user successfully scan the QRCode
  • user already scans the QRCode / already connected before.

You can keep the new message by reading the newMessage type

Incoming webhook: {"onType":"interfaceChange","session":"user","result":{"displayInfo":"CONNECTING","mode":"SYNCING","info":"OPENING"},"token":""}
Incoming webhook: {"onType":"interfaceChange","session":"user","result":{"displayInfo":"CONNECTING","mode":"SYNCING","info":"SYNCING"},"token":""}
Incoming webhook: {"onType":"newMessage","session":"user","result":{"id":"false_status@broadcast_1316B1B8216B8E4C1649236BF93FB22B_6281808890748@c.us","body":"","type":"video","t":1658850700,"notifyName":"","from":"status@broadcast","to":"62882021996939@c.us","author":"6281808890748@c.us","self":"in","ack":1,"isNewMsg":true,"star":false,"kicNotified":false,"recvFresh":true,"interactiveAnnotations":[],"deprecatedMms3Url":"https://mmg.whatsapp.net/d/f/AoqJJuZIvozfJzCSiNisMVorrmUwSayJbdVtJTZc_Lre.enc","directPath":"/v/t62.7161-24/31813710_1217740688982812_1178711601641612735_n.enc?ccb=11-4&oh=01_AVz6jSP4XrEJKMylUDzRo8PcWK9isVWa_w4BapAOqjzWYQ&oe=6304B746","mimetype":"video/mp4","duration":"29","filehash":"5NsSlZCYKm6BVCIXX/vJkHXn5e+5tpd1rijmkE6l+yw=","encFilehash":"6M7GoLgUXaR4qMtSPfC59pCxWVI3gA4ASYdaWaxPP6A=","size":2653636,"mediaKey":"Ee+myiqsoZoN6AMq5U2uvqntwURYX3iDhEJecobB6VE=","mediaKeyTimestamp":1658850690,"isViewOnce":false,"width":640,"height":480,"staticUrl":"","isFromTemplate":false,"broadcast":false,"mentionedJidList":[],"isVcardOverMmsDocument":false,"isForwarded":false,"labels":[],"hasReaction":false,"productHeaderImageRejected":false,"lastPlaybackProgress":0,"isDynamicReplyButtonsMsg":false,"isMdHistoryMsg":false,"requiresDirectConnection":false,"pttForwardedFeaturesEnabled":true,"chatId":"status@broadcast","isSentByMe":false,"fromMe":false,"sender":{"id":"6281808890748@c.us","pushname":"AAM SOFYAN","type":"in","labels":[],"formattedName":"+62 818-0889-0748","displayName":"AAM SOFYAN","formattedShortName":"+62 818-0889-0748","formattedShortNameWithNonBreakingSpaces":"+62 818-0889-0748","isMe":false,"mentionName":"AAM SOFYAN","notifyName":"AAM SOFYAN","isMyContact":false,"isPSA":false,"isUser":true,"isWAContact":true,"profilePicThumbObj":{},"msgs":null},"timestamp":1658850700,"content":"","isGroupMsg":false,"isMedia":true,"isNotification":false,"isPSA":false,"chat":{},"mediaData":{"type":"unknown","mediaStage":"INIT","animationDuration":0,"animatedAsNewMsg":false,"isViewOnce":false,"_swStreamingSupported":false,"_listeningToSwSupport":false,"isVcardOverMmsDocument":false,"waveform":null},"linkPreview":false,"initialPageSize":768},"token":""}

User are connected:

Incoming webhook: {"onType":"interfaceChange","session":"user","result":{"displayInfo":"NORMAL","mode":"MAIN","info":"NORMAL"},"token":""}
Incoming webhook: {"connect":true,"session":"user","token":""}

Logout State

Showing the QRCode

Whatsapp will be sending several QRCode images.

Incoming webhook: {"onType":"interfaceChange","session":"user","result":{"displayInfo":"CONNECTING","mode":"SYNCING","info":"SYNCING"},"token":""}
Incoming webhook: {"onType":"interfaceChange","session":"user","result":{"displayInfo":"CONNECTING","mode":"QR","info":"OPENING"},"token":""}
Incoming webhook: {"onType":"interfaceChange","session":"user","result":{"displayInfo":"CONNECTING","mode":"SYNCING","info":"NORMAL"},"token":""}
Incoming webhook: {"onType":"interfaceChange","session":"user","result":{"displayInfo":"CONNECTING","mode":"QR","info":"OPENING"},"token":""}
Incoming webhook: {"onType":"interfaceChange","session":"user","result":{"displayInfo":"CONNECTING","mode":"QR","info":"PAIRING"},"token":""}
Incoming webhook: {"onType":"interfaceChange","session":"user","result":{"displayInfo":"CONNECTING","mode":"QR","info":"NORMAL"},"token":""}
Incoming webhook: {"erro":false,"qrcode":"","base64Image":"","onType":"qrcode","session":"user","token":""}
Incoming webhook: {"erro":false,"qrcode":"NORMAL","onType":"connection","session":"user","token":""}
Incoming webhook: {"erro":false,"qrcode":"","base64Image":"","onType":"qrcode","session":"user","token":""}
Incoming webhook: {"erro":false,"qrcode":"","base64Image":"","onType":"qrcode","session":"user","token":""}
Incoming webhook: {"erro":false,"qrcode":"","base64Image":"","onType":"qrcode","session":"user","token":""}

Browser closed automatically

This will happen when the user cannot successfully scan the QRcode.

Incoming webhook: {"erro":false,"text":"Auto close called!","status":"autoClose","statusFind":"browser","onType":"connection","session":"user","token":""}
Incoming webhook: {"erro":true,"text":"The browser has closed","status":"browserClosed","statusFind":"browser","onType":"connection","session":"user","token":""}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment