Giter Club home page Giter Club logo

parse-hubspot-mail-adapter's Introduction

parse-hubspot-mail-adapter

Used to send Parse Server password reset and email verification emails though HubSpot

How to use

Create your emails within your HubSpot dashboard first!

In your HubSpot emails for Email Verification & Password Reset please create properties based off of this PublicSingleSendRequestEgg:

{
  message: { recipient },
  contactProperties: { firstname },
  customProperties: { link }, // the link that Parse will create for respective action above
  emailId: 'your email id for respective email template'
}

Generic Email: The body of the generic email will be passed in as a string of markdown.

{
  message: { recipient },
  customProperties: { body },
  emailId: 'your email id for respective email template'
}

Configuration in ParseServer

const server = ParseServer({
  ...
  emailAdapter: {
    module: 'parse-hubspot-mail-adapter',
    options: {
      // Your Access Token for HubSpot
      accessToken: 'your-hubspot-access-token',
      // Used for modifying a custom subject line if genericOnly flag is used
      // i.e. appName: 'app' --> Subject lines will be "app | Verify your email"
      appName: 'Name of your app',
      // Your verification email ID
      verificationEmailId: 'email-id-for-verification-email',
      // Your Password Reset email ID
      passwordResetEmailId: 'email-id-for-password-reset-email',
      // Your generic email ID
      genericEmailId: 'email-id-for-generic-email',
      // This will send the email verification, password reset email with your generic Email Id
      // true if you want to create your emails with HTML instead of creating them in HubSpot.
      genericOnly?: boolean,
      // paths to point to your email html files
      verificationEmailFolder: './public/path/to/verificationEmails',
      passwordResetFolder: './public/path/to/passwordResetEmails',
      // The name property of the Parse User you'd like to use ('firstName', 'name', 'username') 
      // defaults to 'firstName' if no property is passed in
      defaultNameProperty: 'firstName',
      // default language if a user does not have a preferred language
      defaultUserLanguage: 'en',
      // the name of the column of the user properties for language preferences
      userLanguagePropertyName: 'lang'
    }
  }
  ...
});

Using genericOnly flag

If you want to send emails based off of a users language please create a folder with two seperate folders for each kind of Email you'd like to send:

example

public
├───i18n
│   ├───passwordReset // en.html, ja.html, ar.html
│   └───verificationEmail // en.html, ja.html, ar.html

HTML Templates: en.html:

<div>
  <p> Hello <%= firstname %><p>
  <p> Please verify your email with this <a href="<%= link %>">link</a>.<p>
</div>

Please write your HTML with the ejs template sytax, as this adapter will be looking to replace them.

parse-hubspot-mail-adapter's People

Contributors

ryanvu avatar justacodemonkey avatar

Watchers

 avatar  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.