@icapps/tree-house-communication

Tree House communication module


Keywords
tree House, treehouse, treehouse communication
License
ISC
Install
npm install @icapps/tree-house-communication@1.1.1

Documentation

Treehouse Communication

Communication module written in TypeScript providing communication utilities.

npm version Dependencies Build Status Coverage Status Greenkeeper badge

General

This module is used to send emails with Mandrill and only template requests (for now).

Installation

npm install @icapps/tree-house-communication

Usage example

import * as emailService from 'tree-house-communication'

// set Mandrill API key
emailService.setMandrillApiKey('secretMandrillKey')

// Create email(s)
const mailInfo : ITemplateRequest = {
  templateName: 'icapps-newsletter-template',
  subject: 'My subject',
  from: { email: 'info@icapps.be', name: 'Info icapps' },
  to: [{ email: 'testAddress@gmail.com', name: 'Optional',
    content: [{ name: 'greeting', value: 'Hello test!' }] }],
  globalContent: [{ name: 'news', value: 'content of big news' }],
};

const extraMandrillOptions = {
    async: true,
    message: { bcc_address: 'test@gmail.com' }
    }

// Send email(s)
const result = await sendEmailWithTemplate(mailInfo, extraMandrillOptions);

// example result
[
  {
    email: 'email@mail.com',
    status: 'queued',
    _id: 'e8b9d10ea47e47629d95b22fe200389d'
  }, {
    email: 'anotherEmail@mail.com',
    status: 'queued',
    _id: '308274f983f14eb09d266dd9abe51546'
  }
]

See all extraMandrillOptions

Tests

  • You can run npm run test to run all tests
  • You can run npm run test:coverage to run all tests with coverage report

Authors

See the list of contributors who participated in this project.

License

This project is licensed under the ISC License - see the LICENSE.md file for details