Creating Custom CRM Modules

Overview

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

WP Fusion’s integration modules are standardized across all our supported CRMs. Once the integration module is complete, it allows 100+ of the most popular WordPress plugins to communicate bidirectionally with your CRM or marketing automation platform. In most cases this is significantly faster and cheaper than developing custom CRM integrations one plugin at a time.

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

Requirements

While WP Fusion is pretty flexible, it does not work with all platforms.

For WP Fusion to work properly, your CRM or marketing automation tool must at minimum have API methods for:

  • Get all available tags (or “segments”, “groups”, “static lists”, aka whatever is going to be used for segmenting contacts)
  • Get all available contact custom fields (or “attributes”, “properties”, etc.)
  • Search for a contact ID by email address
  • Load the tags for a contact, by ID
  • Apply tags to a contact, by contact ID
  • Remove tags from a contact, by contact ID
  • Add a new contact, and return a contact ID
  • Update a contact by ID
  • Load a contact and all their properties, by contact ID
  • (optional) Search for contacts by tag name or ID. This is required for the Import Tool to work.

Setting up a custom CRM module

First download the starter plugin. 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.

File structure

There are three 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.

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.

Contribution guidelines

For contribution and style guidelines, see this doc.

Was this helpful?