twilio_flutter 0.7.0 copy "twilio_flutter: ^0.7.0" to clipboard
twilio_flutter: ^0.7.0 copied to clipboard

A Package that helps with twilio API services. Features include sending SMS and WhatsApp messages among others.

Twilio Flutter #

A Dart package for both android and iOS which helps developers with Twilio API services. This Dart Package can be integrated into any Flutter application to make use of Twilio API.

Features #

  • Send SMS programmatically
  • Get all SMS related to a Twilio account
  • Get more info on each SMS sent from a Twilio account
  • Send WhatsApp messages programmatically
  • Send Scheduled SMS
  • Cancel Scheduled SMS
  • Send Scheduled WhatsApp message
  • Cancel Scheduled WhatsApp Message

Getting Started #

Check out our comprehensive Example provided with this plugin.

To use this package :

  • add the dependency to your pubspec.yaml file.
dependencies:
  flutter:
    sdk: flutter
  twilio_flutter:

How to use #

Please find the following values from Twilio Console:

  • Account SID
  • Twilio Number
  • Auth Token
  • Messaging Service SID (Optional, required for features like scheduled messages)

TwilioFlutter features #

Create a new TwilioFlutter object and initialize with required values


final TwilioFlutter twilioFlutter = TwilioFlutter(
    accountSid: '', // replace with Account SID
    authToken: '', // replace with Auth Token
    twilioNumber: '' // replace with Twilio Number(With country code)
);

Send SMS

twilioFlutter.sendSMS() can be used to send SMS with required message body to any mobile number by providing the number and proper country code. There is two ways to use the function:

  • Use sendSMS with the recipient number and message body using the default twilioNumber.
await twilioFlutter.sendSMS(
toNumber : '',// replace with Mobile Number(With country code)
messageBody : 'hello world');
  • Use sendSMS with the recipient number and message body using custom twilioNumber.
await twilioFlutter.sendSMS(
toNumber : '',// replace with Mobile Number(With country code)
messageBody : 'hello world',
from:''// replace with Mobile Number(With country code)
);

View SMS List

The twilioFlutter.getSmsList() can be used to view all the SMS messages that was sent using the twilio account, an optional pageSize parameter can be passed which defaults to 20.

final data = await twilioFlutter.getSmsList({String pageSize}); //pageSize defaults to 20

View Single SMS

The twilioFlutter.getSMS() can be used to view the details of a single SMS message resource using the SID of the message. The SID can be found using the twilioFlutter.getSmsList().


final data = await twilioFlutter.getSMS(String messageSID); //Use message sid from the individual messages.

Change Twilio Number

The twilioFlutter.changeDefaultTwilioNumber() can be used to update the default Twilio number that was used to initialize the TwilioFlutter object.

twilioFlutter.changeDefaultTwilioNumber(''); // To change the twilio number(With country code)

Send WhatsApp Message

twilioFlutter.sendWhatsApp() can be used to send WhatsApp message with required message body to any mobile number by providing the number and proper country code.

await twilioFlutter.sendWhatsApp(toNumber : '',// replace with Mobile Number(With country code)
messageBody : 'hello world');

TwilioMessagingService features #

Create a new TwilioMessagingService object and initialize with required values


final TwilioMessagingService twilioMessagingService = TwilioMessagingService(
    accountSid: '', // replace with Account SID
    authToken: '', // replace with Auth Token
    messagingServiceSid: '' // replace with messaging service sid from twilio console
);

Send Scheduled SMS Message

Scheduled messages can be sent using twilioMessagingService.sendScheduledSms() if the sendAt is at least 15 after the current time.

await twilioMessagingService.sendScheduledSms(
toNumber : '',
messageBody : 'hello world',
sendAt:'2024-02-18T16:18:55Z'
// Datetime has to be in the same format
);

Cancel Scheduled SMS #

Scheduled SMS can be cancelled using the messageSid with twilioMessagingService.cancelScheduledSms().

await twilioMessagingService.cancelScheduledSms(messageSID:''// replace with message SID);

Send Scheduled WhatsApp Message

Scheduled messages can be sent using twilioMessagingService.sendScheduledWhatsAppMessage() if the sendAt is at least 15 after the current time.

await twilioMessagingService.sendScheduledWhatsAppMessage(
toNumber : '',
messageBody : 'hello world',
sendAt:'2024-02-18T16:18:55Z'
// Datetime has to be in the same format
);

Cancel Scheduled WhatsApp Message

Scheduled whatsapp messages can be cancelled using the messageSid with twilioMessagingService.cancelScheduledWhatsAppMessage().

await twilioMessagingService.cancelScheduledWhatsAppMessage(messageSID:''// replace with message SID
);

Features and service list #

Service Feature Feature info
TwilioFlutter Send SMS Send SMS to mobile number
TwilioFlutter Send WhatsApp message Send whatsApp message to any number
TwilioFlutter Get SMS list Get all SMS from the account
TwilioFlutter Get SMS details Get all data related to a single SMS resource
TwilioMessagingService Send scheduled SMS Send SMS messages according to a time set
TwilioMessagingService Cancel scheduled SMS Cancel scheduled SMS message
TwilioMessagingService Send scheduled whatsapp message Send WhatsApp message according to a time set
TwilioMessagingService Cancel scheduled whatsapp message Cancel a scheduled whatsapp message

Future Features #

  • ✅ Cancel Scheduled Messages
  • ❌ Email Sending Support
  • ❌ Update a Message resource
  • ❌ Delete a Message resource
  • ❌ Alphanumeric Sender IDs in Messaging Services
  • ❌ More Support for Messaging Service
  • ❌ Send message through Facebook Messenger

Supported Platforms #

  • Android
  • iOS
  • Web
  • MacOs
  • Windows
  • Linux

Useful articles #

Issues #

Please file any issues, bugs or feature requests as an issue on our GitHub page.

Want to contribute #

If you would like to contribute to the plugin (e.g. by improving the documentation, solving a bug or adding a cool new feature), please carefully review our contribution guide and send us your pull request.

Author #

This Twilio Flutter plugin for Flutter is developed by Adarsh Balachandran.

119
likes
0
pub points
95%
popularity

Publisher

unverified uploader

A Package that helps with twilio API services. Features include sending SMS and WhatsApp messages among others.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

get_it, http, logging

More

Packages that depend on twilio_flutter