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

    Switching to Salesforce Lightning and Overcoming Challenges

    Blog in Lightning, Salesforce

    Time is of the essence in a saturated business landscape, and getting ahead of the competition gives your company enough edge to thrive despite the…

    Business Landscape, Business Needs, Business Process, Business Processes, Business Sales Initiatives
    Apphienz Jun 23, 2021
    2,093  Views

    Highly Effective Strategies To Make Salesforce Customization Work For You

    Blog in Salesforce customization

    There is nothing more thrilling than running your business on your terms. Thanks to Salesforce customization options, making it easier for admins to simplify the…

    Attract more Customers, Business, Business Challenges, Business Models, Certifications
    Ariztech Jun 23, 2021
    3,261  Views

    Benefits of Salesforce CPQ Software for Your Sales Team

    Blog in Salesforce Cloud Platform

    Customers don't want to be burdened with details about your sales process or the intricacies of your product catalog.  The automation of business operations, especially…

    AppExchange, Approval Workflows, Automated Processes, Business Automation, Configure Price Quote
    Sculptor CPQ Apr 25, 2024
    866  Views

    Popular Salesforce Videos

    Success from Anywhere with Salesforce EMEA Leaders

    Success from Anywhere with Salesforce EMEA Leaders

    Video in Salesforce Stories

    Watch this video to learn about Success from Anywhere with Salesforce EMEA Leaders. Do let us know your opinions in the comment section.

    Salesforce Training, Salesforce Tutorial, salesforce, Salesforce Video, Salesforce Learning
    Nauman Oct 19, 2021
    1,739  Views
    Salesforce Platform Quick Tip: How to Solve Issues with Error Code Validation

    Salesforce Platform Quick Tip: How to Solve Issues with Error Code Validation

    Video in Salesforce Training

    Want to troubleshoot your validation errors faster? Trailblazer and Senior Salesforce Administrator, Monica Doyle walks us through how to add error codes to a validation…

    Salesforce Training, Salesforce Tutorial, Salesforce Administrator, salesforce, salesforce platform
    Vivek Oct 8, 2021
    1,597  Views
    How you can Increase your Salesforce Efficiency and Productivity

    How you can Increase your Salesforce Efficiency and Productivity

    Video in Salesforce Training

    In this video, Brad discusses how to increase your workplace efficiency and productivity using various Google Chrome extensions and techniques. As always, we have linked…

    Salesforce Developer, salesforce, SFDC, Salesforce.com, Google Chrome
    Bradley Jun 3, 2020
    2,162  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

    © 2025 - 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.