Skip to content
AtlanticBT Monogram Atlanticbt.com
Menu
marketing
February 2, 2012

WordPress – Submit forms to 3rd-party services with Contact Form 7

capabilities covered
Amazon Web Services

Here’s a WordPress plugin that will allow you to send Contact Form 7 submissions to a 3rd-party Service like a CRM.  Multiple configurable services, custom field mapping, pre/post processing.

Download Contact-Form-7: 3rd-Party Integration  Download from WordPress

As taken from the readme file:


Description

Send Contact Form 7 Submissions to a 3rd-party Service, like a CRM. Multiple configurable services, custom field mapping. Provides hooks and filters for pre/post processing of results. Allows you to send separate emails, or attach additional results to existing emails. Comes with a couple examples of hooks for common CRMs (listrak, mailchimp, salesforce).

The plugin essentially makes a remote request (POST) to a service URL, passing along remapped form submission values.

Includes hidden field plugin from Contact Form 7 Modules: Hidden Fields. Based on idea by Alex Hager “How to Integrate Salesforce in Contact Form 7


Installation

  1. Unzip, upload plugin folder to your plugins directory (/content/plugins/)
  2. Make sure Contact Form 7 is installed
  3. Activate plugin
  4. Go to new admin subpage “3rdparty Services” under the CF7 “Contact” menu and configure services + field mapping.

Please note that this includes an instance of hidden.php, which is part of the “Contact Form 7 Modules” plugin — this will show up on the Plugin administration page, but is included automatically, so you don’t need to enable it. This file will only be included if you don’t already have the module installed.


Frequently Asked Questions

How do I add / configure a service?

See Screenshots for visual examples.

Essentially,

  1. Name your service
  2. Enter the submission URL — if your “service” provides an HTML form, you would use the form action here
  3. Choose which forms will submit to this service (“Attach to Forms”)
  4. Set the default “success condition”, or leave blank to ignore (or if using post processing, see Hooks – this just looks for the provided text in the service response, and if present assumes “success”
  5. Allow hooks for further processing – unchecking it just saves minimal processing power, as it won’t try to execute filters
  6. Map your form submission values (from the CF7 field tags) to expected fields for your service. 1:1 mapping given as the name of the CF7 field and the name of the 3rdparty field; you can also provide static values by checking the “Is Value?” checkbox and providing the value in the “CF7 Field” column.
  7. Add, remove, and rearrange mapping – basically just for visual clarity.
  8. Use the provided hooks (as given in the bottom of the service block)
  9. Add new services as needed

How can I pre/post process the request/results?

See section Hooks. See plugin folder /3rd-parties for example code for some common CRMs, which you can either directly include or copy to your code.


Screenshots

  1. Admin page – create multiple services, set up debugging/notice emails, example code
  2. Sample service – mailchimp integration, with static and mapped values
  3. Customized thank-you page

Hooks

  1. add_action('Cf73rdPartyIntegration_service_a#',...
    • hook for each service, indicated by the #this is given in the ‘Hooks’ section of each service
    • provide a function which takes $response, &$results as arguments
    • allows you to perform further processing on the service response, and directly alter the processing results, provided as array('success'=>false, 'errors'=>false, 'attach'=>'', 'message' => '');, where
      • success = true or false – change whether the service request is treated as “correct” or not
      • errors = an array of error messages to return to the form
      • attach = text to attach to the end of the email body
      • message = the message notification shown (from CF7 ajax response) below the form
    • note that the basic “success condition” may be augmented here by post processing
  2. add_filter('Cf73rdPartyIntegration_service_filter_post_#, ...
    • hook for each service, indicated by the #this is given in the ‘Hooks’ section of each service
    • allows you to programmatically alter the request parameters sent to the service

Basic examples provided directly on plugin Admin page (collapsed box “Examples of callback hooks”). Code samples for common CRMS included in the /3rd-parties plugin folder.

capabilities covered
Amazon Web Services

The Atlantic BT Manifesto

The Ultimate Guide To Planning A Complex Web Project

Partner With Us

Ready for modern web technology and a sharp, user-friendly design? We want to give you exactly that. Contact us to get started.

Contact
  • This field is for validation purposes and should be left unchanged.