将Whatsapp业务API与Flutter应用程序集成



我想将Whatsapp for business API与Flutter应用程序集成。我从哪里开始?这可能吗?非常感谢。

您可以使用Dart的flutter_share_me插件,并从Android清单中实现一些插件设置,需要将Kotlin更新到最新版本,然后打开Whatsapp Business APP就可以了。

这里有一些代码片段可以帮助您:

使用Share.whatsapp_business Switch Case

Future<void> onButtonTap(Share share, CustomerDetails customerDetails) async {
String msg = "Thank you for contacting us! We will be in touch shortly";
//"Customer Name : "+customerDetails.customerName.toString()+"n"+"Address : "+customerDetails.address+"n"+"Mobile No. : " + customerDetails.contactNo1.toString();
String url = 'https://pub.dev/packages/flutter_share_me';
String response;
final FlutterShareMe flutterShareMe = FlutterShareMe();
switch (share) {
case Share.facebook:
response = await flutterShareMe.shareToFacebook(url: url, msg: msg);
break;
case Share.twitter:
response = await flutterShareMe.shareToTwitter(url: url, msg: msg);
break;
case Share.whatsapp_business:
response = await flutterShareMe.shareToWhatsApp4Biz(msg: msg);
break;
case Share.share_system:
response = await flutterShareMe.shareToSystem(msg: msg);
break;
case Share.whatsapp_personal:
response = await flutterShareMe.shareWhatsAppPersonalMessage(
message: msg, phoneNumber: '+91'+customerDetails.contactNo1);
break;
case Share.share_telegram:
response = await flutterShareMe.shareToTelegram(msg: msg);
break;
}
debugPrint(response);
}

最新更新