question

Lucas Heneks avatar image
Lucas Heneks asked NuCare Admin commented

SMS - error: phone number doesn't belong to extension

Hello,

We are trying to use the javascript sdk to send SMS messages.

We use the main extension to login to the sdk, and pass a users RingCentral number as the from parameter. We receive the error "error: phone number doesn't belong to extension" as a response.


Here is some code we are using to test.


async function send() {
    const sdk = new SDK(config.ringCentral)
    await sdk.platform().login({
        username: config.ringCentral.user,
        extension: config.ringCentral.mainExt,
        password: config.ringCentral.pw
    })

    const message = {
        from: { phoneNumber: '1<Ring Central number>' },
        to: [{ phoneNumber: '1<my cell number>' }],
        text: 'this is a test message'
    }

    const res = await sdk.platform().post('/restapi/v1.0/account/~/extension/~/sms', message)
    console.log(res.data)
}


Any assistance you can provide is appreciated.



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

Anirban avatar image
Anirban answered NuCare Admin commented

The error is self explanatory. It indicate that the phone Number does not belong to the extension (or user) who logged in to run the application. You need to use the direct number assigned to that user (extension).

2 comments
1 |3000

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

So is it the case that RingCentral doesn't support having a service account that can send messages on behalf of other numbers in the org?

0 Likes 0 ·

Hi . Greetings.

I am currently working on sandbox environment, and my phone number is associated to my account. But when I try to test sms api, it returns an error "Phone number doesn't belong to extension"

{ "to" : [{ "phoneNumber" : "+171xxxxxxxx " }], "from" : { "phoneNumber" : "+147xxxxxxxx}" }, "text" : "Test SMS message from Platform server" }


What's wrong?

Please let me know your thoughts.

Thanks.

0 Likes 0 ·

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