Ok so i seem to be having a few problems validation my webhook.
Currently this is the code i am using:
<?php
// Include the config file and the Podio library
require_once '../../config.php';
require_once '../../../PodioAPI.php';
// Setup the API client reference. Client ID and Client Secrets are defined
// as constants in config.php
Podio::setup(CLIENT_ID, CLIENT_SECRET);
// Use Podio::is_authenticated() to check is there's already an active session.
// If there is you can make API calls right away.
if (!Podio::is_authenticated()) {
// Authenticate using your username and password. Both are defined as constants
// in config.php
Podio::authenticate('password', array('username' => USERNAME, 'password' => PASSWORD));
print "You have been authenticated. Wee!<br>";
$access_token = Podio::$oauth->access_token;
print "Your access token is {$access_token}<br><br>";
print "The access token is automatically saved in a session for your convenience.<br><br>";
}
else {
print "You were already authenticated and no authentication happened. Close and reopen your browser to start over.<br><br>";
}
// Now you can start making API calls. E.g. get your user status
$status = PodioUserStatus::get();
print "Your user id is <b>{$status->user->id}</b> and you have <b>{$status->inbox_new}</b> unread messages in your inbox.<br><br>";
switch ($_POST['type']) {
case 'hook.verify':
// Validate the webhook
PodioHook::validate( $_POST[88644], array('code' => $_POST['code']));
case 'item.create':
// Do something. item_id is available in $_POST['item_id']
}
?>
So what am i doing wrong that this wont validate. I know i can create web hooks as i have done it like this:
$hook_url = "http://infiniteyouth.org.uk/podio/lib/items/activities/create.php";
PodioHook::create( $ref_type, $ref_id, $attributes = array() )
$hookitem = PodioHook::create( 'app', 3239115, array( 'type' => 'item.create', 'url' => $hook_url ));
and i have tried sticking in this function before the validate process:
$hook_id = "88644";
$verify = PodioHook::verify( $hook_id );
Any ideas as why the hook doesn't become active?