ilovepdf/ilovepdf-php

Webhook is never triggered

Radon8472 opened this issue · 1 comments

I tried to run a task, that should trigger a webhook when finished (Like example webhook_send).

That is my code:

require_once('vendor/autoload.php');

use Ilovepdf\OfficepdfTask;

// Load my keys into $keys
$myTask = new OfficepdfTask($keys[0],$keys[1]);
$file1 = $myTask->addFile('my-test.ppt');
$myTask->setOutputFilename('outfile-office.pdf');

$myTask->setWebhook('http://my-url.de:20000/pdf-download-hook');

// We don't download here because with the webhook we ordered the files must be processed in background.
// Notification will be sent once it's ready

//   $myTask->execute(); // see info add "Own research"

Expected behavior:

  • WebHook-url should be triggered, when task is done.

Actual behavior:

  • WebHook is never triggered

Own reseach:

  • I noticed, that the method setWebhook() does not trigger any server-requests, so I tried to add
    $myTask->execute();
    because documentation says webhook should be send with POST https://{server}/v1/process. But the webhook still is not triggered.
  • the same script works fine, when I remove "setWebhook" and add a $myTask->download() at the end -> so I`m quite there are no issues with api key, internet connection or anything similar.
  • I sure my webhook url is reachable from public internet too

EDIT: When I add the same webhook as webhook into my global api config, it is called successfull, but dynamical adding webhooks via Task->setWebhook() seems to have no effect.

setWebook method will be changed to setProcessInBackground. This will send the process task to be run on background and no wait for response, params will be true or false