0
votes

I am trying to integrate wordpress CF7 with a third party CRM. I managed to send the data to the CRM using the following filter:

add_filter('wpcf7_form_action_url', 'wpcf7_custom_form_action_url');
function wpcf7_custom_form_action_url()
{
    return 'https://www.myapps-systems.com/api/WebToLeed.asp';
}

Basically what i did is changing the "form action" from the regular CF7 to the WebtoLead action. I also mapped the Cf7 form with the following attributes (taken from the CRm sample form):

[hidden mbp1 "222626"]
[hidden URLToReturn "http://thankyoupage.com/thankyou"]
[hidden Companies_Account_Status_Code "546"]
[hidden Companies_Company id:Companies_Company "Website Enquiry"]
<div>
[text* Contacts_Contact id:Contacts_Contact class:name]<label>name*:</label>
[tel* Companies_PhoneNumber id:Companies_PhoneNumber class:telelabelhone]
<label>phone*:  </label>
[email Companies_Email id:Companies_Email class:email]<label> mail:‬</label>

[textarea Companies_Note 50x8 id:Companies_Note]<label>message:</label>
</div>
[submit  onclick="return OnButton1(); id:send_contact class:submit]

So this did work for me and i managed to receive the data on the CRM, but as i need the data to be stored in the wordpress database as well, i would like it to be both send to the CRM and keep the regular wordpress functionality.And as I cannot use 2 "actions" in 1 form i have to use some different way.

I was trying to implement this by using a few methods , like using "wpcf7_before_send_mail" hook or "wpcf7_after_send_mail", and even using a 3'rd party integration plugin for CF7 (http://wordpress.org/plugins/contact-form-7-3rd-party-integration/screenshots/) but unfortunatly with ot much success.

I would greatly appreciate your help on the matter.

Here is the full code of the sample Crm integration

<!--
URL is in action attribute.
For all inputs the name attribute is used by the back-end system so don't change them
-->
<form id="big_contact_form" name="Web2LeedForm" action="https://www.myapps-systems.com/api/WebToLeed.asp" method="POST" onsubmit="return submitForm();">

    <input type="hidden" name="mbp1" value="222626"/>
    <input type="hidden" name="URLToReturn" value="http://test.co.il/contact/thankyou"/>
    <input type="hidden" name="Companies_Account_Status_Code" value="546" /> <!-- must be exactly this name and value -->
    <input type="hidden" id="Companies_Company" name="Companies_Company" value="website enquiry"/> <!-- the Companies_Company field is mandatory, we don't use it so we just fill it with a value -->
    <table>

        <tr>
            <td>*</td>
            <th class="form_label"><label for="Contacts_Contact">name: </label></th>
            <td><input class="input" type="text" id="Contacts_Contact" name="Contacts_Contact"/></td>
        </tr>                           
        <tr>
            <td>*</td>
            <th class="form_label"><label for="Companies_PhoneNumber">phone: </label></th>
            <td><input class="input" type="text" id="Companies_PhoneNumber" name="Companies_PhoneNumber"/></td>                                 
        </tr>                                                               
        <tr>
            <td></td>
            <th class="form_label"><label for="Companies_Email">mail: </label></th>
            <td><input class="input" type="text" id="Companies_Email" name="Companies_Email"/></td>                                 
        </tr>                               
        <tr>
            <td></td>
            <th class="form_label"><label for="Companies_Note">message:</label></th>
            <td><textarea id="Companies_Note" name="Companies_Note" rows="8" cols="50"></textarea></td>                                 
        </tr>                               

        <tr>
            <td></td>
            <td><input id="send_contact" name="submit" type="submit" value="שלח" /></td>                    
        </tr>                               

    </table>
</form>         

Thank you

1
Maybe you should use the filter 'wpcf7_posted_data' and post the data to your CRM via CURL. You can get a CURL example here: stackoverflow.com/questions/3080146/post-data-to-url-phpMadSputnik

1 Answers

2
votes

I managed to fix the problem using this great plugin: http://wordpress.org/plugins/contact-form-7-3rd-party-integration/screenshots/

needs some modification but works great.