Solved

Using WebHook Renewal Event Filter

  • 27 June 2020
  • 1 reply
  • 456 views

I set up a WebHook and that is working fine, and I set up a Renewal Event Filter when creating the subscription.

/restapi/v1.0/subscription/~?threshold=15&interval=5

I receive the first webhook call with this as the event, but I dont understand what the documentation means about a Put to the webhook endpoint

I can of course call Renew the normal way but that doesnt seem to cause subsequent calls to the webhook with the expiration event


Update & Renew a Webhook

To update a webhook, make a PUT call to the webhook endpoint with the required event filters specified in the request body. Each PUT call, either sent with the event filters or with an empty body, automatically renews the subscription, updating its expiration time.

The renew a webhook, you can also make a POST call to the subscription renew endpoint.


icon

Best answer by Phong1426275020 27 June 2020, 16:52

View original

1 reply

This params "threshold=15&interval=5" will set a reminder to notify your app when your webhook is about to expire.

Let's say you have subscribed successfully for a webhook notification for inbound fax events

POST "/restapi/v1.0/subscription"
{ 
   eventFilters:[
    "/restapi/v1.0/account/xxxxx/extension/yyyyy/fax?direction=Inbound"
   ],
   ...
}

And you get the subscription id "ed329ec1-0600-4560-b6dc-c764399e9a54"

Later on, you also want to receive SMS notification for that extension. You should avoid creating a new subscription. Instead, you can update the inbound fax notification to notify also SMS event. This is when you will need to update your existing subscription with the PUT method

PUT "/restapi/v1.0/subscription/ed329ec1-0600-4560-b6dc-c764399e9a54"
{
   eventFilters = [
    "/restapi/v1.0/account/xxxxx/extension/yyyyy/fax?direction=Inbound",
    "/restapi/v1.0/account/xxxxx/extension/yyyyy/message-store/instant?type=SMS"
   ]
}

Now, your webhook will get notification for Inbound faxes and instant SMS.

After some time, your webhook expires (you will receive reminders if you set the threshold and interval). This is when you will need to renew your existing subscription. You can renew an existing subscription in 2 ways.

POST "/restapi/v1.0/subscription/ed329ec1-0600-4560-b6dc-c764399e9a54/renew"
// OR
PUT "/restapi/v1.0/subscription/ed329ec1-0600-4560-b6dc-c764399e9a54"

Both ways without the body payload.

Hope this helps.

Reply