Skip to content
Article

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

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 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.

The Atlantic BT Manifesto

The Ultimate Guide To Planning A Complex Web Project

Insights

Atlantic BT's Insights

We’re sharing the latest concepts in tech, design, and software development. Learn more about our findings.

Questions & Answers

Are there differences in application architecture that are important for the cloud?
It is important to build applications and workloads specifically for the cloud. You will want to carefully consider what services the cloud provider of your choice has to offer and how your application leverages those services.
Learn More about Are there differences in application architecture that are important for the cloud?
Are there any drawbacks to cloud hosting?
Yes, there will always be some risks associated with any hosting option. You are relying on the resiliency and engineering of infrastructure that has scaled at an astounding rate.
Learn More about Are there any drawbacks to cloud hosting?
What’s the benefit of hosting in the cloud vs. traditional options?
Reasons not to host in the cloud are few and far between. If you don't host in the cloud, you will spend more in both CapEx and OpEx to manage your applications or websites in a traditional environment.
Learn More about What’s the benefit of hosting in the cloud vs. traditional options?
How can I improve the performance of my application?
There are several primary reasons that applications perform poorly, and in some cases it’s a combination of several. 1) Data latency: If your application is making calls to a data source (whether it’s an API or a direct call) and there is latency at the data provider, your application performance will suffer.
Learn More about How can I improve the performance of my application?
Should I move my application to the cloud?
The answer is ‘probably yes’. There aren’t many reasons for an application to be hosted elsewhere, aside from occasional compliance standards, or requirements to integrate with local services that would require large amounts of data to move from on-premise to cloud.
Learn More about Should I move my application to the cloud?
Where should my application be hosted?

There are many different options for hosting, but most applications would do well with one of the cloud providers -- Amazon Web Services, Google Cloud Platform, Microsoft Azure.

Learn More about Where should my application be hosted?