smsalert 0.1.3 smsalert: ^0.1.3 copied to clipboard
A Dart package which helps developers with SMS Alert API services.
import 'dart:io' show Platform;
import 'package:smsalert/smsalert.dart';
Future<void> main() async {
String? _user = Platform.environment['SMSALERT_ACCOUNT_USERNAME'];
String? _pwd = Platform.environment['SMSALERT_ACCOUNT_PASSWORD'];
/// Your SMSAlert account username and password.
/// You can skip this block if you store your credentials in environment variables.
_user ??= 'SMSALERT_ACCOUNT_USERNAME';
_pwd ??= 'SMSALERT_ACCOUNT_PASSWORD';
/// Create an authenticated SMSAlert sa instance.
SMSAlert sa = new SMSAlert(_user, _pwd);
// Send a text message.
// Returns a Map object (key/value pairs).
Map? message = await sa.messages.sendsms({
'text': 'Hello from Dart!', //SMS text
'sender': 'CVDEMO', // a valid sender ID
'mobileno': '+918010551055', // your destination phone number
'route': 'demo' //to select route
});
print(message);
}