Adding Subscribers to Mailchimp

Overview

This tutorial will lead you through the process of connecting Mailchimp to Gladly so that every time a new customer is created in Gladly, that customer will automatically be added to your Mailchimp campaign.

Getting started

To successfully complete this tutorial, you will need:

Adding Subscribers in Mailchimp

Step #1: Create a new Zap

If you're new to Zapier, don't worry! Zapier provides a wonderful guide on how to get started creating Zaps.

Step #2: Choose the Gladly app

For the first action of your new Zap, search for and choose Gladly (1.0.1).

gladly_zapier_app.png

Hint: Don't forget to give your Zap a descriptive name!

Step #3: Add a Customer Created trigger

Choose Customer Created as the trigger event. This means that every time a customer is created in Gladly (excluding those created through the Gladly API), this Zap will be triggered.

customer_created.png

Authenticate: At this point, you will be asked to authenticate with your Gladly account. This is where you need your Gladly username and API token. If you need help generating an API token, check out the developer docs.

gladly_zapier_auth.png

Hint: The Gladly URL will generally be https://{YOUR-APP-NAME}.gladly.com

Step #4: Request Customer Details from Gladly

Create the next step in your Zap. Choose the Gladly application again, but this time use the Get Customer Action Event.

get_customer.png

You will be asked to select an authentication through Gladly again. Use the one from the previous step and click CONTINUE.

get_conversation_items.png

In order to get the correct customer, it's important to pass the customerId as part of the request. To do this, click the icon to the right of the dropdown menu in the Customize Customer step to select from the received payload from the first action. Select Id of created customer from the list.

customer_id.png

Once you have selected it, it should look something like this:

customer_id_2.png

Step #5: Get the customers email address

Create the next step in your Zap. Choose Code by Zapier, but this time use the Run Python Action Event.

run_python.png

Select the Emails block from the Gladly payload as input to use in the code block.

customize_python.png

Paste the below code into the Code section of the Run Python Action Event.

output = {}

y = [x.split(": ")[1] for x in input.get('emails').split('\n') if x.split(": ")[0] == "normalized"]
if len(y) == 1:
    output['email']=str(y[0])

customize_python_2.png

Step #6: Ensure the customer has an email address

Create the next step in your Zap. Choose the Filter helper by Zapier as the Action Event.

filter.png

Chose the Email field from the Run Python step.

Note: This will only work if the Gladly Customer only has one email address.

filter_email.png

Select the Exists condition.

filter_if_email_exists.png

The flow will automatically stop here if no email address can be found for the Gladly Customer.

Step #7: Create a subscriber in Mailchimp

Add another action to your Zap, this time choosing Mailchimp as the App and Add/Update Subscriber as the Action Event.

add_sub_mailchimp.png

Once you've connected to your Mailchimp account, choose the Audience that the subscriber will be added to.

Add Customer Email

Use the Email from the Run Python Action Event to populate the Subscriber Email.

customize_sub_mailchimp.png

Populate the other fields (like first or last name) as desired and click Continue.

Step #8: Test your Zap!

You're all done with setup! How easy was that?

Now you can test your Zap by turning your Zap on, creating a Customer in Gladly, and then checking for the new subscriber to be added to your Mailchimp campaign.

You can also check that everything went through your Zap on Zapier by going to the Task History menu at the top when you log in.

Now sit back and watch your Mailchimp subscriber list grow.

mailchimp_subs.png