Search packages, repositories and app categories

GitHub repositoryDeuque/TwilioPhoneVerify

TwilioPhoneVerify

A Package that helps in verifying phone numbers and email addresses using Twilio.

TwilioPhoneVerify project cover
Stars
5
Forks
14
Last push (UTC)
Nov 10, 2023
Project status
Active

Original README

English project snapshot. Visit GitHub for the latest content.

Twilio_Phone_Verify

A Package that helps in verifying phone numbers and email addresses using Twilio.

Usage

To use this package :

  • add the dependency to your pubspec.yaml file.
dependencies:
  flutter:
    sdk: flutter
  twilio_phone_verify:
How to use
Create a new Object
TwilioPhoneVerify _twilioPhoneVerify; 
Initialize with values
_twilioPhoneVerify = new TwilioPhoneVerify(
        accountSid: '*************************', // replace with Account SID
        authToken: 'xxxxxxxxxxxxxxxxxx',  // replace with Auth Token
        serviceSid: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' // replace with Service SID
        );
Phone number verification
Send Code to Phone
 var twilioResponse =
        await _twilioPhoneVerify.sendSmsCode('phone');

    if (twilioResponse.successful)  {
      //code sent
    } else {
      //print(twilioResponse.errorMessage);
    }
Verify Code
    var twilioResponse = await _twilioPhoneVerify.verifySmsCode(
        phone: 'phone', code: 'code');

    if (twilioResponse.successful) {
      if (twilioResponse.verification.status == VerificationStatus.approved) {
        //print('Phone number is approved');
      } else {
        //print('Invalid code');
      }
    } else {
      //print(twilioResponse.errorMessage);
    }
Email Verification

Twilio Verify email channel requires additional Service configuration. Please refer to the email channel setup documentation for detailed instructions.

Send Code to Email
 var twilioResponse =
        await _twilioPhoneVerify.sendEmailCode('email');

    if (twilioResponse.successful)  {
      //code sent
    } else {
      //print(twilioResponse.errorMessage);
    }
Verify Email Code
    var twilioResponse = await _twilioPhoneVerify.verifyEmailCode(
        email: 'email', code: 'code');

    if (twilioResponse.successful) {
      if (twilioResponse.verification.status == VerificationStatus.approved) {
        //print('Email is approved');
      } else {
        //print('Invalid code');
      }
    } else {
      //print(twilioResponse.errorMessage);
    }
Override Email configurations
 var twilioResponse =
        await _twilioPhoneVerify.sendEmailCode('email',channelConfiguration:
    EmailChannelConfiguration(
        from: "override@example.com",
        from_name: "Override Name",
        template_id: "d-4f7abxxxxxxxxxxxx",
		usernameSubstitution: "Foo Bar"
    ));

    if (twilioResponse.successful)  {
      //code sent
    } else {
      //print(twilioResponse.errorMessage);
    }

Features

  • [x] Phone verification
  • [x] Email verification.

Getting Started

For help getting started with Flutter, view our online documentation.

For help on editing package code, view the documentation.

Duke Chiaha GitHub avatar
GitHub author

Duke Chiaha ↗

Mobile Engineer.

MoniepointAbuja, NigeriaOfficial website ↗
LanguagesDartHTMLSwiftKotlinObjective-C

Packages published by this repository

Dependencies used

Dependency list 3 items

  • flutter{"sdk":"flutter"}
  • http^1.0.0
  • flutter_testDevelopment{"sdk":"flutter"}

How do I choose a repository?

Start with your use case, compare repository activity, and check the original project before adopting it.

  1. Search by repository name, owner or description, then narrow the results by topic.
  2. Compare stars, forks and recent pushes. Stars show community interest, not a guarantee of quality.
  3. Read the README, license and issues on GitHub before using a project.

Sources and maintenance

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