Documentation

Webhooks are great to know what is happening by simply listening on your server for things to happen. See bellow how you can use our API in regards to webhooks.

Fork me on GitHub
  • create
    Create a new webhook for the given url to catch the given events.
    $ziggeo->webhooks()->create($arguments = array())
    
    1. target_url The url that will catch the events
    2. encoding Data encoding to be used by the webhook to send the events.
    3. events Comma-separated list of the events the webhook will catch. They must be valid webhook type events.
    This method returns string
    Example:
    <?php
    /*
    	//This script is used to create a webhook
    
    	docs: https://ziggeo.com/docs/api/webhooks/
    
    	Parameters you need to pass:
    	1. app_token
    	2. private_key
    	3. url (where webhooks should fire to)
    	4. encoding (webhook encoding to use)
    	5. events (events you want webhook to fire for)
    */
    require_once(dirname(__FILE__) . "/../Ziggeo.php");
    
    $opts = getopt("", array("app_token:", "private_key:", "url:", "encoding:", "events:"));
    
    //We initialize the SDK
    $ziggeo = new Ziggeo($opts["app_token"], $opts["private_key"]);
    
    $arguments = array(
    	"target_url" => $opts["url"],
    	"encoding"   => $opts["encoding"],
    	"events"     => $opts["events"]
    );
    
    $ziggeo->webhooks()->create($arguments);
    
    ?>
    
  • confirm
    Confirm a webhook using its ID and the corresponding validation code.
    $ziggeo->webhooks()->confirm($arguments = array())
    
    1. webhook_id Webhook ID that's returned in the creation call.
    2. validation_code Validation code that is sent to the webhook when created.
    This method returns string
    Example:
    <?php
    /*
    	//This script is used to create a webhook
    
    	docs: https://ziggeo.com/docs/api/webhooks/
    
    	Parameters you need to pass:
    	1. app_token
    	2. private_key
    	3. webhook_id (webhook id that's returned when using webhooks()->create())
    	4. validation_code (6-digit code sent to the webhook after creating it)
    */
    require_once(dirname(__FILE__) . "/../Ziggeo.php");
    
    $opts = getopt("", array("app_token:", "private_key:", "webhook_id:", "validation_code:"));
    
    //We initialize the SDK
    $ziggeo = new Ziggeo($opts["app_token"], $opts["private_key"]);
    
    $arguments = array(
    	"webhook_id"      => $opts["webhook_id"],
    	"validation_code" => $opts["validation_code"]
    );
    
    $ziggeo->webhooks()->confirm($arguments);
    
    ?>
    
  • delete
    Delete a webhook using its URL.
    $ziggeo->webhooks()->delete($arguments = array())
    
    1. target_url The url that will catch the events
    This method returns string
    Example:
    <?php
    /*
    	This script shows you how to remove the webhook
    	* It removes by URL, so all webhooks with the same URL will be removed at once!
    
    	Parameters you need to pass:
    	1. app_token
    	2. private_key
    	3. url
    */
    require_once(dirname(__FILE__) . "/../Ziggeo.php");
    
    $opts = getopt("", array("app_token:", "private_key:", "url:"));
    
    //We initialize our SDK
    $ziggeo = new Ziggeo($opts["app_token"], $opts["private_key"]);
    
    $arguments = array(
    	"target_url" => $opts["url"]
    );
    
    $ziggeo->webhooks()->delete($arguments);
    
    ?>