Webhook - success message to the panel

How can I send a message to the panel after a successful hook?

I tried that:

'page.update:after' => function ($newPage, $oldPage) 
{
  try{
    if($newPage->title()== "Poster"):
      exec("wkhtmltopdf https:/magermilch.cc/de/poster content/poster/poster.pdf");
    endif;
    $panel()->notify('the pdf was created');

  } catch(Exception $e) 
  {

    $e->getMessage();

  }
       
}

greetings perry

You can only throw an exception from a hook, there’s no such thing as panel()->notify() in K3.

is an exeption an error message ?

The exception pops up a message that can contain anything:

throw new Exception('hey, congrats, your poster was successfully saved as PDF');

The user can then dismiss this message.

1 Like

like this ?

   page.update:after' => function ($newPage, $oldPage) 
        {
          try{
            if($newPage->title()== "Poster"):
              exec("wkhtmltopdf https://magermilch.cc/de/poster content/poster/poster.pdf");
            endif;
            throw new Exception('hey, congrats, your poster was successfully saved as PDF');


          } catch(Exception $e) 
          {

            $e->getMessage();

          }
               
        }

Yes, that should work.