- Node v14.15+
- Install dependencies
npm install
- Run lint
npm run lint
- Run test
npm run test
- Start app
npm run dev
To update snapshopt tests, issue the command npm run update-tests
.
Follow the tutorial in https://devcenter.heroku.com/articles/git Or:
- Init git repo:
git init
git add .
git commit -m "init"
- Push the repo up to Heroku Install heroku-cli first, then:
heroku create
git push heroku master
- Copy the deployed url on the console and open it in the browser.
- Create your own Google Sheets
- Login your Google account at https://docs.google.com/spreadsheets
- Create empty sheets
- Copy the header row from https://docs.google.com/spreadsheets/d/1sRIijZtI0aFvs-lAl_XnOHuHpgJoZ9hypWhGWYZ_iaM/edit?usp=sharing.
- When you create a blank spreadsheet in Google Sheet, you can get its ID from the address bar of your browser. It’s the string of random characters after the /d and before the /edit. Remember this ID for later use.
- Create credentials for accessing Googlesheets API
- Login your Google account at https://developers.google.com/sheets/api/quickstart/nodejs
- Click Enable the Google Sheets API and enter project name and click Next, in my example it's ROI Calculator
- Select Web Server in the Configure your OAuth client dropdown*, then click Create
- Click the API Console hyperlink below to go to the console page, then make sure you select the project you just created
- Click Credentials on the left side menu, then click + CREATE CREDENTIALS on the main panel, select Service Account
- Enter the account name and optionally enter the description for this account, then click Done
- In the service account page, select KEYS tab, click Add Key, select Create new key, select Key type as JSON and click Create, keep the auto-downloaded JSON file for later use.
- Remember the email address of the service account your just created for later use
- In order to edit the spreadsheet we created in step 1 with this service account, we need to grant access to the email address we get from step 2.8
- In the spreadsheet, click Share
- Paste the email address and select it, then click Done to share the spreadsheet with it
- Set up configuration and credentials in the React project
- In the config files, change the value of GOOGLE_SPREADSHEET_ID to the ID you found at step 1.4
- At the developer console page, Credentials tab of your project, click OAuth client in the OAuth 2.0 Client IDs
- Add Authorized JavaScript origins,
http://localhost:3000
,http://localhost:3100
, these 2 origins are for local deployment. If you plan to deploy the app with other origin, you need to add URI here. After adding all origins, click Save - Find the JSON file downloaded in step 2.7, change file name to
googlesheets-credential.json
and move the downloaded JSON file to the root directory of the React project
- Add Authorized JavaScript origins,
As we use
server.js
to provide functionality of the Google sheets API, when we runnpm run dev
to serve the app with webpack-dev-server, we still needserver.js
running. Check package.json to see the PORT we use to runserver.js
. Also checkwebpack.config.js
module.exports = { ..., devServer: { ..., proxy: ... } }
to see the port for which webpack-dev-server runs proxy.
- Login to the dashboard page of Mailchimp, we need to create some audience fields,
- Click Audience icon on the left side
- Click All Contacts
- Click Settings dropdown, then click Audience fields and *|MERGE|* tags, then add the fields from our sheets that Mailchimp doesn't have by default
- Click Add A Field, select field type for the field you are about to add
- Enter the label for this field, and Optionally enter the tag name for this field in your content
- Click Save Changes, and Repeat the 3 steps we have just done until all necessary fields are added.
- After all fields are added, it should look like this
- Create automation to send Email when an event is triggered
- Click Automation icon on the left side
- Click Create and click Classic Automations
- Click Automated tab, API tab, and click Event API entry
- Enter Campaign Name(in my example it's Event API) and select the audience at which you just added the audience fields, click Begin
- Click Edit on the trigger row,
- Set delay to Immediately, and Event Name to
SendCalcResults
, click Update Trigger - Click Design Email
- Enter the email information you want and click Next
- Select a template, I will select Basic - 1 Column for simplicity here.
- Click the blocks to edit the template, here we will use the tags we added in step 1
- Here is how my email template looks
- Click Save And Continue
- Make sure the automation is activated, if not, please click back into the automation page and click button in the bottom-right corner to activate
- After you log in to the dashboard of Zapier, click Make a Zap
- Set up trigger
- Search the app Google Sheets and select it
- Select Trigger event to New or Updated Spreadsheet Row, click Continue
- Click Sign in to Google Sheets and sign in with your Google account, click Continue
- Select the Spreadsheet and Worksheet and click Continue
- Set up Action to add subscriber to Mailchimp
- Searh the app Mailchimp and select it
- Select Action event to Add/Update Subscriber, click Continue
- Click Sign in to Mailchimp and sign in with your Mailchimp account, click Continue
- Select the audience
- Click Subscriber Email field and select work_email
- Click Double Opt-In field and select False
- Click Update Existing field and select Yes
- We will skip Replace Groups, Groups and Language Code fields
- Click other necessary fields and select the corresponding data from the sheet, and click Continue
- Click to + icon below the Action Add/Update Subscriber in Mailchimp and set up Action to send custom event to Mailchimp
- Search the app Mailchimp and select it
- Select Action event to Create Custom Event, click Continue
- Choose your Mailchimp account
- Select your audience
- Select Email Address with Email field from the previous action
- Enter
SendCalcResults
as the Custom Event Name, click Continue
- Click the toggle below to turn on the zap