Hooks allow Application Developers to plug into different sections of a 2Performant Network. Each App needs permission from the user in the same way the resource ACL works. Permission can be requested in the Settings page of the App on
http://apps.2performant.com.
Below you can find possible hooks that should be added via the API
Example
// Add Hook "utility_tool_icon" to a campaign with id 25
$opts = array("campaign_id" => "25", "app_key" => "an application key");
$hook = array("name" => "utility_tool_icon", "value" => json_encode($opts));
$tperformant->hook_create($hook);
Hooks
utility_tool_icon
If you are using Tool <-> Utility combination Apps it's very important to be able to let the user know that he can use your app in the campaign.
This hook adds the Utility's icon in the Tools listing of the Campaign with a link to http://apps.2performant.com.
Parameters:
- app_key. Required. The Tool's OAuth Consumer Key.
- campaign_id. Required. The campaign that uses the application.
campaign_feature_icon
Use this hook to display an Application icon in the campaign pages. It can be used to let users know that the campaign has a certain Feature enabled. eg. funnel analysis.
This hook adds the icon with a link to the apps page on http://apps.2performant.com.
Parameters:
- app_key. Required. The Apps OAuth Consumer Key.
- campaign_id. Required. The campaign that uses the application.
clicks
This hook will send details of an user's clicks to your app in real-time. Works only for affiliates.
Parameters:
- url. Required. The URL where you want to receive the notifications.
- url_type. Required. Can be iframe or img.
actions
This hook will send details of an user's actions to your app in real-time. Works only for affiliates.
Parameters:
- url. Required. The URL where you want to receive the notifications.
- url_type. Required. Can be iframe or img.
API Methods
hooks/list
List Hooks associated with an OAuth Token.
GET /oauth_clients/#{oauth_token_key}/hooks.{json or xml}
// Code
hooks_list($oauth_token_key='current')
Parameters:
- oauth_token_key. Optional. An OAuth Token Key.
hook/create
Creates a Hook
POST /oauth_clients/#{oauth_token_key}/hooks.{json or xml}
// Code
hook_create($hook, $oauth_token_key='current')
Parameters:
- hook. Required. An array like ( "name" => "hook name", "value" => "hook arguments" )
- "value" should be sent as a JSON or YAML encoded string if it contains more than two arguments
- oauth_token_key. Optional. An OAuth Token Key.
hook/destroy
Destroy a Hook.
DELETE /oauth_clients/#{oauth_token_key}/hooks/#{hook_id}.{json or xml}
// Code
hooks_destroy($hook_id, $oauth_token_key='current')
Parameters:
- hook_id. Required. A Hook ID.
- oauth_token_key. Optional. An OAuth Token Key.