News & Announcements User Community Developer Community

Welcome to the RingCentral Community

Please note the community is currently under maintenance and is read-only.

Search
Make sure to review our Terms of Use and Community Guidelines.
  Please note the community is currently under maintenance and is read-only.
Home » Developers
Message Store Report Simultaneous Requests
Tags: rest api
Aug 18, 2021 at 1:08pm   •   2 replies  •  0 likes
Mike Corrente

My app subscribes to message notifications and automatically imports faxes to our CRM. These are mission-critical to us, so to make sure we don't miss anything I also periodically request a message store report (say once every ten minutes, looking back 12 minutes). These are going to be very small reports.

I'm getting an unexpected response (429) Too Many Requests:

{

"errors" : [ {

"errorCode" : "PIC-020",

"message" : "Data export is limited to [numberOfRequests] simultaneously executing requests.",

"numberOfRequests" : "2"

} ]

}

Seems pretty self-explanatory - I already have two reports executing. The thing is, I don't think I do. These reports return pretty quickly because of the narrow time range, so the code is run synchronously. The only thing I can think of is that a report was requested and the code terminated unexpectedly and an orphaned report or two is out there still executing and blocking additional reports.

I'm trying to figure out how to handle this. Is there a way to get a list of message store report tasks? I know how to put task info if I have the taskId, but obviously I don't have the taskId for a task I don't know about.

Is there a better way to be doing this? I've worked with enough webhooks to know they're not foolproof, and missing some of these faxes would be VERY expensive for us.



2 Answers
answered on Aug 19, 2021 at 10:20am  

Reading the account level and detailed view, you should get the legs info and there will be 2 legs. The fax message details should be in the second leg. Here is my example record

{
    "uri": "https://platform.ringcentral.com/restapi/v1.0/account/xxxxx/call-log/NwY6raZCz1whzxx?view=Detailed",
    "id": "NwY6raZCz1whzxx",
    "sessionId": "665203367016",
    "startTime": "2021-08-19T16:27:34.135Z",
    "duration": 42,
    "type": "Fax",
    "internalType": "LocalNumber",
    "direction": "Inbound",
    "action": "Incoming Fax",
    "result": "Received",
    "to": {
      "phoneNumber": "+1626380xxxx"
    },
    "from": {
      "name": "RINGCENTRAL",
      "phoneNumber": "+1650513xxxx",
      "location": "San Mateo, CA"
    },
    "telephonySessionId": "s-0de91b408246444599d4d3103ffc9fd2",
    "transport": "PSTN",
    "lastModifiedTime": "2021-08-19T16:28:30.368Z",
    "billing": {
      "costIncluded": 0,
      "costPurchased": 0
    },
    "legs": [
      {
        "startTime": "2021-08-19T16:27:34.135Z",
        "duration": 42,
        "type": "Fax",
        "internalType": "LocalNumber",
        "direction": "Inbound",
        "action": "Incoming Fax",
        "result": "Received",
        "to": {
          "phoneNumber": "+1626380xxxx"
        },
        "from": {
          "name": "RINGCENTRAL",
          "phoneNumber": "+1650513xxxx",
          "location": "San Mateo, CA"
        },
        "telephonySessionId": "s-0de91b408246444599d4d3103ffc9fd2",
        "transport": "PSTN",
        "billing": {
          "costIncluded": 0,
          "costPurchased": 0
        },
        "legType": "CallBack",
        "master": true
      },
      {
        "startTime": "2021-08-19T16:27:34.162Z",
        "duration": 42,
        "type": "Fax",
        "internalType": "LocalNumber",
        "direction": "Inbound",
        "action": "Incoming Fax",
        "result": "Received",
        "to": {
          "name": "Paco",
          "phoneNumber": "+1626380xxxx",
          "extensionId": "62288329016"
        },
        "from": {
          "name": "RINGCENTRAL",
          "phoneNumber": "+1650513xxxx",
          "location": "San Mateo, CA"
        },
        "message": {
          "uri": "https://platform.ringcentral.com/restapi/v1.0/account/xxxxxxxx/extension/xxxxxxxx/message-store/1547175155016",
          "id": "1547175155016",
          "type": "Fax"
        },
        "extension": {
          "uri": "https://platform.ringcentral.com/restapi/v1.0/account/xxxxxxxx/extension/xxxxxxxx",
          "id": 62288329016
        },
        "telephonySessionId": "s-0de91b408246444599d4d3103ffc9fd2",
        "transport": "PSTN",
        "legType": "CallBack"
      }
    ]
  }

If you don't see the same, can you share the entire record data (REMOVE SENSITIVE INFO SUCH AS real phone number, account Id. OR, give it some time and read again.


 0
on Aug 19, 2021 at 10:46am   •  0 likes

I think that's what I'm doing. I do notice that the only Inbound fax that has a Message object has two legs and the rest have one.

Here's what I used to get the test fax I sent myself earlier:

https://platform.devtest.ringcentral.com/restapi/v1.0/account/~/call-log/Aij5Pe5YqyWgzUA?view=Detailed

Attached the JSON. It shows it as a Received fax, but only one leg with no Message object:

CallRecJson.txt


on Aug 19, 2021 at 10:49am   •  0 likes

That fax was received almost 3 hours ago. I'd hope that would be enough time for any additional legs to be viewed in the log. Still, all the other log entries have the same issue - even faxes from last week. Only one leg.

on Aug 19, 2021 at 3:56pm   •  0 likes

Can you try this endpoint to see if you could read the fax message and attachment

on Aug 19, 2021 at 5:08pm   •  0 likes

Yes, I can see the fax and attachment. Unfortunately, that endpoint requires an extension, and the call log report doesn't seem to provide an extension id except in the call legs that already have the message. Easy in the sandbox when I only have a couple extensions. Live account has over 50.

on Aug 20, 2021 at 11:18am   •  0 likes

I have tested again on my sandbox account and it works as expected. Can you send a new fax to your sandbox and read it again. Ignore those old faxes for now. Or, graduate your app to the production env. and test on your production data.

on Aug 20, 2021 at 11:31am   •  0 likes

I tried sending a fax to my sandbox number just now, and the call log still only shows one leg with no message. I will try on production, but I'm going to have to set up a new app and graduate it because I didn't include Call Log permissions with this current app. Will take a minute.

on Aug 20, 2021 at 11:33am   •  0 likes

Give me the app client id, I can help adding the missing permission quickly

on Aug 21, 2021 at 10:30am   •  0 likes

Sorry, Phong - I didn't notice this last comment so I just went ahead and jumped through the hoops.

It looks like Call Log records on the production side all have message objects for Received or Partial Receive incoming faxes, so this should work.

Thanks so much for your help.

answered on Aug 19, 2021 at 6:50am  

The max number of simultaneous tasks per account is 2 and you have existed it. And if I remember correctly, the message store export is limited to max 20 tasks per day. Anyway, the message store export APIs are more for archiving for compliant purpose and you should not use it in this scenario.

You can use the Company Call Log and set the query params to read Fax only (type=Fax) and set the period of time using dateFrom and dateTo accordingly.


 0
on Aug 19, 2021 at 8:05am   •  0 likes

Thanks for the response.

I'm playing around with the Company Call Log endpoint, but I'm not getting enough info to pull the fax. I've uploaded the JSON response of a call report from our sandbox account. I can see all the faxes, but I'm getting Message objects for only some of them. Looks like I'm getting a Message object for all the outgoing faxes, but only on one of the five incoming faxes. I thought it was because many of them were marked as "Partial Receive", but that's not it. The only Message object I got on a received fax was for a "Partial Receive" - the two "Received" have no Message object.

Is there a way to get the contents of a fax without a Message? I know it's in there because I can call Get Message List and see it.

CallLogJson.txt



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

PRODUCTS
RingEX
Message
Video
Phone
OPEN ECOSYSTEM
Developer Platform
APIs
Integrated Apps
App Gallery
Developer support
Games and rewards

RESOURCES
Resource center
Blog
Product Releases
Accessibility
QUICK LINKS
App Download
RingCentral App login
Admin Portal Login
Contact Sales
© 1999-2024 RingCentral, Inc. All rights reserved. Legal Privacy Notice Site Map Contact Us