Creating Custom CRM Modules

Overview

WP Fusion can be extended to connect to additional CRMs or other contact databases outside of our included integrations.

For a bootstrap to get you started, download this example plugin from GitHub.

File structure

There are four important files:

  • wp-fusion-custom-crm.php:¬†This is the base plugin file. It defines the plugin name, loads the dependencies, and adds the custom CRM to the dropdown in WP Fusion’s setup tab.
  • class-wpf-custom.php: This is the base class for custom module. It includes all API calls and methods relating to sending and retrieving data.
  • class-wpf-custom-admin.php: This file is only loaded in the WordPress admin. It defines the settings required to establish a connection, and contains any additional admin functionality.

Setting up a custom CRM module

First download the starter template. Then do a find and replace (case sensitive) on two strings:

  • “custom”: This is the slug for the integration. Change it to something like “my_crm_name”
  • “Custom”: This is the title for the integration, and is also used for the class names. Change it to something like “My_CRM_Name”

Also change the file names to reflect the new slug.

Then you can go through each of the methods in class-wpf-custom.php and update them with the API calls specific to your integration, following the guide here.

Notes

$supports: This variable declares some CRM-specific features to other aspects of WP Fusion. If the CRM supports “add_tags”, then WP Fusion’s tag dropdowns will support typing in a new tag name on the fly. If the platform uses tag IDs, or requires tags to be registered before they’re used, don’t declare support for “add_tags”.

“add_fields” works similarly to “add_tags”. If the CRM supports “add_fields”, users will be able to enter custom fields on the fly. Don’t use this if the platform requires field IDs.