whatsapp_bot_platform_interface
library
Extensions
-
JsParser
on dynamic
-
Use
JsParse extension on data we pass in Javascript string.
Functions
-
base64ToMap(String base64String)
→ Map<String, dynamic>
-
-
getMimeType(WhatsappFileType fileType, String? fileName, List<int> bytes)
→ String
-
getMimeType returns the MIME type for the given file.
Tries to detect from
fileName first using the mime package,
then falls back to defaults based on fileType.
-
parseGroup(String phone)
→ String
-
parseGroup will try to convert group number in required format
-
parsePhone(String phone)
→ String
-
parsePhone will try to convert phone number in required format.
A full chat id (
...@c.us, ...@g.us, ...@newsletter, ...@lid)
is passed through unchanged, so groups and channels can be sent to with
the same methods.
-
validateConnection(WpClientInterface wpClient)
→ Future
-
-
waitForInChat(WpClientInterface wpClient, {String? wppVersion, String? wppJsContent, Map<String, dynamic>? wppConfig, bool autoTakeover = true})
→ Future<bool>
-
Waits up to two minutes for the chat screen. One check at a time -- a
slow check is never overlapped by the next one -- and a single page
reload at 70s, after which WPP is injected again with the same version
and config and the listeners are re-attached.
-
waitForLogin(WpClientInterface wpClient, {required dynamic onQrCode(String qrCodeUrl, Uint8List? qrCodeImage)?, int waitDurationSeconds = 60, dynamic onConnectionEvent(ConnectionEvent)?, bool skipQrScan = false, String? wppVersion, String? wppJsContent, Map<String, dynamic>? wppConfig, bool autoTakeover = true})
→ Future<bool>
-
waitForLogin will either complete with successful login
or failed with timeout exception
this method will automatically try to get the qrCode
also it will make sure that we get the latest qrCode
Returns
true if login succeeded, false if login was skipped
because skipQrScan is true and the user is not authenticated.