sendAudioByUrl method

Future<Request> sendAudioByUrl(
  1. String phoneNumber,
  2. String url
)

Implementation

Future<Request> sendAudioByUrl(String phoneNumber, String url) async {
  final Map<String, String> headers = {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer $accessToken',
  };

  final Map<String, dynamic> body = {
    "messaging_product": "whatsapp",
    "recipient_type": "individual",
    "to": phoneNumber,
    "type": "audio",
    "audio": {"link": url}
  };

  await request.post('$fromNumberId/messages', headers, body);
  return request;
}