question

Lucas Heneks avatar image
Lucas Heneks asked Lucas Heneks 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.



smssdkpermissions
1 |1000

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 Sen Chowdhary avatar image
Anirban Sen Chowdhary answered Lucas Heneks 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).

1 comment
1 |1000

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

Lucas Heneks avatar image Lucas Heneks commented ·

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 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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