Hey, I am working on a site where new pages published should send data to a webhook. I am currently stuck and don’t know why. I only want to send data from children pages of my “posters” page using the “posters-archive” template. This is what the hook in my config.php looks right now:
'page.create:after' => function (Kirby\Cms\Page $page) {
$parent = $page->parent();
// Only proceed if the parent uses the 'posters-archive' template and the page is listed (published)
if ($parent->intendedTemplate()->name() === 'posters-archive' && $page->isPublished()) {
$image = $page->images();
$imageUrl = $image ? $image->url() : null;
$payload = [
'title' => $page->title()->value(),
'year' => $page-year()->toDate('Y'),
'url' => $page->url(),
'image' => $imageUrl,
];
try {
\Kirby\Http\Remote::post('https://hook.eu2.make.com/xxx', [
'data' => $payload
]);
} catch (Exception $e) {
// log the error for debugging
}
}
}
I use ngrok for localhost to send data to the webhook but I am getting no data on Make.com
Thank you in advance!