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

    isvs salesforce appexchange

    The DreamPlace For ISVs – Salesforce AppExchange

    Blog in AppExchange, Salesforce

    To sustain in this competitive market, independent software vendors (ISVs) must get their products behave and respond in the fastest of fashion. ISVs are turning…

    AppExchange, Application Deployment, Application Market Place, Business Applications, Business Success
    Algoworks May 12, 2020
    1,923  Views
    Salesforce-Customization-for-Business

    Grow Your Small Business Into A Large Enterprise With The Right Salesforce Customization

    Blog in Others

    Do you know that Salesforce releases tri-annual updates? Do you also know that Salesforce can accommodate thousands of customizations right from your email suite to…

    Business Success, Customer Success, Opportunity, ROI, Salesforce Consultants
    William Nov 13, 2018
    4,383  Views

    Marketing Cloud vs Pardot: What's the difference?

    Blog in Salesforce Products

    Whether you're a marketer or a CXO of a company, you must understand the challenges of attracting prospects and nurturing leads through the sales funnel.…

    Automation Platform, Complex Marketing Requirements, CRM Integration, Customer Data, Customer Engagement
    Cymetrix Jun 24, 2024
    1,078  Views

    Popular Salesforce Videos

    How to Create a New User in Salesforce Marketing Cloud

    How to Create a New User in Salesforce Marketing Cloud

    Video in Salesforce Training

    Cameron Robert steps through how to Create a New User in Salesforce Marketing Cloud and then assigns them Roles and Associates them with Business Units. Key…

    Salesforce Training, salesforce, Salesforce Marketing Cloud, Salesforce Video, Salesforce Learning
    Cameron Aug 8, 2022
    2,492  Views
    Salesforce Consultant Career | Salesforce Career Path | Salesforce Consultant Certification

    Salesforce Consultant Career | Salesforce Career Path | Salesforce Consultant Certification

    Video in Salesforce Certifications, Salesforce Consultant

    If you're interested in becoming a Salesforce consultant, one of the first things to consider is how much education you need. We've determined that 60.2%…

    Salesforce Training, Salesforce Certification, salesforce consultants, Salesforce Video, Salesforce Learning
    Rupal Kakkar Jan 5, 2021
    1,307  Views
    Salesforce Consumer Goods Cloud Demo

    Salesforce Consumer Goods Cloud Demo

    Video in Others, Salesforce Stories

    Salesforce Consumer Goods Cloud is an intelligent, seamless B2B CRM solution specifically designed for the consumer goods industry. Watch this video to learn more.

    Salesforce Training, salesforce, Salesforce Video, Salesforce Learning, B2B
    Abhishek Dec 24, 2020
    2,219  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.