sendCommunicationCaptureRequest function

Future<Response> sendCommunicationCaptureRequest(
  1. List<CommunicationRequest> commRequest,
  2. String token
)

Implementation

Future<http.Response> sendCommunicationCaptureRequest(
  List<CommunicationRequest> commRequest,
  String token,
) async {
  final headers = <String, String>{
    'Content-Type': 'application/json; charset=UTF-8',
    'Authorization': 'Bearer $token'
  };
  final body = jsonEncode({'events': commRequest});
  final request = http.post(
    Uri.parse('https://app.perceptinsight.com/track/v1/communication'),
    headers: headers,
    body: body,
  );
  final response = await request;
  Debug.print("Communication capture Response: ${response.body}");
  return response;
}