I would like to submit the content of contact form 7 to external CRM after the email of contact form 7 was sent.
How can I retrieve the data of the form?
Which hook I should use?
How to submit the form to external url?
Thank you,
Sam
You can access submitted data by adding following action. For OOP's
add_action('wpcf7_before_send_mail',array($this,'create_new_user_registration'),10,1);
for simple function call -
add_action('wpcf7_before_send_mail','create_new_user_registration',10,1);
After add this action you need to create a function.In that function you can access submitted data-
public function create_new_user_registration($contact_form)
{
$wpcf7 = WPCF7_ContactForm::get_current();
$submission = WPCF7_Submission::get_instance();
//Below statement will return all data submitted by form.
$data = $submission->get_posted_data();
//suppose you have a field which name is 'email' then you can access it by using following statement.
$user_passed_email = $data['email'];
}
similar to above example you can access any field of form submitted by contact form 7.