Skip to content

lamaparbat/Mailchimp-Transactional-Services

Repository files navigation

Mailchimp Transactional Services Documentation

Nodmailer vs Mandril

Screen Shot 2022-11-22 at 16 57 48

Docs Guide

1. Init node project with typescript environment

npm init --yes [--yes flag lets npm fills the package. json file with the sensible default obtained from the current project folder.]

npm i express dotenv nodemon @mailchimp/mailchimp_transactional sequelize sequelize-cli pg pg-hstore

npm i -D typescript @types/node @types/express

npx tsc --init

mkdir src [contains .tsx extension file]

mkdir dist [contains .js compiled file]

touch index.tsx [inside /src directory]

touch .env [on root dir]

update the tsconfig.json file

  "baseUrl": "src/index.tsx", 
  "outDir": "./dist",

Create a new api key in Mandril domain

  1. Register account in Mandrillapp domain
  2. Generate a new api key [domain: https://mandrillapp.com/settings/]
  3. Copy the api key & paste it into .env file

Create a new api key in Mailchimp domain

  1. Register account in Mailchimp domain
  2. Generate a new api key [domain: https://us21.admin.mailchimp.com/account/api/]
  3. Copy the api key & paste it into .env file

Work on root index.tsx file

  1. Setup basic express api structure

    basic

  2. Utilize @mailchimp package

    a). Check if api connection is done successfully or not

    Screen Shot 2022-11-21 at 11 02 23

    b). Successfull Response be like:

    Screen Shot 2022-11-21 at 11 09 34
  3. Setup timescale db

    a). Screen Shot 2022-11-24 at 19 46 28

    b). Screen Shot 2022-11-24 at 19 47 06

    c). Setup timescale db connection

    Screen Shot 2022-11-24 at 20 04 30

Convert reportData JSON to CSV downloadable format

Screen Shot 2022-11-30 at 09 18 59