Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat eazy sms #5393

Merged
merged 9 commits into from
Apr 22, 2024
Merged

Feat eazy sms #5393

merged 9 commits into from
Apr 22, 2024

Conversation

sr-26
Copy link
Contributor

@sr-26 sr-26 commented Apr 10, 2024

What change does this PR introduce?

Closes #5195

Why was this change needed?

New Sms Provider.

Other information (Screenshots)

image
image

Copy link

netlify bot commented Apr 10, 2024

👷 Deploy request for dev-web-novu pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 6b1003a

Copy link

netlify bot commented Apr 10, 2024

Deploy Preview for novu-design ready!

Name Link
🔨 Latest commit 6b1003a
🔍 Latest deploy log https://app.netlify.com/sites/novu-design/deploys/6626983b6098980008b6dc9c
😎 Deploy Preview https://deploy-preview-5393--novu-design.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@ainouzgali ainouzgali requested review from a team, rifont and antonjoel82 and removed request for a team April 11, 2024 09:04
@ainouzgali
Copy link
Contributor

@coderabbitai review

Copy link
Contributor

coderabbitai bot commented Apr 11, 2024

Walkthrough

This update introduces the EazySMS provider to the Novu system for SMS notifications. It includes backend schema updates, new DTOs, provider configurations, and handler implementations. The integration ensures that Novu can utilize EazySMS to send SMS messages, aligning with community requests for more diverse SMS provider options.

Changes

File Path Change Summary
.../dtos/credentials.dto.ts Added channelId to CredentialsDto
.../integration/integration.schema.ts Added channelId to integrationSchema
.../channels/sms.ts, .../provider-credentials.ts Added EazySMS configuration details
.../provider.enum.ts, .../credential.interface.ts Updated enums and interfaces for new SMS provider
.../package.json, .../eazy-sms.handler.ts Added dependency and handler for EazySMS
.../sms.factory.ts, .../index.ts Integrated EazySMS handler into SMS factory
providers/eazy-sms/... Introduced EazySMS provider library and configurations

Assessment against linked issues

Objective Addressed Explanation
Add a new provider for SMS called 'Eazy' (#5195)
Novu supporting Eazy for SMS notifications (#5195)

Possibly related issues


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

providers/eazy-sms/README.md Outdated Show resolved Hide resolved
Comment on lines +1 to +31
import { EazySmsProvider } from './eazy-sms.provider';

const mockConfig = {
apiKey: 'test-key',
channelId: '[email protected]',
};

const mockSMSMessage = {
to: '1234567890',
content: 'sms content',
};

test('should trigger eazy-sms library correctly', async () => {
const smsProvider = new EazySmsProvider(mockConfig);
const spy = jest
.spyOn(smsProvider, 'sendMessage')
.mockImplementation(async () => {
return {
id: '2574a339-86ff',
date: new Date().toISOString(),
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} as any;
});

await smsProvider.sendMessage(mockSMSMessage);
expect(spy).toHaveBeenCalled();
expect(spy).toHaveBeenCalledWith({
content: 'sms content',
to: '1234567890',
});
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test for the EazySmsProvider is well-structured and covers the basic functionality of the sendMessage method. The use of Jest for spying and mocking the method ensures that the test is isolated and reliable. However, consider adding more test cases to cover error handling and edge cases to ensure robustness.

Would you like me to help in writing additional test cases for error scenarios and edge cases?

packages/application-generic/package.json Outdated Show resolved Hide resolved
sr-26 and others added 2 commits April 11, 2024 19:36
fix: readability

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Member

@BiswaViraj BiswaViraj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add the provider to this file

@sr-26 sr-26 requested a review from BiswaViraj April 16, 2024 15:20
@sr-26
Copy link
Contributor Author

sr-26 commented Apr 16, 2024

Please add the provider to this file

Added @BiswaViraj.

Copy link
Member

@BiswaViraj BiswaViraj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sr-26 Can you please fix the pipeline errors?
You'll need to add the failing words in the .cspell file
and also need to regenerate the pnpm.lock file by running pnpm i

@sr-26
Copy link
Contributor Author

sr-26 commented Apr 22, 2024

Added @BiswaViraj, the package.lock has significant version changes. Is this okay?

@BiswaViraj
Copy link
Member

Added @BiswaViraj, the package.lock has significant version changes. Is this okay?

Yes, it is fine

@BiswaViraj BiswaViraj merged commit 26f5bfb into novuhq:next Apr 22, 2024
30 of 33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🚀 Feature: Add a new provider for sms (Eazy)
3 participants