Squarespace actually allows to connect with Mailchimp, but it only happens with Form/Newsletter submission only (to create new lead on Mailchimp list). What would you do to assign tags based on purchased products on lead item?
1. The problem
- Get email notified when someone ordered
- Check email to get basic info: customer email, billing address, line item’s product name, look up for lead tag value (in case you need to trigger an automation via tag assigning)
- Manually place these pieces of information to Mailchimp
Repeat these steps for 1, 10 or thousands of times may become a pain, check how people asked about it around
- Product sales linked to MailChimp for automatic email campaign – Commerce – Squarespace Forum
- Passing product tags through to mailchimp – Commerce – Squarespace Forum
- Send out a custom email to customer when they buy a specific product – Coding and Customization – Squarespace Forum
2. How it solved?
When it comes to automation, Zapier is a common name, but sadly the connection between Squarespace and Zapier is limited (only available for form submission). So for the first version of the implementation, I tried to implement an email parser to read the order confirmation email in admin inbox and use these info to fire Mailchimp API to register lead and assign tag.
It turned out working well, but it was a bit silly (!?) because I overlooked the built-in API of Squarespace, which can be found here. Which the help of the API and a Google Spreadsheet, I can achieve the working solution smoothly. How a Google Sheet can help (?), you may asked yourself, so here’s why
- It’s free (with quota limitation)
- Google Apps script can trigger Squarespace API call as well as Mailchimp API
- A time driven trigger can be set up to check for lastest order made automatically
- The Google Sheet can be used as logger to display the tagged order
3. Is it actually work?
- An order made on my store
- Upon a certain period of time ( 5 minutes in this case ) the order is fetched from the api
- A JSON object is recieved and parsed into basic lead info
- The Mailchimp API endpoint is called to pass the info along and new lead with tag created/updated