question

hack7995 avatar image
hack7995 asked Phong Vu commented

Problem connecting Alexa with RingCentral Messaging

I have created an Alexa skill based on a post by Phong Vu for Turning Alexa into Your Personal Messaging Assistant. When I invoke my skill Alexa says "Hi <MyName>Unfortunately, your account does not support SMS message."


I have confirmed that my sandbox account has the SMS permission granted.


So what do I need to do to resolve this issue?

sdk
1 |3000

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

Phong Vu avatar image
Phong Vu answered
Hi Hack, The error message is just for all failures. Can you log the error/response and see what is the actual reason why it failed. + Phong
1 |3000

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

hack7995 avatar image
hack7995 answered Phong Vu commented
Hi Phong,

It seems to fail where the comment shows "should check if there is no direct number" in the index.js file of my Lambda function.  The CloudWatch log doesn't show any errors.

Hack
10 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.

Phong Vu avatar image Phong Vu ♦♦ commented ·
Can you add this block into your code after the for (var record of .. loop

if (!thisHandler.attributes['ownPhoneNumber']) {
    for (var record of jsonObj.records){
        if (record.usageType == "MainCompanyNumber"){
            thisHandler.attributes['ownPhoneNumber'] = record.phoneNumber.replace("+", "") + "*" + thisHandler.attributes['extensionNumber']
            break;
        }
    }
}
console.log("own number: " + thisHandler.attributes['ownPhoneNumber'])

If it still does not work, check the log to see if it can find your own number.

+ Phong
0 Likes 0 ·
hack7995 avatar image hack7995 commented ·
Phong,

Thanks... I think the problem may have been that I was publishing a package-lock.json file in the zip file I was uploading to my Lambda function.

Anyway, for some reason the skill appears to be  partly working now, and my number does appear in the log.  The reason I say partly is because when I try to send a reply to a text message that gets read back to me through the Alex Service Simulator, it doesn't successfully allow me to reply to the message.  After I formulate my reply message body, Alexa asks me if I want to send the message.  When I say yes, Alexa responds with, "Sorry I cannot send the message, please try again".

Also, is there functionality with the RingCentral API to allow you to retrieve voice mail messages?
0 Likes 0 ·
hack7995 avatar image hack7995 commented ·
On the reply, it doesn't appear to be grabbing my from.phoneNumber. Here's what the log was showing:

{ Error: Parameter [from.phoneNumber] value is invalid
at EventEmitter.<anonymous> (/var/task/node_modules/ringcentral/src/http/Client.js:62:38)
at process._tickDomainCallback (internal/process/next_tick.js:135:7)
0 Likes 0 ·
Phong Vu avatar image Phong Vu ♦♦ commented ·
Can you print out this.attributes['ownPhoneNumber'] and check if that is your account/extension phone number?

For voicemail, please complete and try this code
platform.get('/account/~/extension/~/message-store', {     messageType: "VoiceMail",     readStatus: "Unread",     direction: "Inbound",     dateFrom: "2017-07-07T23:59:59.999Z" // any day you want     })     .then(function (response) {         //console.log(response)         var records = response.json().records;         var count = records.length;         var voiceMailsArr = []         if (count > 0) { //if there is a voicemail             for (var i=count-1; i>=0; i--) {                 var record = records[i]                 ...

Remember that you have to implement Alexa audio player directive to playback voicemails. You cannot use SSML because of Alexa required audio format is different from RC voicemail audio format.

+ Phong
0 Likes 0 ·
hack7995 avatar image hack7995 commented ·
Yes, in the CloudWatch logs it is showing my phone#*extension after own number: which is being output to the console.

Also, I only have the one Super Admin user setup in the sandboxed account, so I'm not sure if that matters. Since it was the From number that appeared to be causing the issue, I looked at my RingCentral Settings for that Super Admin user.  I notice that it doesn't have a number listed for the user (it shows N/A), but it does have a number for the main account.  Could this be causing the issue?
0 Likes 0 ·
Show more comments

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