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

1 Like

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
1 Like

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!

Hi @pdany1116,
Have you found a solution.

In this PR(fix(core): Fix getting webhook methods from path only when dynamic webhook path by guillaumejacquart · Pull Request #17803 · n8n-io/n8n · GitHub), they are explains it is good to go with unique id for dynamic webhook endpoint, but I cannot make (base_url) in fixed mode.

Currently, using the latest (1.110.1, also tried 1.109.1) at docker do still get the “dynamic” URL at webhook while using params, the issue’s still there. Did I miss anything?

1 Like

Still no response from n8n team, unfortunately.

5 Likes

Facing the same issue!
I mean if I host n8n in my domain, I should be able to remove this auto-assigned webhook Id thing.

Facing the same issue! Is there a solution yet?

Have you found the solution?