Ad Code

Contact form 7 data to 3rd party REST API service - Wordpress

I am trying to send word-press contact form 7 data to a 3rd party CRM using their API. I have tried a plug-in called contact form 7 to API but to no avail. It is not showing me input type name at all. All fields are blank.

 
add_action( 'wpcf7_mail_sent', 'your_wpcf7_mail_sent_function' );
function your_wpcf7_mail_sent_function( $contact_form ){
    $title = $contact_form->title;

            $contact_form_id
= $contact_form -> id;

    $submission = WPCF7_Submission::get_instance();
    
    $posted_dataa['title'] = $title;
    
    if( $submission ){
        $posted_data = $submission->get_posted_data();
    }
    $merge_data = array_merge($posted_dataa, $posted_data);
    
    $message = print_r($merge_data, true);
    $message = wordwrap($message, 70);
    mail('mail@gmail.com', 'Getting the Contact Form Field IDs', $message);
}

Post a Comment

0 Comments