coren-contact-bridge-sdk
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

Welcome to coren-contact-bridge-sdk 👋

This library provides a set of functionalities for handling email parameters, templates, and sending emails

Getting start

Install package. You can use the package manager of your preference. (npm, yarn, pnpm and etc.)

pnpm add coren-contact-bridge-sdk

Import lib

import { ContactBridgeSdk } from 'coren-contact-bridge-sdk';

Defaults Values

  • Stage = process.env.STAGE | 'dev
  • Tenant = process.env.TENANT | 'core'
  • Region = process.env.REGION | 'us-east-2'
  • Email Params Table = ${Stage}_${Tenant}_email_params
  • Email Templates bucket = ${Stage}-${Tenant}-coren-email-templates-${Region}

Types

AWS Interfaces

export interface S3Interface {
  download(key: string): Promise<Buffer>;
}
export interface DynamoDbInterface {
  get<T>(key: GetCommandInput['Key']): Promise<T>;
}
export interface SESInterface {
  sendEmail(input: SendEmailCommandInput): Promise<SendEmailCommandOutput>;
}

Constructor

type ContactBridgeSdkConstructorParams = {
  s3: S3Interface;
  ses: SESInterface;
  dynamo: DynamoDbInterface;
};

Features

GetTemplate

This feature aims to retrieve the template stored in the S3 bucket.

  • Input:

    {
      template_path: string;
    }
  • Output:

    string;

ParseTemplate

This feature aims to parse the template with given properties.

  • Input:

    {
      template: string;
      properties?: Record<string, unknown>;
    }
  • Output:

    string;

SendEmail

This feature aims to send email with SES.

  • Input:

    {
      from?: string;
      to: Array<string>;
      subject: string;
      body: string;
    }
  • Output:

    void;

GetEmailParams

This feature aims to get email params

  • Input:

    {
      name: string;
    }
  • Output:

    {
      name: string;
      template: string;
      subject: string;
      images_url: Record<string, string>;
    }

GetAndParseEmailParams

This feature aims to get email params and parse the body with the template

  • Input:

    {
      name: string;
      properties?: Record<string,unknown>
    }
  • Output:

    {
      name: string;
      body: string;
      subject: string;
    }

Readme

Keywords

none

Package Sidebar

Install

npm i coren-contact-bridge-sdk

Weekly Downloads

1

Version

1.0.4

License

MIT

Unpacked Size

76.6 kB

Total Files

126

Last publish

Collaborators

  • rafael.moura1