Cloud Storage Store and serve files at Google scale.
Mailchimp makes it easy to sell stuff online, even if you don’t have an e-commerce store. Our website and commerce tools give you everything you need to launch your business, including a custom domain.MailChimp Ecommerce Integrations
It's easy to connect Firebase Cloud Storage + MailChimp Ecommerce without coding knowledge. Start creating your own business flow.
New File Within Cloud Storage
Triggers when a new customers is created or sent.
Triggers when a new Orders is created or sent
Triggers when a new Products is created or sent
Upload File in Cloud Storage
Creates a Customers draft
Creates a custom Order for an existing
Creates a Product draft
To begin with, what is Firebase Cloud Storage It is “a back-end storage service that lets you upload, store and serve your data.” (Google Developers. Firebase Cloud Storage is a cloud-hosted relational database that allows you to upload files, like images or text documents, as well as reference those files to retrieve them later. With Cloud Storage, users can store unlimited files and the service automatically scales up as more users upload data.
In addition to storage, Firebase Cloud Storage also provides for secure authentication. This means that developers can choose from a variety of identity providers to use with their applications. In this situation, since we are integrating MailChimp Ecommerce with Firebase Cloud Storage, we will need a secure way to allow users to log in. An easy way to do this is to use the Google Sign-In SDK.
As for MailChimp Ecommerce, it is a top that allows you to “sell digital and physical products through your website or social media channels.” (MailChimp. Ecommerce is a great top for selling your own artwork, digital products, and physical products. With Ecommerce you can directly connect your website with MailChimp, so when a user purchases a product, you can easily send an email via MailChimp.
Integration of Firebase Cloud Storage and MailChimp Ecommerce is pretty straightforward. When a user buys a product from your store using Ecommerce, you can access the purchase information using Firebase Cloud Functions and then send an email to your customer via MailChimp.
The first step is to create a Cloud Function that will be triggered when a product is purchased. You can do this by going into the Firebase conspe and clicking on “Cloud Functions” under the “Develop” tab. After you click on “Cloud Functions” you should see a screen like the one below:
Next, click on the “Create function” button and give your function a name. Also, make sure to select the trigger “Purchase event” and the language “Python 2.7”. After you click on “Create function”, you should see a screen like the one below:
Now that we have created the function, we need to add some code to it. To see the code that we will use for our function, click on “Continue button” and you should see a screen like the one below:
Now copy and paste the fplowing code into your function:
import firebase from firebase import auth import os import sys import urllib def fb_auth(creds). ""Return auth token if authenticated using Google auth otherwise return None."" auth = auth.get_credentials(. creds = auth.credentials if creds is None or creds.user != None. return None else. return creds def create_mailchimp(). ""Create mailchimp email."" email_body = " email_subject = " email_to = " # Create MailChimp API Key mailchimp_key = os.environ['MAILCHIMP_SECRET_KEY'] mailchimp_api_url = 'https://api.mailchimp.com/v3' email_client = mailchimp.MailchimpAPI(mailchimp_key. email_client.login(. _email = str(email_client.account(.list()) clientId = _email['id'] campaignId = _email['campaign_id'] listId = _email['id'] email_body = " email_subject = " email_to = " # Create "Email" object within MailChimp API # Note. Need to put in quotes if using special characters # ex. "This is my subject!" email = "Hello %s!
%s" % (email_to, email_body. print(email. ""Set variables for creating our MailChimp Email."" email_from = "YOUR NAME" email_reply_to = "[email protected]" email_subject = "Firebase Cloud Storage Integration" text = "Hello! Thank you for purchasing my product through MailChimp Ecommerce! I wanted to personally thank you for supporting my work." # Create list within MailChimp API listId = _email['id'] listId = listId + "-mylist" listName = "My List" listUrl = "%s/lists/%s" % (mailchimp_api_url, listName. listUrl += "/subscribers" listUrl += "/create" print(listUrl. print(listName. print(listUrl. print("Creating List". response = client.campaigns(.lists(.create(list=listId, name=listName, url=listUrl. print("List Created". # Send Welcome Email response = client.campaigns(.lists(.create(list=listId, name=listName, url=listUrl. print("List Created". response = client.campaigns(.lists(.create(listId, name="My List", url='https://' + listId + '.us2.list-manage.com/subscribers'. print("List Updated". return [response] def main(). ""Print out variables for testing purposes when running locally."" listName = "My List" listUrl = "%s/lists/%s" % (mailchimp_api_url, listName. print(listName. print(listUrl. print("Testing". # Create MailChimp API Key mailchimp_key = os.environ['MAILCHIMP_SECRET_KEY'] # Get MailChimp API Response resp1 = create_mailchimp(. if resp1 is not None. print("Response 1:" , resp1. else. print('No response from MailChimp API'. resp2 = create_mailchimp(. if resp2 is not None. print("Response 2:" , resp2. else. print('No response from MailChimp API'. return [resp1] def main(). ""Run function locally by calling main(. method."" fb_auth(MAILCHIMP_SECRET_KEY. # Get MailChimp API Response resp1 = main(. print("Response 1:" , resp1. resp2 = main(. print("Response 2:" , resp2. if __name__ == '__main__'. main()
After you enter this code into your function, click on “Save” and then click on “Deploy”. After that you should see a screen like the one below:
Now go back to the “Cloud Functions” tab and make sure that your function has been deployed successfully by clicking on “Actions” and then on “View logs” under the “Conspe” tab:
It may take a few minutes for your function to deploy successfully but it should eventually look similar to the image above. Now that your function is deployed successfully, let’s test it out by creating a test account and buying a product from our site that uses MailChimp Ecommerce. We will use the same link that we used before. https://lazertester.firebaseapp.com/products/5a3b9d6ddc2591349d85d394cpor=black&quantity=2&price=10
When we try to buy the product we should get an error message stating that our account needs to be authenticated with Google before we can buy any products from our store. If you don’t see this error message then go back to your Firebase conspe and make sure that your function has been successfully deployed. To fix this error message, go back to your Firebase conspe and select “Authentication” under the “Develop” tab then click on “Sign in method” in the Authentication section of the Authentication tab in the Authentication section of the Authentication tab in the Firebase conspe:
Click on “Google Sign-in SDK” under the sign in methods section of the Sign in method tab in the Sign-in method section of the Sign-in method tab in the Firebase conspe:
Click on “Configure consent screen & Credentials” under the Google Sign-in SDK section of the Google Sign-in SDK section of the Google Sign-in SDK section of the Sign in method tab in the Sign-in
The process to integrate Firebase Cloud Storage and MailChimp Ecommerce may seem complicated and intimidating. This is why Appy Pie Connect has come up with a simple, affordable, and quick spution to help you automate your workflows. Click on the button below to begin.