2

I have setup a webhook in Podio for an item.update in hook_update_item.php file. What I want to do if an item has been updated, I want to open a link preferably in a new tab, here is the code that I have:

<?php

require ("../podio/PodioAPI.php");

Podio::setup(Client ID, Client Secret);
Podio::authenticate_with_app(App ID, App Token);

switch ($_POST['type']) {
    case 'hook.verify':
        // Validate the webhook
      PodioHook::validate($_POST['hook_id'], array('code' => $_POST['code']));
    case 'item.update':
        // Do something. item_id is available in $_POST['item_id']

        if ($_POST['item_id'] == '238777597'){

          //open new link here

          $ch = curl_init('http://www.google.com.ph');
          curl_exec($ch);
        }
}

?>

Podio webhook has already been validated so I am assuming when webhook is firing it goes to the 'item.update'. But so far no luck on bringing up a new tab of google page. Appreciate any tips and suggestions!

1 Answers1

0

I'm assuming that your code is running on a server somewhere. You could write a webpage that asks the server every n seconds/minutes if there are any new tabs that it should open. Your server receives the request, looks to see if there are any tabs to open and sends them in an array to the webpage. From there in javascript you can open the new tabs. Your browser might block them thought if you don't change the pop-up settings. There might be a better way to do this using push notifications, but it is a start.

Rollermy
  • 11
  • 1
  • 4