# Subscription management

Webhook reception requires you subscribe to them first. While a single subscription allows you to receive all webhooks, you can also register multiple endpoints to receive different events.

During the subscription, if you don't specify an explicit list of webhooks that you whish to receive, you will automatically subscribe to all events.

Info icon

Information – The {webhooksBaseUrl} variable in this article differ from your {baseUrl}

  • https://webhook.sandbox.treezor.co in Sandbox
  • https://webhook.api.treezor.co in Production
Gear icon

Configuration – You may need assistance for your {accessToken}

While the {accessToken} should be either your BaaS API key or your Connect JWT token, webhook subscription may require an action from Treezor. Contact your Treezor Implementation Manager for more information.

# Declare a POST route in your back end

In your back end, you should define a route that accepts HTTP POST requests.

Below is an example using node.js/express:

Then deploy this endpoint to a server:

  • Which is reachable from internet
  • On which you can consult the logs (to confirm your subscription at a later stage)
Bulb icon

Tip – Making your development server reachable from internet

Several options are available to you to make your development server reachable from internet. See the Testing in Sandbox article for more information.

# Register a hook endpoint

The second step is to register your newly created endpoint using the following request.

Outputs the list of webhooks including the newly created one with a temporary uuid in a pending status. Its uuid will change when the subscription is validated later on.

You are now receiving new events.

# List your webhooks subscriptions

You can list your subscriptions using the following request.

Outputs a list of subscriptions, including their uuid (uuid) and status (status).

# Retrieve details about a subscription

You can retrieve the list of events to which a webhook is subscribed to, using the following request.

Outputs a list of events to which you have subscribed.

Note icon

Note – An empty array is returned when you subscribed to all webhooks

The list of events is only relevant when you subscribed to specific webhooks.

# Update a subscription

# To add more events

You only have to specify the new events in the payload, there is no need to specify already subscribed to events.

Outputs the list of subscribed events, including the newly added ones.

# To remove some events

You can remove one event at a time, specifying its name in the URL.

Outputs the list of subscribed events, without the one just removed.

# Unsubscribing from legacy system

The webooks management and subscription described on this page is the only recommended method as of 2022.

If you have previously subcribed to webhooks via Connect, please:

  • Resubscribe using the procedure described on this page,
  • Ensure proper reception of these new webhooks,
  • Unsubscribe to webhooks via Connect using the following request (this will not affect your new subscriptions)

Below and example (the {baseUrl} is your usual Connect base URL).

Updated on: 3/7/2024, 3:05:48 PM