Agency Pilot

Setting up an import from Agency Pilot

This page contains information specific to Agency Pilot. For a general guide on setting up a property import please see our 'Creating your first property import' guide.

When creating an import from Agency Pilot, you'll be presented with 2 options in the list of formats to choose from:

Rest API

When creating a property import from Agency Pilot using their Rest API you'll be presented with the following fields:

URL - You will need to obtain this URL from Agency Pilot.

Client ID - You will need to obtain your Client ID from Agency Pilot.

Client Secret - You will need to obtain your Client Secret from Agency Pilot.

JSON

When creating a property import from Agency Pilot using their JSON feed you'll be presented with the following fields:

URL - You will need to obtain this URL from Agency Pilot.

Password - You will need to obtain your password from Agency Pilot.

Only import updated properties - To ensure feeds run quicker and more efficiently you can tick this option to only import properties that have changed since the last time an import ran.

Developer hooks

REST API

Hook name: propertyhive_agency_pilot_api_request_body

Hook type: Filter

Description: Customise the request body sent when requesting properties.

Example usage:

add_action( 'propertyhive_agency_pilot_api_request_body', 'adjust_request_body' );
function adjust_request_body( $body)
{
    // $body (array) - Array containing body sent in API request for properties.
    // Default:
    /* array(
	"DisplayOptions" => array(
		"Additional" => true,
		"Photos" => true,
		"DocumentMedia" => true,
		"Floors" => true,
		"Agents" => true,
		"Auctions" => false,
		"SystemDetails" => true,
		"Categories" => true
	),
	"FilterOptions" => array(
		"ActiveOnly" => true,
		"ShowOnInternet" => true
	)
    ); */

    // also import properties that aren't active
    $body['FilterOptions']['ActiveOnly'] = false;

    return $body;
}

Hook name: propertyhive_pre_import_properties_agency_pilot_api

Hook type: Action

Description: Executed after the properties are parsed but before they are actually imported.

Example usage:

add_action( 'propertyhive_pre_import_properties_agency_pilot_api', 'pre_import' );
function pre_import( $properties )
{
     // $properties (array) - Multidimensional array containing property data received in feed

    // do something here...
}

Hook name: propertyhive_agency_pilot_api_properties_due_import

Hook type: Filter

Description: Executed after the properties are parsed but before actually being imported. Allows you to filter out any properties you don't want to import.

For example, maybe you want to only import properties belonging to a certain office.

Example usage:

add_filter( 'propertyhive_agency_pilot_api_properties_due_import', 'filter_properties' );
function filter_properties( $properties )
{
    // $properties (array) - Multidimensional array containing property data parsed in feed

    $new_properties = array();
    
    foreach ($properties as $property)
    {
        if ( 
            isset($property['SystemDetail']['Partner']['ID']) && 
            $property['SystemDetail']['Partner']['ID'] == '12345' )
        {
            $new_properties[] = $property;
        }
    }
    return $new_properties;
}

Hook name: propertyhive_agency_pilot_api_address_fields_to_check

Hook type: Filter

Description: If you have locations setup under 'Property Hive > Settings > Custom Fields' we'll look at a number of address fields provided in the Agency Pilot data and, if a matching 'Location' is found, we'll set it accordingly.

Using this filter you can customise the address fields in the Agency Pilot that we consider when looking for a matching location.

Example usage:

add_filter( 'propertyhive_agency_pilot_api_address_fields_to_check', 'customise_address_fields' );
function customise_address_fields($address_fields)
{
    // $address_fields (array) - defaults to ['District', 'Town', 'County']

    $address_fields[] = 'Street'; // also look at street when mapping to location

    return $address_fields;
}

Hook name: propertyhive_property_imported_agency_pilot_api

Hook type: Action

Description: Executed after each individual property is imported.

Example usage:

add_action( 'propertyhive_property_imported_agency_pilot_api', 'property_imported', 10, 2 );
function property_imported( $post_id, $property )
{
    // $post_id (int) - the WordPress post ID of the imported property
    // $property (array) - The property received in the REST API

    // do something here...
}

