Introduction
Communication Service is a microservice built using Node.js, Express.js, and MongoDB, designed to handle the communication needs of Legitify, a platform offering various modules like the Contract Management Tool, Notice Management Tool, Litigation, and Intellectual Property Rights (IPR). This service facilitates the sending of emails and SMS messages across different modules within the Legitify platform.
Features
Email Sending
Utilises AWS SES (Simple Email Service) for sending emails.
Offers SMTP integration for clients, allowing them to configure their SMTP credentials for sending emails through Communication Service.
Supports HTML templates for email content.
SMS Sending
Integrates with Kaleyra, a third-party service, for sending SMS messages.
Provides flexibility in defining SMS templates.
Template Management
Communication Service includes a comprehensive template management system to streamline the process of composing and sending emails. Templates are organised into different categories corresponding to various modules within the Legitify platform. The templates are stored in specific directories within the project structure for easy access and management:
Authentication Templates (authTemplates)
Stored under the
./emailTemplate/authTemplatesdirectory.
Contracts Templates (contractsTemplates)
Stored under the
../emailTemplate/contractTemplatesdirectory.
IPR (Intellectual Property Rights) Templates (iprTemplates)
Stored under the
../emailTemplate/iprTemplatesdirectory.
Notice Templates (noticeTemplates)
Stored under the
../emailTemplate/noticeTemplatesdirectory.
Arbitration Templates (arbitrationTemplates)
Stored under the
../emailTemplate/arbitrationTemplatesdirectory.
LMT (Litigation Management Tool) Templates (lmtTemplates)
Stored under the
../emailTemplate/lmtTemplatesdirectory.
By categorising templates based on their respective modules, Communication Service ensures efficient organisation and retrieval of templates according to the specific communication requirements of each module. This structure facilitates easy maintenance and customisation of templates, allowing for seamless communication across different functionalities within the Legitify platform.
Status Tracking
Logs the status of each email sent, including delivery success or failure, through a status tracking mechanism.
Model Schemas
Email Model:
projectName: Name of the project associated with the email.senderId: ID of the user sending the email.fromEmail: Sender's email address.toRecipients: Array of recipient email addresses.ccRecipients: Array of CC recipient email addresses.content: Content of the email.attachments: Array of file attachments.templateName: Name of the HTML template used for the email.
SMS Model:
projectName: Name of the project associated with the SMS.senderId: ID of the user sending the SMS.toMobile: Recipient's mobile number.content: Content of the SMS.templateId: ID of the SMS template.smsSenderId: Sender ID for SMS.templateName: Name of the SMS template.
Status Log Schema:
eventType: Type of event (e.g., email sent, SMS sent).response: Response object containing details of the communication status.projectName: Name of the project associated with the communication.templateName: Name of the template used.parentId: ID of the parent entity associated with the communication.parentType: Type of the parent entity (e.g., cron job, email).additionalInformation: Additional information related to the communication event.
Architecture
Built using Node.js and Express.js for the backend server.
Utilises MongoDB as the database for storing communication-related data.
Implements a modular architecture to facilitate scalability and maintainability.
Integrates with AWS SES for email sending and Kaleyra for SMS sending.
SMTP Integration
In addition to utilising AWS SES for email sending, Communication Service offers SMTP integration, allowing clients to configure their SMTP credentials for sending emails through the service. Below are the details required from clients for SMTP integration:
FROM_EMAIL: The email address to be used as the sender's address. For example,
[email protected].EMAIL_HOST: The SMTP server hostname or address. For example,
smtp.xxxxx.com.PORT: The port number used for SMTP communication. Typically, this is
587for TLS encryption or465for SSL encryption.HOST_USER: The username or email address associated with the SMTP account. For example,
[email protected].HOST_PASSWORD: The password associated with the SMTP account. This information is sensitive and should be handled securely.
By providing these details, clients can seamlessly integrate their SMTP credentials with Communication Service, enabling the service to send emails on their behalf using the specified SMTP server. This integration offers flexibility and customisation options for clients who prefer to use their own SMTP infrastructure for email communication within the Legitify platform.
Microsoft SMTP Basic Authentication Retirement
SMTP is not going away — only the login method is changing. If your organisation uses Microsoft 365 for email, please review the following carefully.
What is being discontinued
Microsoft is retiring Basic Authentication (username and password) for the smtp.office365.com endpoint. Any application or device currently using this method to send mail will stop working once the retirement takes effect.
What is required instead
Modern Authentication (OAuth 2.0) must be used in place of Basic Authentication. Rather than passing credentials directly, your application must obtain and use a secure token to send mail through the Microsoft SMTP endpoint.
Required configuration details
To set up Modern Authentication for Microsoft SMTP, the following details must be provided to the Legistify team:
FROM_EMAIL: The email address that will be used to send mail.
MICROSOFT_MFA_TENANT_ID: Your Microsoft Entra (Azure AD) tenant ID.
MICROSOFT_MFA_CLIENT_ID: The client ID of your registered application in Microsoft Entra.
MICROSOFT_MFA_CLIENT_SECRET: The client secret generated for your registered application.
📎 Attachment: Microsoft Graph Email Setup Guide
Conclusion
Communication Service serves as a crucial component within the Legitify platform, enabling seamless communication between different modules and users. With features like email and SMS sending, template management, and status tracking, it provides a robust solution for managing communication needs effectively.
