contact form 7 integration with ConvertKi without using plugint

How to integrate Contact Form 7 with ConvertKit without using plugin

ConvertKit is a email marketing software for creators and getting popular among the marking folks. Contact Form 7 is actively installed in over 5 million WordPress websites.

Here’s how to integrate CF7 with ConvertKit, so that the sender is automatically subscribed to a ConvertKit list when they submit form. Integration is really simple and you can do that in few steps without using any plugin. So let’s make it happen.

Step 1:

You need ConvertKit API keys so we can make call to subscribe function. You can grab your API key from account settings option in ConvertKit. see screenshot below:

Step 2:

In this step you need ConvertKit form ID, you can grab this from form embed options as shown in the image below:

Step 3:

This is the final step and now you need to add PHP code to the functions.php file. I highly recommend to use child theme otherwise your code will be overwritten upon updating parent theme.

Please don’t forget to update API key, form ID and field names in the code below.

About Javed Iqbal

Mr. Javed Iqbal is a senior php developer and co-founder at MZ Creative Studio. His experience is more than 8 years in this field. He loves working on challenging projects.

8 thoughts on “How to integrate Contact Form 7 with ConvertKit without using plugin

  1. Hi,
    Not working.
    Using ‘Content-Type: application/json; charset=utf-8’ instead (See API docs) made it work. Also, note that you have a typo on line 12 ( ‘;’ at the end of the ID).


  2. This is works great! Only thing I can’t figure out is how to have it ONLY submit for ONE specific Contact 7 Form. Is that possible?

    1. Hi Tamala,
      Yes, this is possible. You will need to wrap the code from line no. 5 to line no. 22 in this ‘if condition’ code where ’11’ is the form id. Please replace ’11’ with your own form id.

      if($contact_form->id == 11) {
      // put all code from line no. 5 to line no. 22 inside this condition


  3. Hi there, thanks so much for sharing the code. Could i please ask, is it possible to also capture custom field data? For example, say i wanted to separate first name and last name, as well as capture the phone number data from ContactForm7 into ConvertKit.

    Is there documentation on how to interface wordpress with convertkit?

    If you could please point me in the right direction, that would be great – thank you!

    1. Hi,
      Yes, you can capture custom field data. For this, you have to update code and set first name, last name and phone number variable like in line #9:

      $first_name = $posted_data["your-name"];

      So your new variables like:

      $first_name = $posted_data["first-name"];
      $last_name = $posted_data["last-name"];
      $phone = $posted_data["phone"];

      Please make sure you put the correct field name in:

      $posted_data['contact form 7 field name']

      after that you need to update line # 14 where we have to pass json data like this:

      $jsonData = '{"api_key": "'.$api_key.'","first_name":"'.$first_name.'","last_name":"'.$last_name.'","phone":"'.$phone.'","email": "'.$email.'"}';

      Please also make sure you have custom field called phone in convertkit form.

      For more help, please contact us through our website’s contact page form. Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *

Do you have a website project you’d like to discuss?

Get in touch