question

michael-lowery8078 avatar image
michael-lowery8078 asked ·

Webhook multiple postings

I have setup some webhooks and my sytsem does a retrieve when it gets the notification.  however i am getting multple postings for new messages within a split second of each other causing my system to grab the message twice.

is there a way to prevent multiple postings?

here are two examples of whats coming into my system  as you can see they are .013 seconds apart for the same webhook posting


2017-12-06T22:02:06.000Z 18f63cd6-dad1-11e7-a27d-47bec3ea16f9 full event { method: 'POST',
body: 
event: '/restapi/v1.0/account/7213xxxxx/extension/7265xxxxx/message-store',
timestamp: '2017-12-06T22:02:05.965Z',


2017-12-06T22:02:06.013Z 18f5046b-dad1-11e7-8088-1b4040c1d219 full event { method: 'POST',
body: 
event: '/restapi/v1.0/account/7213xxxxx/extension/7265xxxxx/message-store',
timestamp: '2017-12-06T22:02:05.965Z',


topic-default
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.

Tyler Liu avatar image
Tyler Liu answered ·
Are the two messages identical? Could you please post the full content of them?
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.

2017-12-06T22:02:06.000Z 18f63cd6-dad1-11e7-a27d-47bec3ea16f9 full event { method: 'POST',
body: 
{ uuid: '5887210088625434007',
event: '/restapi/v1.0/account/72133xxxx/extension/72654xxxx/message-store',
timestamp: '2017-12-06T22:02:05.965Z',
subscriptionId: '6301c0e8-162b-476b-8e55-13ccef9a5748',
ownerId: '72654xxxx',
body: 
{ extensionId: 72654xxxx,
lastUpdated: '2017-12-06T22:01:59.209+0000',
changes: [Object] } },
headers: 
{ Accept: 'application/json',
'Accept-Encoding': 'UTF-8',
'CloudFront-Forwarded-Proto': 'https',
'CloudFront-Is-Desktop-Viewer': 'true',
'CloudFront-Is-Mobile-Viewer': 'false',
'CloudFront-Is-SmartTV-Viewer': 'false',
'CloudFront-Is-Tablet-Viewer': 'false',
'CloudFront-Viewer-Country': 'US',
'Content-Type': 'application/json; charset=UTF-8',
Host: ' appnotify.co',
TRACE_CONTEXT: '13_42_666_0',
'User-Agent': 'RingCentral-WebHook/8.3',
Via: '1.1 de390f2a4c2c110d009e8b1fc0fb9346.cloudfront.net (CloudFront)',
'X-Amz-Cf-Id': '79L2eg5G19RmHIYwkZsGIDqPyEVR_9OuiPP0eU1GYgA5xbxYgeuZ8g==',
'X-Amzn-Trace-Id': 'Root=1-5a2868dd-752463184cfe54ed5a9dac56',
'X-Forwarded-For': '199.68.212.132, 54.240.144.71',
'X-Forwarded-Port': '443',
'X-Forwarded-Proto': 'https' } }



and 

2017-12-06T22:02:06.013Z 18f5046b-dad1-11e7-8088-1b4040c1d219 full event { method: 'POST',
body: 
{ uuid: '2039667130275555227',
event: '/restapi/v1.0/account/72133xxxx/extension/72654xxxx/message-store',
timestamp: '2017-12-06T22:02:05.965Z',
subscriptionId: 'a38ebf5a-4d79-48f3-8376-92d5e011e025',
ownerId: '72654xxxx',
body: 
{ extensionId: 72654xxxx,
lastUpdated: '2017-12-06T22:01:59.209+0000',
changes: [Object] } },
headers: 
{ Accept: 'application/json',
'Accept-Encoding': 'UTF-8',
'CloudFront-Forwarded-Proto': 'https',
'CloudFront-Is-Desktop-Viewer': 'true',
'CloudFront-Is-Mobile-Viewer': 'false',
'CloudFront-Is-SmartTV-Viewer': 'false',
'CloudFront-Is-Tablet-Viewer': 'false',
'CloudFront-Viewer-Country': 'US',
'Content-Type': 'application/json; charset=UTF-8',
Host: ' appnotify.co',
TRACE_CONTEXT: '13_42_666_0',
'User-Agent': 'RingCentral-WebHook/8.3',
Via: '1.1 903af4f08e8327b236ac118f3e021063.cloudfront.net (CloudFront)',
'X-Amz-Cf-Id': '7dUz_HJvZxFyAI219m1BfvK3egncbDFXnms1db8xHfMkSpPCwvh5iA==',
'X-Amzn-Trace-Id': 'Root=1-5a2868dd-30004c1916a1e3fc396efaac',
'X-Forwarded-For': '199.68.212.132, 54.240.144.65',
'X-Forwarded-Port': '443',
'X-Forwarded-Proto': 'https' } }
0 Likes 0 · ·
changes: [Object]  

Do not know the content of [Object]. Can you do a JSON.stringify(message, null, 2) and post them?
0 Likes 0 · ·
igor-bebin avatar image
igor-bebin answered ·
Hi Michael, 

As I can see susbcription IDs are different:
> subscriptionId: '6301c0e8-162b-476b-8e55-13ccef9a5748',
> subscriptionId: 'a38ebf5a-4d79-48f3-8376-92d5e011e025',

If you've created 2 WebHook subscriptions for the same event, e.g. message-store updates, then you'll receive 2 notifications generated from 1 event in the System. Could you please advise what is the Use Case of creating several WebHook subscriptions for the same event filters?

Thanks,


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.

There is no use case for creating the multiple subscriptions.   i assumed new ones over wrote older ones.  it seems i need to do a check and clean out repeats 
0 Likes 0 · ·
Correct, to avoid duplicated notifications you should keep only one active subscription in this case. 

You can check subscriptions list via Subsciption List API and remove unnecessary, see below: 
https://developer.ringcentral.com/api-explorer/latest/index.html#/!/Push_Notifications/loadSubscript...

Also now is possible to create long-live WebHook subscription, with ttl up to 20 years. Maybe it might help to resolve your scenarios. 

Thanks,
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.