Trigger page creation via external hook

I’m trying to have Kirby create (or update) a page on my site whenever it’s served data via a webhook from an external service (in this case, Eventbrite).

My hunch is that I need to set up a router in config.php which would process the request payload and create the page (something like mysite.com/addpage). I did that, and it works when I visit the router url in my browser, however, Eventbrite gets a 404 when it tries to programmatically load the page.

It makes sense that the Eventbrite webhook, triggering my Kirby route via the open web, wouldn’t have the ability to create a new page. But I don’t understand why it’s returning a 404. I’ve done a fair amount of searching about this, but I guess I don’t have enough vocabulary to find what I need. Am I misunderstanding something fundamental about routing?

Thanks in advance for any help.

I have never worked with eventbrite webhooks before, but from a quick glance on their website they probably send json via POST.

Kirby doesn’t accept post by default (only GET), so you have to specify that in your route.

I hope this can be of any help!

Good luck.

Fantastic. Yes, that was it. Thanks for your help.

1 Like