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

    Agentforce vs Traditional Chatbots: Why AI Agents Are the Future of Support

    Blog in Salesforce

    In recent years support systems evolved rapidly. Traditional chatbots serve basic tasks using rules and flows. AI agents (also called “agentic AI” or intelligent agents)…

    Chatbot Development Company
    Casey Sep 11, 2025
    749  Views
    schema class

    Schema Class in Salesforce Apex | The Developer Guide

    Blog in Others, Salesforce Apex

    INTRODUCTION: Schema is a Namespace which is referred as Database. This namespace contains some classes and their methods to provide metadata information of Schema. Schema…

    Custom and Standard Objects, Metadata Information, Salesforce, Salesforce Apex, Schema
    Anuj May 13, 2020
    36,026  Views
    appexchange

    Building Apps Using Salesforce AppExchange

    Blog in AppExchange, Salesforce

    Introduction Salesforce AppExchange was launched in 2005. Salesforce AppExchange is an Online Store just like the 'Play store' in Android phones. It is the marketplace…

    App Features, App Licensing, App on AppExchange, App on the AppExchange Market, AppExchange Security Review
    Anuj Sep 7, 2020
    6,145  Views

    Popular Salesforce Videos

    Salesforce Beginner Interview Questions and Answers Full Length Video [2023]

    Salesforce Beginner Interview Questions and Answers Full Length Video [2023]

    Video in Salesforce Training, Salesforce Admin

    Watch this video to get to know about Salesforce Beginner Interview Questions and Answers Full-Length Video [2023]. 00:00:00 Introduction 00:02:56 Sandbox 00:05:05 Process Builder 00:09:00…

    Salesforce Training, Salesforce Tutorial, Salesforce Certification, Salesforce Developer, salesforce
    CRS Feb 24, 2023
    1,651  Views
    Access Salesforce Maps Schedule and Manage Saved Events

    Access Salesforce Maps Schedule and Manage Saved Events

    Video in Salesforce Training

    Watch this video to learn how to Access Salesforce Maps Schedule and Review and Manage Saved Events. Do let us know in the comment section…

    Salesforce Training, Salesforce Tutorial, Salesforce Video, Salesforce Learning, Salesforce Maps
    Abhishek Aug 24, 2021
    1,783  Views
    Sandbox Design Strategies for Enterprise Implementations

    Sandbox Design Strategies for Enterprise Implementations

    Video in Salesforce Apex

    It is inevitable to avoid Sandboxes in most enterprise implementations. As different teams work on different processes like testing, development, pre-release, and final rollout, it…

    Salesforce Apex, salesforce, Sandbox Design Strategies, Sandbox Design, Enterprise Implementations
    Jogender Apr 1, 2020
    1,961  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.