Alan Christensen avatar image
Alan Christensen asked Phong Vu commented

Webhook Subscription - How to clear one created by another user?

I have ended up with 2 subscriptions sending me webhook events. I don't know how to delete the old one.

The scenario:
User A ran the OAuth flow. My app is using that user for authentication. The app created a webhook subscription to /telephony/session events for some extensions.

Something happened to my refresh token. So User B logs into my app and runs the OAuth flow. So now my app is using an access token for User B. The app checks the subscriptions to make sure they are up to date. The app sees no subscriptions for User B so it creates a new subscription. At the same time the subscription from User A is still sending webhook events. Now my app is receiving duplicate events.

How do I delete the subscription for User A?

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

Notification subscription is per user. In app scenario, you should authenticate the app with just one user (if possible, use password flow authentication). If not that, you can keep the subscription id in your database (possible with the owner) and user B will need to check if the subscription exists then don't create a new one. However, user B's access token cannot be used to renew user A's subscription. So make sure the subscription lives long enough without the need to renew it.

I have not try this but you can help test it and share your finding. Give user A and user B a super admin role and try to delete other's user subscription to see if works.

1 |3000

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

I got a 404. When I tested User A deleting User B's subscription. Both users were Super Admin.

0 Likes 0 ·

Thanks for sharing! That is what thought as expected too.

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