Skip to content

Instantly share code, notes, and snippets.

@gagimilicevic
Created March 8, 2017 15:39
Show Gist options
  • Save gagimilicevic/607666fa428f0a51c2527f1493037fa2 to your computer and use it in GitHub Desktop.
Save gagimilicevic/607666fa428f0a51c2527f1493037fa2 to your computer and use it in GitHub Desktop.
CF7 Integration with Agile CRM using AgileCRM PHP API
function CF7_to_Agile_send( $cf7 )
{
$submission = WPCF7_Submission::get_instance();
$posted_data = $submission->get_posted_data();
$email = $posted_data['your-email'];
$first_name = $posted_data['your-name'];
$contact_json = array(
"lead_score"=>"80",
"star_value"=>"5",
"tags"=>array("Sample"),
"properties"=>array(
array(
"name"=>"first_name",
"value"=>$first_name,
"type"=>"SYSTEM"
),
array(
"name"=>"email",
"value"=>$email,
"type"=>"SYSTEM"
)
)
);
$contact_json = json_encode($contact_json);
curl_wrap("contacts", $contact_json, "POST", "application/json");
}
add_action( 'wpcf7_before_send_mail', 'CF7_to_Agile_send' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment