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
Webhook to receive outbound fax events
Tags: webhooks, fax
Jul 20, 2023 at 11:05am   •   1 replies  •  0 likes
Shijun Deng

Hi,

I am implementing a feature which tracks all sent faxes on a NodeJS backend. I don't want to request the API regularly, but subscribe a notification to received events and take actions based on the events.

I checked the documents, the fax sending event tracks inbound faxes, from my understanding, this is for tracking all received faxes, and my final finding is to subscribe Message Events with the following eventFilter

/restapi/v1.0/account/{accountId}/extension/{extensionId}/message-store?type=Fax&direction=Outbound

I added a subscription with this eventFilter, sent several faxes to test this webhook, and found the following two types of events

  1. events with newCount > 0 which means new faxes have been created. in this case, a field called newMessageIds will be attached and I can easily find out the newly created fax with messageStatus and readStatus
  2. events with updatedCount > 0, which means, usually, the status of some faxes have been updated, i.e. a fax has been sent successsfully. But in this case, there is no information indicated which faxes have been updated, here is a sample req.body I received for this type of events:
{
    uuid: "********************",
    event: "/restapi/v1.0/account/**********/extension/*******/message-store",
    timestamp: "2023-07-19T15:40:12.734Z",
    subscriptionId: "********-****-****-****-************",
    ownerId: "********",
    body: {
      accountId: ********,
      extensionId: ********,
      lastUpdated: "2023-07-19T15:40:00.232Z",
      changes: [
        {
          type: "Fax",
          newCount: 0,
          updatedCount: 1,
          newMessageIds: []
        }
      ]
    }
  }

My question is: is there a way to figure out precisely which faxes have been updated in this case? or the eventFilter is wrong to do such a job? if yes, which one to use? Thanks

1 Answer
answered on Jul 20, 2023 at 2:57pm  

You did a good job in learning, trying and explaining how the notification works so far.

Unfortunately, what you are facing is the limitation of the message store event notification for changed events, which do not include the message id of a message that got updated. This limitation has been discussed internally several times and we still don't have a solution for it.

The only option as a workaround solution is to first catch the event with newCount, call the message store with the message id to detect the Fax message status, if it is not Delivered or Failed, then keep the message id in an array and poll again when you get the updated events.


 0
on Jul 24, 2023 at 7:07am   •  0 likes

Thank you for your reply.

After comparing the information of several faxes, I found that the values of lastUpdated in the message event and lastModifiedTime in the record are very close. In the few faxes I tested, the two are basically the same, or the difference is only a few milliseconds. Can we reliably use this situation to make decisions?



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