mermberfix logo x
The MemberFix Team’s got you covered.
Membership plugins

How to deeply integrate MemberMouse with ConvertKit

membermouse convertkit integration

Introduction

Overview

Recently, one of our customers here at MemberFix needed an integration of the MemberMouse membership plugin with ConvertKit.

Actually, there is already a plugin which offers such an integration but it is very limited. It only allows you to add a tag to a new MemberMouse member (but not remove a tag). So, if you need a more sophisticated integration which involves ConvertKit sequences, forms or retrieving information about a subscriber, you’ll need a custom solution.

As an example of such integration, let’s say, for example, that we will need to assign a certain ConvertKit sequence and tag to a user who buys a MemberMouse product.

So, on your WordPress website you will need:

The integration solution

The plan for doing such an integration is to use the ConvertKit API combined with a MemberMouse Push Notification which will call a PHP script when a product is purchased.

Retrieving the ConvertKit API key

We will need the API key for the PHP script. Just login to your ConvertKit account and go to “Account settings”.

convertkit account settings - How to deeply integrate MemberMouse with ConvertKit

On the next page you will be able to see the API key.

convertkit api key - How to deeply integrate MemberMouse with ConvertKit

How to get the ConvertKit sequence ID

As I said above, we will need to add any user who subscribes to a certain ConvertKit sequence. To achieve this we will need the sequence ID first. Just click on the top “Sequences” menu.

sequence id - How to deeply integrate MemberMouse with ConvertKit

When you mouse over any of the sequences you have set up, you will see on the browser status bar the link to the sequence page which contains the sequence ID. Or you simply click on the sequence and land on the sequence page. The sequence web address contains the sequence ID.

sequence id convertkit - How to deeply integrate MemberMouse with ConvertKit

How to get the tag ID

Click on “Subscribers” top link and on the page which will open just scroll down and you will be able to see, on the right side, the list of tags.

tags page - How to deeply integrate MemberMouse with ConvertKit

When you mouse over a tag, in the browser status bar you will see a link which contains the tag ID.

tag id convertkit status bar - How to deeply integrate MemberMouse with ConvertKit

The PHP script

Now that we have the API key, the sequence ID and the tag ID we can start to build the PHP script using ConvertKit API specifications.

As mentioned earlier, this script will be called when a user buys a MemberMouse product. To accomplish this we will use a MemberMouse push notification. In the PHP script we will get the email field from the submitted form and we will use it to assign the user to a certain sequence and to add a ConvertKit tag.

Here it is the script:

<?php
if(!isset($_GET[“event_type”]))
{
// event type was not found, so exit
exit;
}
else
{
$eventType = $_GET[“event_type”];
}
$email = $_GET[“email”];
$param= array();
$param[‘api_key’] = ‘your api key here’;
$param[’email’] = $email;
$url = ‘https://api.convertkit.com/v3/courses/{sequence id here}/subscribe’;
$url2 = ‘https://api.convertkit.com/v3/tags/{tag id here}/subscribe’;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(‘Content-Type: application/json’));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, “POST”);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($param));
$results = curl_exec($ch);
curl_close($ch);$ch2 = curl_init();
curl_setopt($ch2, CURLOPT_URL, $url2);
curl_setopt($ch2, CURLOPT_HTTPHEADER, array(‘Content-Type: application/json’));
curl_setopt($ch2, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch2, CURLOPT_POST, true);
curl_setopt($ch2, CURLOPT_CUSTOMREQUEST, “POST”);
curl_setopt($ch2, CURLOPT_POSTFIELDS, json_encode($param));
$results2 = curl_exec($ch2);
curl_close($ch2);
?>

 

*Don’t forget to add your API key along with sequence and tag IDs to the script above. You will need to upload the file (let’s name it ConvertKitAPI.php ) to your FTP.

Once you’ve uploaded the script there is one more step to do: create the MemberMouse Push Notification!

How to create the MemberMouse Push Notification

Login in to your WordPress website and go to MemberMouse > Developer Tools and click on “Create Push Notification”.

create push notification - How to deeply integrate MemberMouse with ConvertKit

Then set up the push notification. Choose “Product Purchased” for the event. You can choose the event to happen for all products or select a certain product from the drop down. Select “Call a Custom Script” for the action and enter the URL to the PHP script we have created. Then click “Save Push Notification”.

push notification settings - How to deeply integrate MemberMouse with ConvertKit

Conclusion

The integration is now complete.

When a new MemberMouse user is added, a push notification will be sent by MemberMouse (depending on the trigger event you set up for this push notification), which will call the script and cause it to be executed. You can, of course, modify and extend this script (or have us do it for you!) to your heart’s content. 

Please let me know if you have any comments or questions. Or, if you need a custom integration for MemberMouse and ConvertKit (say, for example, adding subscribers to forms, or updating subscriber details, etc.) you can hire us to do that here: MemberFix service.

You may also enjoy...

WordPress based membership sites have certain requirements, and make use of certain applications that, in my experience, makes most of the popular hosting providers a poor choice.
Email marketing has changed insanely fast over the last few years. Click here to find out the BEST email app to use in 2017…
A Better Way To Stream Your Video Content on your membership site!
Need a thumbnail for your membership website – we have a juicy service for you!
Subscribe
Notify of
guest
6 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
André Chaperon
November 21, 2019 3:46 am

Love this script. I’ve modified it a little for my own use case.

One nice tweak would be parsing the first name field, and ideally, also the second name field (which would need to be a custom field of course).

André

Vic Dorfman
Admin
Reply to  André Chaperon
April 6, 2020 8:24 am

Hey Andre, sorry for the late reply! Thanks for the nice comment.

Yes you’re right that would be a logical tweak to the script. I guess you got it sorted already though.

By the way, big fan of yours. 🙂

Best,
Vic

Curtis B
February 6, 2020 5:30 pm

SC, great article! Thank you for sharing this with everyone! And after all of your work producing this script and sharing this post, I almost hate to share this, but I think there are people out there that will find this additional information helpful (as well). There HAS been an update to the MemberMouse/ConvertKit Integration plugin — it just hasn’t been submitted and posted in to a place that was easy to find. Back in January of 2018, I was migrating to ConvertKit from another email service provider, and I asked incredibly nicely at the time if someone at ConvertKit could… Read more »

Vic Dorfman
Admin
Reply to  Curtis B
February 7, 2020 1:40 pm

Hi Curtis,

Thank you so much for this amazing and generous share. 🙂

That’s super useful for us to know and hopefully will also save some of the readers of this post some time and headache too.

Cheers!
Vic

Juan
Juan
June 30, 2022 10:17 pm

Thank you for taking the time to create these kind of posts. It worked with ConvertKit, but unfortunately now MemberMouse doesn’t send a welcome email to the user.

Thanks,
Juan

Juan
Juan
Reply to  Juan
June 30, 2022 10:31 pm

Sorry!! The problem was my website, not the script. The script works excellent!