This library provides a set of functionalities for handling email parameters, templates, and sending emails
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';
- 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}
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>;
}
type ContactBridgeSdkConstructorParams = {
s3: S3Interface;
ses: SESInterface;
dynamo: DynamoDbInterface;
};
This feature aims to retrieve the template stored in the S3 bucket.
-
Input:
{ template_path: string; }
-
Output:
string;
This feature aims to parse the template with given properties.
-
Input:
{ template: string; properties?: Record<string, unknown>; }
-
Output:
string;
This feature aims to send email with SES.
-
Input:
{ from?: string; to: Array<string>; subject: string; body: string; }
-
Output:
void;
This feature aims to get email params
-
Input:
{ name: string; }
-
Output:
{ name: string; template: string; subject: string; images_url: Record<string, string>; }
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; }