Hook name: propertyhive_post_import_properties_agency_pilot_api

Hook type: Action

Description: Executed after all properties have been imported.

Example usage:

add_action( 'propertyhive_post_import_properties_agency_pilot_api', 'post_import' );
function post_import()
{
    // do something here...
}

Hook name: propertyhive_property_removed_agency_pilot_api

Hook type: Action

Description: Executed after a property has been removed from Property Hive due to it not being present in the feed.

Example usage:

add_action( 'propertyhive_property_removed_agency_pilot_api ', 'property_removed' );
function property_removed( $post_id )
{
    // $post_id (int) - the WordPress post ID of the imported property

    // do something here...
}

JSON

Hook name: propertyhive_agency_pilot_json_properties_parameters

Hook type: Filter

Description: Customise the request parameters used when requesting properties.

Example usage:

add_action( 'propertyhive_agency_pilot_json_properties_parameters', 'adjust_request_params' );
function adjust_request_params( $parameters)
{
    // $parameters(array) - Array containing parameters sent in URL request for properties.
    // Default:
    /* array(
	'w' => '103',
	'fr' => 'true',
	'full' => 'true'
    ); */

    $parameters['fr'] = false;

    return $parameters;
}

Hook name: propertyhive_pre_import_properties_agency_pilot_json

Hook type: Action

Description: Executed after the properties are parsed but before they are actually imported.

Example usage:

add_action( 'propertyhive_pre_import_properties_agency_pilot_json', 'pre_import' );
function pre_import( $properties )
{
     // $properties (array) - Multidimensional array containing property data received in feed

    // do something here...
}

Hook name: propertyhive_agency_pilot_json_properties_due_import

Hook type: Filter

Description: Executed after the properties are parsed but before actually being imported. Allows you to filter out any properties you don't want to import.

For example, maybe you want to only import properties belonging to a certain office.

Example usage:

add_filter( 'propertyhive_agency_pilot_json_properties_due_import', 'filter_properties' );
function filter_properties( $properties )
{
    // $properties (array) - Multidimensional array containing property data parsed in feed

    $new_properties = array();
    
    foreach ($properties as $property)
    {
        if ( 
            isset($property['PartnerOffice']) && 
            $property['PartnerOffice'] == '12345' )
        {
            $new_properties[] = $property;
        }
    }
    return $new_properties;
}

Hook name: propertyhive_agency_pilot_json_address_fields_to_check

Hook type: Filter

Description: If you have locations setup under 'Property Hive > Settings > Custom Fields' we'll look at a number of address fields provided in the Agency Pilot data and, if a matching 'Location' is found, we'll set it accordingly.

Using this filter you can customise the address fields in the Agency Pilot that we consider when looking for a matching location.

Example usage:

add_filter( 'propertyhive_agency_pilot_json_address_fields_to_check', 'customise_address_fields' );
function customise_address_fields($address_fields)
{
    // $address_fields (array) - defaults to ['District', 'Town']

    $address_fields[] = 'Street'; // also look at street when mapping to location

    return $address_fields;
}

Hook name: propertyhive_property_imported_agency_pilot_json

Hook type: Action

Description: Executed after each individual property is imported.

Example usage:

add_action( 'propertyhive_property_imported_agency_pilot_json', 'property_imported', 10, 2 );
function property_imported( $post_id, $property )
{
    // $post_id (int) - the WordPress post ID of the imported property
    // $property (array) - The property received in the feed

    // do something here...
}

Hook name: propertyhive_post_import_properties_agency_pilot_json

Hook type: Action

Description: Executed after all properties have been imported.

Example usage:

add_action( 'propertyhive_post_import_properties_agency_pilot_json', 'post_import' );
function post_import()
{
    // do something here...
}

Hook name: propertyhive_property_removed_agency_pilot_json

Hook type: Action

Description: Executed after a property has been removed from Property Hive due to it not being present in the feed.

Example usage:

add_action( 'propertyhive_property_removed_agency_pilot_json', 'property_removed' );
function property_removed( $post_id )
{
    // $post_id (int) - the WordPress post ID of the imported property

    // do something here...
}