register method

Future<Request> register(
  1. int pin,
  2. bool? enableLocalStorage,
  3. String? dataLocalizationRegion
)

Implementation

Future<Request> register(
    int pin, bool? enableLocalStorage, String? dataLocalizationRegion) async {
  final Map<String, String> headers = {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer $accessToken',
  };

  final Map<String, dynamic> body = {
    "messaging_product": "whatsapp",
    "pin": pin,
  };

  if (enableLocalStorage != null) {
    body["data_localization_region"] = dataLocalizationRegion;
  }

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