question

RingCentral Admin avatar image
RingCentral Admin asked ·

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,

webhooks
1 |1000 characters needed characters left characters exceeded

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

1 Answer

· Write an Answer
Phong Vu avatar image
Phong Vu answered ·

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

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


2 comments Share
1 |1000 characters needed characters left characters exceeded

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 · ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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