Giter VIP home page Giter VIP logo

mailchimp-serverless-email-notification's Introduction

Description

This project uses [Serverless] (https://serverless.com/) to create a public endpoint (/send) where you can make POST calls to send mail via the [MailChimp] service (https://mailchimp.com/). The POST calls must be made by specifying the following parameters (text and object of the email) in the request body:

{
	"plain_text":"Email content plain text",
	"subject_line":"Email object"
}

Emails will be sent to a [Segment] (https://developer.mailchimp.com/documentation/mailchimp/reference/lists/segments/) of a [List] (https://developer.mailchimp.com/documentation/mailchimp/References/lists /) specified in the configuration file (env.yml).

Configuration

Create a Mailchimp account, create a List of Users for your Campaing, and take a Segment of your users and then enter the following values into the Serverless environment variable configuration file:

  1. mailChimpApiUrl // Mailchimp API Url
  2. mailChimpApiKey: // Mailchimp API Key
  3. mailChimpListId: // Mailchimp List Id
  4. mailChimpSegmentId: // Mailchimp Segment Id
  5. mailChiapEmailFromName: // Mailchimp Email 'From' name
  6. mailChimpReplyTo: // Mailchimp email Address

Run on localhost

Install dependencies

npm install

Use [Serverless Offline Plugin] (https://github.com/dherault/serverless-offline):

sls offline

Call the resource and send email:

curl -H "Content-Type: application/json" -X POST -d '{"plain_text":"Email content plaintext.","subject_line":"Email subject"}' http://localhost:3000/send

Deploy on Amazon Api Gateway via Serverless

sls deploy --stage dev --region eu-central-1 -v

It will return the online endpoint url, use it to make the POST calls and send your email.

mailchimp-serverless-email-notification's People

Contributors

22viig avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.