question

Vadym Polishchuk avatar image
Vadym Polishchuk asked Phong Vu answered

Can I use ~ instead of specifying concrete extension when making `Send SMS` API call on behalf of different users?

Let's say I have a RingCentral account with 10 users with different extensions and one admin user. Admin user logins into my app and provides credentials (access/refresh tokens). After that I can use ~ instead of `extension` when making API calls to, let's say, get list of all phone numbers of the account. But If I want to send SMS using API from some user (out of those 10), do I have to get their extension id and specify it in the url when making API call, or can I just use ~ instead? It's important, that the caller ID of this user is shown to the person who I intend to send message to.

rest apisms and text messagingsending sms
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

Phong Vu avatar image
Phong Vu answered

No you cannot. You cannot send SMS on behalf of the owner of the phone number. In other words, you can only send SMS messages from your own phone number, even if you are a super admin user.

The tilde ~ at the /extensionId/ represents the extension id of the user who calls that API. The server recognize the extension id using the access token that is used to call the API.

To send SMS messages on behalf of other user extensions, you must implement your app to allow each of the users logins your app (at lease once), then you will keep the access token (valid max. 1 hr) and the refresh token (valid max. 7 days) of that user securely in your server (db). You will need to handle auto refresh to make sure that the refresh token will be always valid. Every time you refresh the token, a new access token and new refresh token will be issued and you have to replace the old tokens in your db.

When your app sends SMS on behalf of a user, check if that user has logged in and if the access token is still valid, use the access token to send the SMS message. If the access token expired, use the refresh token to get a new access token and use the new access token to send the SMS message. Remember to save the new tokens in your db.


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