Webhook subscription node

I have a 3rd party API provider, that made a few webhooks for us. I have an API endpoint to subscribe each webhook as well as events they should be triggered. Since this provider isn’t registered to n8n, I wonder is it possible to me to create a node inside editor to serve for the subscription purpose, since I have all I need to make it e.g. URL, authorization etc,?
Please note, I have self hosted n8n.

Information on your n8n setup

  • n8n version: 1.31.2
  • Database (default: SQLite): default
  • n8n EXECUTIONS_PROCESS setting (default: own, main): main
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Ubuntu

hello @Angel_Todorov

You can create your own node for that or you can use the default Webhook node.

Thanks @barn4k - is there by any chance n8n trigger node open source, I can start from? Something line Stripe node or similar, where I can see how both web hook subscription also takes place?
I didn’t find a way to handle both subscription and trigger mode from a single node. If I manually subscribe the webhook, I can then use webhook node to receive events. I am curios if I can handle webhook subscription part as well from the node.

There is no “Subscription” mode :slight_smile:

Subscription means the service you are interested in pushes the events to your endpoint (webhook) when there is new events occur. But so that to work, you need to register the webhook there. It depends on the service of how you will manage that (some services require sending a specific HTTP request with the webhook details, and others - configure subscription with UI).

Well, my point is - when you have a webhook:

  1. You need to subscribe for the service that is suppose to call it
  2. The service will call it in case of specific event.
    What I noticed for n8n Stripe Trigger, you can select an event and add your Stripe credentials. Then the note takes care and subscribes the trigger for the event in Stripe, you don’t need to do it. After that each time a Stripe event occurs, the webhook will be called.

So essentially, during Stripe Trigger node setup, a subscription takes place w/o explicit subscription call/action.

Hope that clarifies the case :slight_smile:

You can do this in workflows or in a custom node. I think this is how many nodes work that have webhooks as n8n doesn’t bother making trigger nodes for services that give you webhook urls, since that already works with the webhook trigger

When making a custom node they have built in methods for polling and for automatically subscribing/unsubscribing to webhook events. It even will automatically work with your testing url when testing the workflow and subscribe/unsubscribe automatically.

When I am making a trigger node I typically use the ClickUp trigger node as a template so I can remember the syntax. You can find that code here.

If you want to browse the nodes you can find them here. The webhook logic will usually be in the nodenameTrigger.node.ts file.

Making a node like that definitely isn’t for beginners though. There are people that make nodes for hire, such as myself and a few others on the forum. Any one of us should be able to do what you need

You can do this manually with http triggers. I will typically test a webhook service like this before making a node so I have a sample of all incoming code.

First make a webhook workflow. Save that url

then in another workflow (or on the same canvas) call the subscription endpoint with that URL. That’s usually all you need to do to start getting events. Of course, if you want to properly manage starting and stopping events coming in then there will be a bit more configuration to get that to work.

While not best practice, you can just subscribe to all events to one webhook trigger url then just always leave it on.

I do this for one service. I subscribed with the event type * which means everything to one webhook url. Then I use that workflow as a router and use a switch statement node to call other workflows.

Hope all of that makes sense. Let me know if you have any questions

1 Like