如何在 WhatsApp 中一次性向多个号码发送消息?

Ahm*_*lid 5 flutter

我正在尝试使用 Flutter 通过 WhatsApp 向多个电话号码发送消息:

sendMessage() async {
  var number = ["201020402642", "201030666895"];
  var baseUrl = "https://api.whatsapp.com/send/";

  var urlIos = "";

  number.forEach((element) async {
    var url = baseUrl +"?phone=${element} &text=msg";
    if (await canLaunch(url)) {
      await launch(url);
    } else {
      print("not installed");
    }
  });
}
Run Code Online (Sandbox Code Playgroud)

它只向最后一个号码发送消息。

有没有办法向一组号码发送消息?

小智 1

不幸的是,无法使用深层链接同时向超过 1 个号码发送消息。执行此类操作的唯一方法是通过 REST 请求使用 WhatsApp Business API。有一些第三方软件具有此功能,例如https://www.twilio.com/whatsapp

这是 WhatsApp API 文档

https://developers.facebook.com/docs/whatsapp/api/messages/#sending-messages