Toggle Side Panel

  • Home
  • Articles
    • All Articles
    • Blogs
    • Videos
    • Infographics
  • Consultants
    • Salesforce Product Expertise
      • Top Salesforce ConsultantsTop Salesforce Consultants
      • Marketing Cloud ConsultantsMarketing Cloud Consultants
      • Service Cloud ConsultantsService Cloud Consultants
      • Experience Cloud ConsultantsExperience Cloud Consultants
      • Analytics Cloud ConsultantsAnalytics Cloud Consultants
    • Salesforce Industry Expertise
      • Non-Profit Cloud ConsultantsNon-Profit Cloud Consultants
      • Financial Service Cloud ConsultantsFinancial Service Cloud Consultants
      • Health Cloud ConsultantsHealth Cloud Consultants
      • Commerce Cloud ConsultantsCommerce Cloud Consultants
      • Manufacturing Cloud ConsultantsManufacturing Cloud Consultants
    • Salesforce Experts by Location
      • USATop Salesforce Consultants in USA
      • IndiaTop Salesforce Consultants in India
      • AustraliaTop Salesforce Consultants in Australia
      • United KingdomTop Salesforce Consultants in UK
      • CanadaTop Salesforce Consultants in Canada
  • Webinars
  • Marketplace
  • Advertise With Us
  • Contact Us
  • Discussions
