Dynamic variable in webhook path changes URL

The idea is:

I want the URL to remain unchanged when I add a dynamic variable to a webhook path. Right now, a UUID is added between /webhook and my path.

My use case:

I want to create a CRUD API endpoint /article. I can not define the endpoints GET /article/:id, PATCH /article/:id and DELETE /article/:id.

Path: /article => URL http://localhost:5678/webhook/article
Path: /article/:id => URL http://localhost:5678/webhook/763f02b0-1a74-46ea-8a27-a48b56c554e8/article/:id

Have you found the solution? I’ve been trying to do this but it seems like there is no way because it goes against n8n’s standard

yeah, i’d love to know if there is a solution too

Hi both @Thai_An @maxe, I have not found yet a reliable solution.

Currently as a hack, I copy the webhook node with dynamic id in all my other workflows where I need the dynamic id. This way it is always the same url.

So, I created GET /article/:id in one workflow.
For PATCH /article/:id, I copied the webhook node from GET /article/:id.
For DELETE /article/:id, I also copied the webhook node from GET /article/:id.
You need to make sure to change the HTTP Method for each node.

All three workflows have the same production url with the same node id: http://localhost:5678/webhook/763f02b0-1a74-46ea-8a27-a48b56c554e8/article/:id

FYI you can use a single node for all these HTTP methods, it’s just a little non-standard/non-obvious.

  1. In settings
  2. Select multiple methods

Hi @pemontto, I do not think it is a good idea. Workflows can get pretty heavy and clumbered on their own with complicated business logic, I’d rather have a workflow for each endpoint than squash all of them in a single worfklow.

btw i found a service named “webhook relay” and set up the rules there. it’s more suitable for my case as i have different path lenghts. so, it might be

/:param1,
/:param1/:param2
or even
/:param1/:param2/:param3

what i’ve done is i set up a webhook forwarding in the service i mentioned AND set the rules so that it forwards to the one that i need depending on path lentgh

and it seems to be working properly :slight_smile:

Hi @maxe, could you provide an example workflow or a link to the webhook relay service?

Thank you!