
Anonymous Community User asked a question.
Hooks - Use a function that's required an authentication ?
Hi, I'm trying to active hooks to syncronise directly invoice from Podio to our system. I'm blocked because I try to use this code . It's seem that connection is required but... this code is called by the hook...How can I do that ? if(Podio::authenticate_with_app('ID APP', 'APP KEY')){ switch ($_POST['type']) { case 'item.create': $oInvoice = PodioItem::get($_POST['item_id']); // get complete Podio object PodioInvoiceGenerator::generateInvoice($oInvoice); // create our invoice break; case 'item.update': $oInvoice = PodioItem::get($_POST['item_id']); // get complete Podio object PodioInvoiceGenerator::generateInvoice($oInvoice); // update invoice break; case 'item.delete': $oInvoiceEmu = PodioInvoice::getInvoiceByPodioId($_POST['item_id']); // get our invoice $oInvoiceEmu->delete(); // delete invoice break; }}else { Log::error('connection with app fail '); }