Creating Thrive Automator Apps

About Apps

Apps represent the applications or categories to which triggers/actions belong to, and are mostly used for grouping items inside an automation.

For example, triggers and actions related to WooCommerce implementation are stored under the WooCommerce App.

Creating Your First App

In order to create your own Trigger_Field you need to extend ThriveAutomatorItemsTrigger_Field and implement the required basic methods.

  • abstract public static function get_id(): string – should return a unique identifier that will be used as a key in arrays. To avoid conflicts or overwrites we suggest using a prefix.

public static function get_id(): string { 
    return 'request_headers_toggle'; 
}
  • abstract public static function get_name(): string – the name of the Trigger_Field.

public static function get_name(): string { 
    return 'Headers'; 
}
  • abstract public static function get_description(): string – short description of the Trigger_Field that will be displayed in the tooltip.

public static function get_description(): string { 
    return 'Whether you want custom headers'; 
}
  • abstract public static function get_placeholder(): string – input placeholder to be displayed in the admin UI.

public static function get_placeholder(): string { 
    return 'user role'; 
}
  • abstract public static function get_type(): string – type of input field, required to render in the admin UI.

/** 
* @see Utils::FIELD_TYPE_TEXT 
* @see Utils::FIELD_TYPE_TAGS 
* @see Utils::FIELD_TYPE_SELECT 
* @see Utils::FIELD_TYPE_CHECKBOX 
* @see Utils::FIELD_TYPE_AUTOCOMPLETE 
* @see Utils::FIELD_TYPE_DOUBLE_DROPDOWN 
* @see Utils::FIELD_TYPE_BUTTON 
* @see Utils::FIELD_TYPE_KEY_PAIR 
*/ 
public static function get_type(): string { 
    return Trigger_Field::FIELD_TYPE_RADIO; 
}

Other Methods

  • public static function has_access(): string – can be used to condition the display of the app in the Automator UI

public static function has_access() { r
    eturn class_exists( 'WooCommerce' ); 
}
  • public static function get_acccess_url(): string – provides a url where the user can learn more about the application and how to get access its features

public static function get_acccess_url() { 
    return 'https://woocommerce.com/'; 
}

Registering the App

To register this Trigger_Field so it can appear in the admin area, we should use the thrive_automator_register_trigger_field function which receives the class name as the only parameter.

Was this article helpful?

Related Articles

Need Support?

Can't find the answer you're looking for?
Contact Support
>