Hooks - Use a function that's required an authentication ?

Comments

2 comments

  • Caniche - Mathieu Bazelaire

    For information, I found somes errors...

    Here is the final code for example.
    If it helps someone...

    //Podio::$debug = true;

    Podio::setup(PodioConfig::APPKEY, PodioConfig::APPSECRET);

    try {
    Podio::authenticate('app', array('app_id' => $iApp, 'app_token' => $iAppToken)); // looks better
       switch ($_POST['type']) {
    case 'hook.verify':
    PodioHook::validate($_POST['hook_id'], array('code' => $_POST['code'])); // validate the hook
    break;

    case 'item.create':
    $oInvoice = PodioItem::get($_POST['item_id']);
    if($oInvoice) {
    // You got the object. Do something. 
    }
    break;

    case 'item.update':
    $oInvoice = PodioItem::get($_POST['item_id']);
    if($oInvoice){
    // you got the object. Do something.
    }
    break;

    case 'item.delete':
    // ...
    break;
    }

    } catch ( PodioError $e ) {
    Log::error('hook fail ' . print_r($e,true));
    }
    1
    Comment actions Permalink
  • Caniche - Mathieu Bazelaire

    If would be great if someone post an example with other stuff than "just store information" from the post's hook ;)

    #needhelp :)

     

     

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk