Last updated:
0 purchases
nimbasms flutter
nimbasms_flutter #
nimbasms_flutter is a Flutter plugin for interacting with the Nimba SMS API. It allows you to send SMS, manage contacts, retrieve messages, and perform other SMS-related operations using the Nimba SMS service.
Features #
✅ Send SMS
✅ Retrieve all messages
✅ Retrieve a specific message by ID
✅ Retrieve account details
✅ Retrieve the list of contacts
✅ Create a new contact
✅ Retrieve the list of groups
❌ Create a verification
❌ Request verification
Tested Platforms and Status #
✅ iOS - Tested and working
✅ macOS - Tested and working
✅ Android - Tested and working
❌ Windows - Not tested yet
❌ Linux - Not tested yet
✅ Web - Tested and working
Getting Started #
Installation #
Add nimbasms_flutter as a dependency in your pubspec.yaml file:
dependencies:
flutter:
sdk: flutter
nimbasms_flutter: ^1.0.0
copied to clipboard
Platform-specific Setup #
To enable network access for your application, you need to configure specific settings for iOS, macOS, and Android.
iOS and macOS
To enable network access for your application on iOS and macOS, you need to modify the entitlement files and add the necessary permissions:
Update Entitlements:
Open the ios/Runner/Runner.entitlements file for iOS and the macos/Runner/DebugProfile.entitlements and macos/Runner/Release.entitlements files for macOS.
Add the following lines to allow your application to make network requests:
<key>com.apple.security.network.client</key>
<true/>
copied to clipboard
Android
For Android, you need to add the Internet permission to allow your application to access the network.
Open the android/app/src/main/AndroidManifest.xml file.
Add the following line inside the <manifest> tag to grant Internet access:
<uses-permission android:name="android.permission.INTERNET" />
copied to clipboard
This permission ensures that your application has the necessary permissions to perform network operations on Android.
Usage #
Once the platform-specific setup is complete, you can start using the nimbasms_flutter plugin in your Flutter application.
1. Import the Package #
First, import the nimbasms_flutter package in your Dart code:
import 'package:nimbasms_flutter/nimbasms_flutter.dart';
copied to clipboard
2. Initialize the NimbaSMS Client #
Create an instance of the NimbaSMS class with your service ID and secret:
void main() async {
final nimbaSMS = NimbaSMS(
serviceId: 'YOUR_SERVICE_ID',
secret: 'YOUR_SECRET',
);
try {
// Example: Send an SMS
Map<String, dynamic> smsResponse = await nimbaSMS.send(
senderName: 'Nimba SMS',
recipients: ['623XXXXXXX'],
message: 'Hello, Nimba SMS',
);
print('SMS sent successfully: $smsResponse');
} catch (e) {
print('Error: $e');
}
}
copied to clipboard
3. Available Methods #
Send an SMS
To send an SMS message using the Nimba SMS API:
final smsResponse = await nimbaSMS.send(
senderName: 'Nimba SMS', // The sender name
recipients: ['623XXXXXXX'], // List of phone numbers
message: 'Hello, this is a test message!', // The SMS body
);
copied to clipboard
Retrieve All Messages
You can retrieve all messages sent through your account:
final messages = await nimbaSMS.getMessages();
print(messages);
copied to clipboard
Retrieve a Message by ID
To get the details of a specific message by its ID:
final messageDetails = await nimbaSMS.getMessageById('MESSAGE_ID');
print(messageDetails);
copied to clipboard
Retrieve Account Details
To retrieve details about your Nimba SMS account:
final accountDetails = await nimbaSMS.getAccountDetails();
print(accountDetails);
copied to clipboard
Manage Contacts
You can retrieve or create contacts using the following methods:
Retrieve all contacts:
final contacts = await nimbaSMS.getContacts();
print(contacts);
copied to clipboard
Create a new contact:
final newContact = await nimbaSMS.createContact(
name: 'Sona Camara',
groups: ['Famille', 'Amis'],
numero: '623XXXXXXX',
);
print(newContact);
copied to clipboard
Retrieve Groups
To retrieve the list of groups in your Nimba SMS account:
final groups = await nimbaSMS.getGroups();
print(groups);
copied to clipboard
Create a Verification
To create a verification request for a specific phone number:
final verification = await nimbaSMS.createVerification(
to: '623XXXXXXX',
);
print(verification);
copied to clipboard
Handling Errors #
If an error occurs while using the plugin, it will throw an exception. You can catch errors like this:
try {
final messages = await nimbaSMS.getMessages();
} catch (e) {
print('Error: $e');
}
copied to clipboard
Contributing #
Contributions are welcome! If you have any suggestions, issues, or improvements, feel free to create an issue or submit a pull request.
License #
This project is licensed under the MIT License - see the LICENSE file for details.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.