New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

communication-service

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

communication-service

A central communication jobs service for sending emails and SMS

  • 1.0.1
  • unpublished
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

communication-service

A central communication jobs service for sending emails and SMS.

main flow

The service uses agenda to manage the jobs queue, set jobs, read jobs and execute any service can set a job on the agenda jobs queue (on mongodb-> jobs)

How to Create a communication job

// interfaces
export interface ISendMailPayload {
  from: string;
  to: string;
  subject: string;
  template: string;
  'h:X-Mailgun-Variables': indexedObject | string;
}

export interface ITwilioSMSPayload {
  message: string;
  phoneNumber: string;
}

// Exemple of a mail payload
const followerDataExemplePrm = {
  to: user.email,
  template: 'interview_edited',
  subject:
    'Interview edited by ' + (editor.name || editor.email) + ' on myInterview ',
  'h:X-Mailgun-Variables': dataPrms
};

// Function that create a new job in the DB
(async function () {
  const dataPrms = ISendMailPayload | ITwilioSMSPayload;
  await agenda.start();
  // add schedule to init job with data
  await agenda.schedule(0 + 'days', 'NAME OF JOB', dataPrms);
})();

You can initialize the job from any project and the handler will execute the job.

How do I get set up?

mongo app connection

mongodb+srv://dbdev:@myinterview-dev.jmzgt.mongodb.net/myinterview-dev?retryWrites=true&w=majority

via terminal

mongo "mongodb+srv://myinterview-dev.jmzgt.mongodb.net/myinterview-dev" --username dbdev

  • Summary of set up
  • Configuration
  • Dependencies
  • Database configuration
  • How to run tests
  • Deployment instructions

Contribution guidelines

  • Writing tests
  • Code review
  • Other guidelines

Who do I talk to?

  • Repo owner or admin
  • Other community or team contact

FAQs

Package last updated on 26 Dec 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc