#Overview
With some CRMs, WP Fusion is registered as an app via those platforms』 developer programs. Because of this, you need an account on our site and a WP Fusion license to complete the initial authentication process with your CRM.
This applies to:
BirdSend
Drift
HubSpot
NationBuilder
Salesforce
Zoho
There may be scenarios where you want to use your own client ID for authentication, and not the WP Fusion client ID. For example if you have a created a custom branded app via your CRM』s developer program, or if you don』t have a WP Fusion license.
#Using a custom client ID and authorization URL
The client ID and client secret are public properties on each CRM』s integration class. You can override them by hooking into the wp_fusion_init_crm action, which passes the CRM object by reference.
For example with Zoho:
function set_custom_zoho_app( &$crm ) {
$crm->client_id = '1000.XXXXXXXXXXXXXXXXXXXXX';
$crm->client_secret_us = '08dccXXXXXXXXXXXXXXXXXXXXX';
}
add_action( 'wp_fusion_init_crm', 'set_custom_zoho_app' );
To override the initial authorization request URI for the 「Authorize」 button in the WP Fusion settings, use the wpf_{$crm}_auth_url filter, for example with Zoho:
function set_custom_zoho_auth_url() {
return "https://accounts.zoho.com/oauth/v2/auth?scope=ZohoCRM.modules.ALL,ZohoCRM.settings.ALL,ZohoCRM.users.READ,ZohoCRM.org.READ &response_type=code&access_type=offline&redirect_uri=https%3A%2F%2Fmysite.com%2Fzoho.php&prompt=consent&client_id=XXXX";
}
add_action( 'wpf_zoho_auth_url', 'set_custom_zoho_auth_url' );
Note that in this example you must have registered https://mysite.com/zoho.php as the redirect URI for your app, and must have a script running at that location which is capable of listening for the authorization response and redirecting back to the WP Fusion settings page with the &code= parameter in the URL.
#Salesforce example
To set your own custom Salesforce client ID and secret:
function set_custom_salesforce_app( &$crm ) {
$crm->client_id = '3MVG9CEn_O3jvv0xMf5rhesocm_5czidz9CFtu_qNZ2V0Zw.bmL0LTRRylD5fhkAKYwGxRDDRXXXXXXXXXXXX';
$crm->client_secret = '9BB0BD5237B1EA6ED8AFE2618053XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
}
add_action( 'wp_fusion_init_crm', 'set_custom_salesforce_app' );
To override the initial OAuth authorization URL:
function set_custom_salesforce_auth_url() {
$args = array(
'client_id' => wp_fusion()->crm->client_id,
'redirect_uri' => rawurlencode( admin_url( 'options-general.php?page=wpf-settings&crm=salesforce' ) ),
'response_type' => 'code',
'scope' => 'api%20refresh_token%20offline_access',
);
$url = add_query_arg( $args, 'https://login.salesforce.com/services/oauth2/token' );
return $url;
}
add_action( 'wpf_salesforce_auth_url', 'set_custom_salesforce_auth_url' );
#Was this helpful?
Let us know if you liked the post. That』s the only way we can improve.
Yes
No