replay method

Future<Request> replay(
  1. String phoneNumber,
  2. String messageId,
  3. dynamic replay
)

Implementation

Future<Request> replay(String phoneNumber, String messageId, replay) 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,
    "context": {"message_id": messageId}
  };

  var append = replay;

  final Map<String, dynamic> mergedMap = {
    ...body,
    ...append,
  };

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