DNZ Digita

WhatsApp OTP Example

Request WhatsApp OTP from Flutter

A Flutter client example that calls your backend securely.

Setup

Code

Future<void> requestOtp(String phone) async {
  final response = await http.post(
    Uri.parse('https://api.example.com/request-otp'),
    headers: {'Content-Type': 'application/json'},
    body: jsonEncode({'phone': phone}),
  );

  if (response.statusCode >= 400) {
    throw Exception('Unable to request OTP');
  }
}

Production notes

Related links

Support