Denis Kostromitskiy avatar image
Denis Kostromitskiy asked Phong Vu answered

Best practices for syncing calls into external system

Hey, guys.

I have just recently started working with Ringcentral platform and Ringcentral API in particular. The Developer Guide and API Reference are well written and contain a lot of helpful information.

The thing I'm missing though are some guides on how to cover specific workflows.

The task I have is to sync calls users made in Ringcentral to external CRM app.

I figured it would be good to use a webhooks for that matter.
I subscribe to Account Telephony Sessions Event for Disconnected calls only.


As far as I can tell, there are about 3-4 "Disconnected" webhooks fires for every call.
So I need to filter those somehow to process only one that I really need.

By trial and error I found out that webhooks with "reason" ('body', 'parties', 0, 'status', 'reason') CallerInputRedirect and BlindTransfer can be ignored (?).
Maybe something else can be dropped?

Then I drop webhooks without "extensionId" ('body', 'parties', 0, 'extensionId').
Finally, I want to skip internal calls. Not sure what's the best way to do this, but right now here is the logic:

Internal inbound call: ('body', 'parties', 0, 'direction') == 'Inbound' && ('body', 'parties', 0, 'from', 'extensionId').present?
Outbound call: ('body', 'parties', 0, 'direction') == 'Outbound' && ('body', 'parties', 0, 'to', 'extensionId').present?

To get detailed information about a call is expensive API operation, so need to use as much information as possible from the webhook data.

If webhook passes all these checks, I call call-log API to get detailed information about the call, like duration, start time, recording etc. and create corresponding record in CRM.


So the question is does all the precaution checks I use makes sense or can I tweak/simplify it in any way? Or maybe something is missing in my flow.
And in general, is webhook approach is the right solution here or maybe Sync Company Call Log would be more appropriate.
Any advice is greatly appreciated.

webhookscall logs
1 |3000

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

1 Answer

Phong Vu avatar image
Phong Vu answered

If you just need to export/sync the call log data from your RingCentral account to your own database, you can use the read account call log API or the call log sync API to do so. Please read these articles to learn more and come back if you have further questions.

If you really want to create your own call log in real time using the raw data, you can use the telephony session events notifications and parse the event payload. However, this will be much more complicated than the other option. Please read these articles to learn more about the telephony session events

1 |3000

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

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