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(providers): add mailtrap #4328

Merged
merged 3 commits into from
Oct 5, 2023
Merged

feat(providers): add mailtrap #4328

merged 3 commits into from
Oct 5, 2023

Conversation

michaldziuba03
Copy link
Contributor

What change does this PR introduce?

This PR introduces new provider for email channel - Mailtrap.

They offer two services:

  • email testing
  • email sending (for production emails)

This PR creates provider for their Email Sending service.

API reference: https://api-docs.mailtrap.io/docs/mailtrap-api-docs/67f1d70aeb62c-send-email
Mailtrap SDK: https://github.com/railsware/mailtrap-nodejs

Why was this change needed?

Closes #4325

Other information (Screenshots)

Workflow with provider

Workflow

Integration store with IS_MULTI_PROVIDER_CONFIGURATION_ENABLED=true

integration-store1

Integration store default view

integration-store2

Email sent with attachement

email-screenshot

preset: 'ts-jest',
testEnvironment: 'node',
moduleNameMapper: {
axios: 'axios/dist/node/axios.cjs',
Copy link
Contributor Author

@michaldziuba03 michaldziuba03 Oct 2, 2023

Choose a reason for hiding this comment

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

without that option Jest has problem with importing axios inside Mailtrap SDK.

Any suggestions? Maybe I will use axios and their API directly?

Copy link
Member

Choose a reason for hiding this comment

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

It's fine, we do use this similar approach in multiple providers

@@ -0,0 +1,82 @@
{
"name": "@novu/mailtrap",
"version": "0.20.0-alpha.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

provider template generator is "outdated", so I changed to that version manually.

Copy link
Member

Choose a reason for hiding this comment

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

Will look into this, if we can automate the version updation inside the generator


return {
id: response.message_ids[0],
date: new Date().toISOString(),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

mailtrap doesn't return own timestamp

@scopsy
Copy link
Contributor

scopsy commented Oct 3, 2023

That's a fantastic idea @michaldziuba03! I will let the rest of the team to review this, but amazing work

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.

Nice work 🌟
I would appreciate it if you could also add docs for it here 😇

preset: 'ts-jest',
testEnvironment: 'node',
moduleNameMapper: {
axios: 'axios/dist/node/axios.cjs',
Copy link
Member

Choose a reason for hiding this comment

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

It's fine, we do use this similar approach in multiple providers

@@ -0,0 +1,82 @@
{
"name": "@novu/mailtrap",
"version": "0.20.0-alpha.0",
Copy link
Member

Choose a reason for hiding this comment

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

Will look into this, if we can automate the version updation inside the generator

@michaldziuba03
Copy link
Contributor Author

@BiswaViraj PR for docs is ready novuhq/docs#157

@BiswaViraj
Copy link
Member

@michaldziuba03 Amazing, Can you please fix the conflicts So that I can merge?

@michaldziuba03
Copy link
Contributor Author

michaldziuba03 commented Oct 4, 2023

@BiswaViraj I fixed conflicts, I hope that no git conflicts arise in the meantime :)

@BiswaViraj BiswaViraj merged commit 8d2715f into novuhq:next Oct 5, 2023
25 of 27 checks passed
@michaldziuba03 michaldziuba03 deleted the add-mailtrap-provider branch October 5, 2023 06:18
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 Mailtrap provider
4 participants