question

RingCentral Admin avatar image
RingCentral Admin asked Phong Vu commented

Webhook callback for company wide number

Hello @Phong Vu,

We have a production app (via API) where we can call a number and a web hook callback is sent. We use the following to set it up (Ruby):


    rc = RingCentral.new(RINGCENTRAL_CLIENTID, RINGCENTRAL_CLIENTSECRET, RINGCENTRAL_SERVER)
    rc.authorize(username: RINGCENTRAL_USERNAME, extension: RINGCENTRAL_EXTENSION, password: RINGCENTRAL_PASSWORD)
    r = rc.post('/restapi/v1.0/subscription', payload: {
        eventFilters: ["/restapi/v1.0/account/~/extension/~/presence?detailedTelephonyState=true"],
        deliveryMode: {transportType: 'WebHook', address: DELIVERY_ADDRESS, verificationToken: VERIFICATION_TOKEN},
        expiresIn: 604800
    })


The problem is, we get the callback only when calling RINGCENTRAL_USERNAME (which is a phone number). But we have our sales team responding to a office wide RC company phone number. When that number is called we do not get any webhook callback. What we have to do so that we get a web hook callback when someone calls the office wide RC company phone number?

Warm regards,

caller id
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 Phong Vu commented

Simply change the event filter to use the account presence event.

eventFilters: ["/restapi/v1.0/account/~/presence?detailedTelephonyState=true"]


2 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.

Many thanks! We now get webhook callbacks. But one more thing. There are about 10 sales people using RingCentral and I get 6 webhook calls (because at that time 6 were online). What API call I have to make to figure out who is the associated user for a webhook call. Maybe use partyId as an identifier in the API call?

0 Likes 0 ·

The info is in the notification payload .body. You will receive something like this:

{ extensionId: 186478004,
  telephonyStatus: 'Ringing',
  activeCalls:
   [ { id: 's-16627a838cb84af680640dbbc87fb327',
       direction: 'Inbound',
       fromName: 'Francisco Vu',
       from: '+1650513xxxx',
       toName: 'Colin Arlington',
       to: '102',
       telephonyStatus: 'Ringing',
       sessionId: '21615716004',
       startTime: '2019-10-16T15:28:29.646Z',
       partyId: 'p-16627a838cb84af680640dbbc87fb327-3',
       telephonySessionId: 's-16627a838cb84af680640dbbc87fb327' } ],
  sequence: 1845,
  presenceStatus: 'Available',
  userStatus: 'Available',
  dndStatus: 'TakeAllCalls',
  message: 'Available till 5:00pm',
  totalActiveCalls: 1 }
0 Likes 0 ·

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