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 7 years, 10 months ago by  Neha.
      • This discussion was modified 7 years, 10 months ago by  Forcetalks.
      • This discussion was modified 7 years, 10 months ago by  Forcetalks.
      Neha replied 7 years, 10 months 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

    Rest API

    Insert ContentVersion By Rest API | The Salesforce Developer Guide

    Blog in Others, Salesforce Tutorial

    In this document, we are going to insert a contentVersion from a Salesforce Source org to a particular sObject of target Salesforce org by using…

    Connect App, Content Document, Content Version, Developer Guide, Org
    Aditya Mar 1, 2021
    24,731  Views

    FEXLE at Dreamforce 2023: Mastering the Power of Salesforce Integration for Business Growth

    Blog in Salesforce integration

    The universe of Salesforce has shaken with the arrival of the largest conglomeration that is about to happen very soon. Dreamforce 2023 is finally here.…

    API Ecosystem, API Expertise, API Governance, API Setup, Bhawani Sharma
    Fexle Services Sep 14, 2023
    1,131  Views

    DevOps for the Salesforce Ecosystem

    Blog in Salesforce

    The following is a summary of the information covered in the webinar: DevOps for the Salesforce Ecosystem. Modern IT Transformation Overwhelmingly, organizations are needing to…

    Application, Approval, Auditing, Automated Test, Automating Your Processes
    Flexagon Aug 24, 2021
    1,828  Views

    Popular Salesforce Videos

    Rise & Shine with The Salesforce Women's Entrepreneur Group

    Rise & Shine with The Salesforce Women's Entrepreneur Group

    Video in Salesforce Stories

    The Salesforce Women’s Entrepreneur Group invites you to our first quarterly event of the year, Rise & Shine - Celebrating Women’s History Month. We are…

    Salesforce Training, Salesforce Tutorial, Salesforce Ecosystem, Salesforce Video, Salesforce Learning
    Nauman Mar 30, 2021
    1,507  Views
    Increase ROI by Investing in People | Make Earth Your Business

    Increase ROI by Investing in People | Make Earth Your Business

    Video in

    The video discusses the benefits of businesses that invest in and believe in their employees, customers, and communities. Investing in employee training and upskilling programs…

    salesforce, Customers, Employees, Productivity, Businesses
    Jogender Apr 18, 2023
    985  Views
    What is Salesforce | Salesforce Training Videos For Beginners | Salesforce Tutorial

    What is Salesforce | Salesforce Training Videos For Beginners | Salesforce Tutorial

    Video in Salesforce Certifications

    This Salesforce Training Video will help you an introduction to Salesforce Administrator and Platform App Builder Certification Training course offered by Simplilearn. By end of…

    Salesforce Training, Salesforce Tutorial, Salesforce Certification, Salesforce Training Videos, What Is Salesforce
    Simplilearn Apr 19, 2019
    2,157  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.