More options
    Sign in Sign up
    • Home
    • Articles
      • All Articles
      • Blogs
      • Videos
      • Infographics
    • Consultants
      • Salesforce Product Expertise
        • Top Salesforce ConsultantsTop Salesforce Consultants
        • Marketing Cloud ConsultantsMarketing Cloud Consultants
        • Service Cloud ConsultantsService Cloud Consultants
        • Experience Cloud ConsultantsExperience Cloud Consultants
        • Analytics Cloud ConsultantsAnalytics Cloud Consultants
      • Salesforce Industry Expertise
        • Non-Profit Cloud ConsultantsNon-Profit Cloud Consultants
        • Financial Service Cloud ConsultantsFinancial Service Cloud Consultants
        • Health Cloud ConsultantsHealth Cloud Consultants
        • Commerce Cloud ConsultantsCommerce Cloud Consultants
        • Manufacturing Cloud ConsultantsManufacturing Cloud Consultants
      • Salesforce Experts by Location
        • USATop Salesforce Consultants in USA
        • IndiaTop Salesforce Consultants in India
        • AustraliaTop Salesforce Consultants in Australia
        • United KingdomTop Salesforce Consultants in UK
        • CanadaTop Salesforce Consultants in Canada
    • Webinars
    • Marketplace
    • Advertise With Us
    • Contact Us
    • Discussions
    Close search

    Activity › Forums › Salesforce® Discussions › How can we verify phone number with Twilio account in Salesforce Apex?

    Tagged: API Integration, Number, Salesforce Apex, Salesforce Apex Class, Salesforce Apex Code, Salesforce Apex Controller, Salesforce APIs, Twilio Account, Verification

    • Salesforce® Discussions

      How can we verify phone number with Twilio account in Salesforce Apex?

      Posted by Neha on March 22, 2018 at 6:09 AM

      How can we verify phone number with Twilio account in Salesforce Apex? What is the API for that?

      • This discussion was modified 8 years ago by  Neha.
      • This discussion was modified 8 years ago by  Forcetalks.
      • This discussion was modified 8 years ago by  Forcetalks.
      Neha replied 8 years ago 2 Members · 3 Replies
      • API Integration
      • Number
      • Salesforce Apex
      • Salesforce Apex Class
      • Salesforce Apex Code
      • Salesforce Apex Controller
      • Salesforce APIs
      • Twilio Account
      • Verification
    • 3 Replies
    • Neha

      Member
      March 23, 2018 at 8:05 AM

      I have gone the answer for this by myself.

      First Checkout or download the Twilio-salesforce library from GitHub. Then, deploy the code into Salesforce org

      Search the phone number to buy from Twilio - account with following code:

      String ACCOUNT_SID = 'AXXXXXXXXXXXXXXXXX';
      String AUTH_TOKEN = 'YYYYYYYYYYYYYYYYYY';
      TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);
      List<TwilioAvailablePhoneNumbers> numbers;
      Map<String,String> filters = new Map<String,String> {
      'AreaCode' => '530'
      };
      numbers = client.getAccount().getAvailablePhoneNumbers(filters).getPageData();
      if (numbers.isEmpty()) {
      System.debug('No numbers in 530 available');
      } else {
      numbers[0].purchase();
      }

      With following code you can buy phone number with Twilio account in Salesforce Apex

      String ACCOUNT_SID = 'AXXXXXXXXXXXXXXXXX';
      String AUTH_TOKEN = 'YYYYYYYYYYYYYYYYYY';
      TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);
      TwilioIncomingPhoneNumber incoming;
      Map<String,String> properties =
      new Map<String,String>{'PhoneNumber' => '+15305431234'};
      incoming = client.getAccount().getIncomingPhoneNumbers().create(properties);

      For more reference, you can refer Twilio-document.

    • Archit

      Member
      March 23, 2018 at 11:14 AM

      Hello Neha,
      It seems great that you have find an answer of your own question. But I think the below code also might be helpful to achieve same.

      VF Page:

      <apex:page controller="testtwilio">
      <apex:form >
      <apex:commandButton action="{!hello}" value="Make a Call"/>
      </apex:form>
      </apex:page>

      Apex Class :

      public class testtwilio {

      String account = 'ACe8e44b316e6a15009f6ccb688cf56d19';
      String token = '279daad95178678bcb199d328ff5ca31';

      public PageReference hello(){
      TwilioRestClient client = new TwilioRestClient(account, token);

      Map<String,String> properties = new Map<String,String> {
      'To' => '+918147430168',
      'From' => '+2015826854',
      'Body' => 'Hello!'
      };
      TwilioMessage message = client.getAccount().getMessages().create(properties);
      return null;
      }
      }

      Hope It would be helpful !!

    • Neha

      Member
      March 23, 2018 at 11:46 AM

      Hi Archit,

      You understood the question wrong.

      The code you provide is to make a call with Twilio but my question is to verify phone number with Twilio account in Salesforce Apex.

    Log In to reply.

    • Public
    • All Members
    • My Connections
    • Only Me
    • Public
    • All Members
    • My Connections
    • Only Me
    • Public
    • All Members
    • My Connections
    • Only Me

    application solution

    Popular Salesforce Blogs

    A Complete Guide to Salesforce Development Services for Growing Businesses

    Blog in Others

    Nowadays, businesses are growing faster than ever. Managing operations manually makes the process slower, and it is no longer sufficient. Fortune Business Insights projects the…

    William Mar 19, 2026
    45  Views

    Where to Learn Salesforce Admin Training Online?

    Blog in Salesforce

    To start anything, maybe from scratch or to attain an advanced level of knowledge, it is important to know various resources that can help you…

    Salesforce, salesforcedeveloper
    Ray brad Aug 1, 2025
    212  Views
    record triggered flows

    What are Record-triggered Flows in Salesforce? | The Ultimate Guide

    Blog in Salesforce

    One of Salesforce's most potent features is Record-Triggered Flows (RTFs). You may automate procedures and lessen human labor by using RTFs to design flows that…

    Auto Launched Flow, Automate Procedures, Automatically triggered, Before-Save, Best Practices
    Mayank May 2, 2023
    2,312  Views

    Popular Salesforce Videos

    Marketing Cloud Connect: View Full Resolution Emails in Sales or Service Cloud

    Marketing Cloud Connect: View Full Resolution Emails in Sales or Service Cloud

    Video in Salesforce Implementation

    Thumbnails don't always cut it. Sometimes you need the full resolution Marketing Cloud email in Sales or Service Cloud to see what was sent to…

    Salesforce Training, Salesforce Tutorial, Salesforce Visualforce, Salesforce Rest API, Apex
    DB Mar 3, 2021
    2,245  Views
    AppExchange Demo Jam - April 2020

    AppExchange Demo Jam - April 2020

    Video in AppExchange

    Watch AppExchange apps Lifeguard Solutions, FilePulse, Vonage, Icertis, Taskray, and Salesforce Crisis App from Salesforce Labs demo their technology in three minutes for the audience…

    salesforce, Salesforce AppExchange, Demo Jam, AppExchange Apps, Salesforce Labs
    Abhai Deep Apr 20, 2020
    2,214  Views
    Copy to Clipboard Functionality in Salesforce - Lightning Component Projects Series Part 2

    Copy to Clipboard Functionality in Salesforce - Lightning Component Projects Series Part 2

    Video in Lightning, Salesforce Training

    In this video, I'm creating a lightning component Project for functionality i.e Copy to Clipboard. Watch this video and learn. If you have any doubts…

    Salesforce Training, Salesforce Lightning, Salesforce Video, Salesforce Learning, Lightning Component
    Shubham Feb 23, 2021
    2,796  Views
    Footer Forcetalks logo

    support@forcetalks.com

    • twitterx

    Quick Links

    Advertise with Us

    Salesforce® Articles

    Dreamforce 2023

    Top Salesforce® Bloggers 2023

    Top Salesforce Consultants

    Get Listed

    Company

    Contact Us

    About Us

    Privacy Policy

    Terms & Conditions

    InsightHub

    Salesforce Blogs

    Salesforce Videos

    Salesforce Groups

    Salesforce Jobs

    © 2026 - Forcetalks ● All Rights Reserved

    Salesforce® is a trademark of Salesforce® Inc. No claim is made to the exclusive right to use “Salesforce”. Any services offered within the Forcetalks website/app are not sponsored or endorsed by Salesforce®.

    Try AuditMyCRM - It is a Salesforce CRM Audit tool which comprehensively scans your Salesforce org and gives you the list of errors or warnings you need to take care of.
    We use cookies to enhance your browsing experience. Please see our privacy policy if you'd like more information on our use of cookies.