sendMessage method
Implementation
Future<Request> sendMessage(
String phoneNumber, String text, bool previewUrl) 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': 'text',
'text': {
'preview_url': previewUrl,
'body': text,
},
};
await request.post('$fromNumberId/messages', headers, body);
return request;
}