question

andres-portilla1204 avatar image
andres-portilla1204 asked mary-community-moderator edited

RingME - passing phone number and dialing directly from first click on my site

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?

rest api
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

benjamin-dean avatar image
benjamin-dean answered
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>

1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys