dart_twilio 0.1.2
dart_twilio: ^0.1.2 copied to clipboard
A package written purely in Dart for accessing to Twilio features.
A package written purely in Dart for accessing to Twilio features.
π― Insights #
The main objective of [dart_twilio] package is to be friendly & flexible.
Feel free of using the package in the way that fits better to your developer experience.
β οΈ Warning #
This package is on it's initial phase, we don't have a roadmap yet, but planning to support the most used features from Twilio.
Any contribution is more than welcome!
Index #
π Requirements #
SDK constraints #
This package uses Dart >=3.10.1 <4.0.0
Twilio credentials #
Make sure to have your Twilio Account SID and Auth Token ready, you can find them at the Twilio Console.
π Getting started #
Let's start by the beginning, add dart_twilio to your dependencies:
dart pub add dart_twilio
π§© Features #
π« Verify (v2) #
To access to Twilio Verify API you first need to create an instance of TwilioVerifyService, you can do so by the following ways:
- Using
Twilioshorthandsfinal service = Twilio.verifyService( accountSid: '{your_acc_sid}', authToken: '{your_auth_token}', sid: '{your_verify_sid}', ); - Using a
TwilioClientinstancefinal client = Twilio.client( accountSid: '{your_acc_sid}', authToken: '{your_auth_token}' ); final service = client.verify('{your_verify_sid}') - Creating a
TwilioVerifyServiceinstancefinal TwilioVerifyService service = .new( client: .new( accountSid: '{your_acc_sid}' authToken: '{your_auth_token}' ), sid: '{your_verify_sid}', );
#sendCode
Sending a code generates a [Verification] object in Twilio platform.
Calling [#sendCode] returns a [TwilioVerification] which is a class containing all the information returned by the Twilio API.
- Send code via
smsfinal TwilioVerification(:sid, :status) = await service.sendCode(.sms(to: 'to_value')); - Send code via
callfinal TwilioVerification(:sid, :status) = await service.sendCode(.call(to: 'to_value')); - Send code via
whatsappfinal TwilioVerification(:sid, :status) = await service.sendCode(.whatsapp(to: 'to_value')); - Send code via
emailfinal TwilioVerification(:sid, :status) = await service.sendCode(.email(to: 'to_value'));
#verify
Doing a code verification creates a [VerificationCheck] object in Twilio platform.
Calling [#verify] returns a [TwilioVerificationCheck] which is a class containing all the information returned by the Twilio API.
final TwilioVerificationCheck(:status) = await service.verify(
.new(to: 'to_value', code: '1234')
);
π Issues and feedback #
Please feel free to create an issue in our issue tracker in case you face any.
Do you have feedback or a feature request? Let us know!
