News & Announcements User Community Developer Community

Welcome to the RingCentral Community

Please note the community is currently under maintenance and is read-only.

Search
Make sure to review our Terms of Use and Community Guidelines.
  Please note the community is currently under maintenance and is read-only.
Home » Developers
RingME - passing phone number and dialing directly from first click on my site
Tags: rest api
Feb 18, 2016 at 1:31pm   •   1 replies  •  0 likes
andres-portilla

We would like to use a RingME button (https://support.ringcentral.com/article/How-to-setup-a-Ring-Me-button-on-my-page.html) but instead of having the customer enter his/her phone number in a new screen, we would like to pass the phone number for customers who are logged into our website on a post or a get variable directly to the ringcentral server or at least to the new window and dial to make it easier for the customer.


How can we get that done?

1 Answer
answered on Feb 19, 2016 at 5:01pm  
There are always multiple ways to achieve these types of use-cases, but here is how I would approach this situation...

Use the RingCentral JS SDK in your Website's Client, and pre-populate with your authenticated user's phone number:
 // Initialize the SDK var sdk = new RingCentral.SDK({     server: 'https://platform.ringcentral.com',     appKey: 'yourAppKey',     appSecret: 'yourAppSecret' });  // Assign the RingCentral Platform Singleton var platform = sdk.platform();  // Example function to implement ad-hoc style token managament // Authenticate to RingCentral and make a phone call using supplied number function preformattedRingOut(endUserPhoneNumber) {     if(!endUserPhoneNumber) {         // Error handling for this sanity check     }     // Authenticate and ringout     platform.login({             username: '<REPLACE_WITH_PHONE_NUMBER>', // Number of destination user account or admin<br>            extension: '', // leave blank if direct number is used<br>            password: '<REPLACE_WITH_ASSOCIATED_ACCOUNT_PASSWORD>'<br>        })<br>        .post('/account/~/extension/~/ringout', {<br>            from: {phoneNumber: String(endUserPhoneNumber)},<br>            to: {phoneNumber: String(<REPLACE_WITH_DESTINATION_NUMBER)},             callerId: {phoneNumber: 'endUserPhoneNumber'}, // optional,             playPrompt: false // optional<br>        .then(function(ajax) {<br>            // Application logging<br>        })<br>        .catch(function(e) {<br>            alert(e.message  || 'Server cannot authorize user');<br>        });<br>}  You can find a more comprehensive example of using RingOut with the RingCentral JS SDK here: <a href="https://github.com/ringcentral/ringcentral-js#making-telephony-calls">https://github.com/ringcentral/ringcentral-js#making-telephony-calls</a>


 0



A new Community is coming to RingCentral!

Posts are currently read-only as we transition into our new platform.

We thank you for your patience
during this downtime.

Try Workflow Builder

Did you know you can easily automate tasks like responding to SMS, team messages, and more? Plus it's included with RingCentral Video and RingEX plans!

Try RingCentral Workflow Builder

PRODUCTS
RingEX
Message
Video
Phone
OPEN ECOSYSTEM
Developer Platform
APIs
Integrated Apps
App Gallery
Developer support
Games and rewards

RESOURCES
Resource center
Blog
Product Releases
Accessibility
QUICK LINKS
App Download
RingCentral App login
Admin Portal Login
Contact Sales
© 1999-2024 RingCentral, Inc. All rights reserved. Legal Privacy Notice Site Map Contact Us