Getting this error when I try to download an attachment: Error: Sandbox client is not allowed: xxxxxx. This is our clientId for the sandbox for Fax340b application. Exact scenario is : 1) Received Inbound Fax Event notification. 2) Successfully login into account 3) call get call it is failing with this error. 4) the login info is same as used to subscribe to the incoming fax event. Code snippet below: Followed by call stack.
async function getMessageContent ( platform : any , uri : string ) {
try {
------error and stack---------
(node:70196) UnhandledPromiseRejectionWarning: Error: Sandbox client is not allowed: KTHkwJaQRUiu6es5YR5lOw [2021-11-03T16:57:55.109Z] at Client.<anonymous> (/Users/ajaywadhawan/dev/ch/coach-infrastructure/AzureFunctions/node_modules/@ringcentral/sdk/lib/http/Client.js:115:35) [2021-11-03T16:57:55.109Z] at step (/Users/ajaywadhawan/dev/ch/coach-infrastructure/AzureFunctions/node_modules/@ringcentral/sdk/lib/http/Client.js:56:23) [2021-11-03T16:57:55.110Z] at Object.next (/Users/ajaywadhawan/dev/ch/coach-infrastructure/AzureFunctions/node_modules/@ringcentral/sdk/lib/http/Client.js:37:53) [2021-11-03T16:57:55.110Z] at fulfilled (/Users/ajaywadhawan/dev/ch/coach-infrastructure/AzureFunctions/node_modules/@ringcentral/sdk/lib/http/Client.js:28:58) [2021-11-03T16:57:55.110Z] at processTicksAndRejections (internal/process/task_queues.js:93:5)
You see, you try to access/download a fax from your production using a sandbox app. Where did you read and got that uri?
This domain indicates your production platform.ringcentral.com/.......
It must be media.devtest.ringcentral.com/
Your code to read the message store should be something like this
var endpoint = '/restapi/v1.0/account/~/extension/~/message-store' try { var params = { dateFrom: '2021-07-01T00:00:00.000Z', dateTo: '2021-10-11T23:59:59.999Z', messageType: 'Fax' } var resp = await platform.get(endpoint, params) var jsonObj = await resp.json() if (jsonObj.records.length){ for (var record of jsonObj.records){ if (record.hasOwnProperty('attachments')) downloadAttachments(record.attachments) } } }catch(ex){ console.log(ex.message) }
exception is thrown the sdk file client.js line 115, sendRequest() function. For getting a bad response.
Error: Sandbox client is not allowed: KTHkwJaQRUiu6es5YR5lOw\n at Client.<anonymous> (/Users/ajaywadhawan/dev/ch/coach-infrastructure/AzureFunctions/node_modules/@ringcentral/sdk/lib/http/Client.js:115:35)\n
Are you testing on sandbox and login with a user in your sandbox?
This is exactly what I am doing. I think am getting an authorization error when I call get.
] Error in get URI: Sandbox client is not allowed: KTHkwJaQRUiu6es5YR5lOw
try {
This is exactly what I am doing. I think am getting an authorization error when I call get.
] Error in get URI: Sandbox client is not allowed: KTHkwJaQRUiu6es5YR5lOw
async function getMessageContent(platform: any, uri: string) { try { var resp = await platform.get(uri); console.log("get attachment called."); var buffer = await resp.buffer; console.log("get attachment being buffered."); //await uploadFaxMessageContentToBlob(buffer,"application/pdf");//"image/*") } catch (e) { console.error("Error in get URI: " + e.message); //throw e; } }
Yes . Sending a fax from the same number to the same number.
Sending works fine, Subcribe/Get new Fax notification also works fine, But I am getting this error when try to download the attachment. It is not a problem when I use try in RC developer portal. There I am logged in with my corporate account.
Can you print and share the uri? Mask the account and extension id if you want.
async function getMessageContent(platform:any, uri:string) { console.log(uri)
This is how you can download Fax attachments using JS SDK. Provided that the attachments is an array object you got from a fax message-store record.
var async = require('async') function downloadAttachments(attachments){ async.each(attachments, async function(attachment, callback){ var fileName = "" var fileNameExt = attachment.contentType.split("/") fileName = "fax_attachment_" + attachment.id + "." + fileNameExt[1] var resp = await platform.get(attachment.uri) var buffer = await resp.buffer() fs.writeFileSync(fileName, buffer); }) }
A new Community is coming to RingCentral!
Posts are currently read-only as we transition into our new platform.We thank you for your patience
during this downtime.
Try Workflow Builder
Did you know you can easily automate tasks like responding to SMS, team messages, and more? Plus it's included with RingCentral Video and RingEX plans!Try RingCentral Workflow Builder