How to Connect Member Mouse API with Zapier Automation

I need help setting up an automation workflow between my CRM and Member Mouse using Zapier. When a specific tag gets added to a contact in my CRM, I want to automatically grant access to protected content bundles in Member Mouse.

Member Mouse provides this Python code example for their API:

import requests

# authentication details
api_token = 'ABC123XYZ'
api_secret = 'DEF456UVW'
level_id = '2'
partner_id = 'mypartner'

# member information
first_name = 'Jane'
last_name = 'Doe'
email_address = '[email protected]'

# build request data
data = {
    'api_token': api_token,
    'api_secret': api_secret,
    'level_id': level_id,
    'partner_id': partner_id,
    'first_name': first_name,
    'last_name': last_name,
    'email': email_address
}

response = requests.post(
    'https://www.MYSITE.com/wp-content/plugins/membermouse/api/request.php?q=/addMember',
    data=data
)

if response.status_code == 200:
    print('Member created successfully')
else:
    print('Error occurred:', response.text)

I’m not a programmer and I’m struggling with a few things. First, how do I properly configure the Code step in Zapier to run this API call? Second, the sample code throws a syntax error on line 32 even with valid credentials. Third, do I need to use a PUT request step or is the Code step enough for this workflow?

Any guidance would be really appreciated since Zapier support referred me here for technical help with the API integration.

hey! sounds like a hassle, huh? syntax errors can be a pain. try retyping those quotes like it was mentioned. and for the level_id, keep it as a string. if python’s tricky, maybe just go with Webhooks by Zapier for a smoother ride.

Had the same issues setting up Member Mouse automation last year. Ditch the Code step - use Webhooks by Zapier instead. Way more reliable. Set it as POST to your Member Mouse endpoint, then map your CRM fields straight to webhook parameters (api_token, email, first_name, etc). Way cleaner than fighting Python syntax errors. Webhooks give you better error handling too, plus you can see exactly what data gets sent in task history. Wasted hours debugging code steps before switching - should’ve gone with webhooks from day one. Test with a dummy contact first to make sure access grants work in Member Mouse before you go live.

I’ve hit this exact issue with Member Mouse integrations. That syntax error on line 32? It’s probably encoding problems from copy-pasting. Manually retype the quotes and apostrophes - don’t copy them.

For Zapier, use Code by Zapier with Python. Drop your fixed code in there. Pull contact data from your CRM trigger using input_data variables - don’t hardcode member info. The Code step handles everything since you’re just making a POST request with the requests library.

Add some error logging so you can debug failed API calls later. Trust me on this one.