-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(notification): Send notification to users
- write unit test - send email notification to users - create database on firebase - set up firebase configuration - populate database with user notifications [Delivers #159206059]
- Loading branch information
Showing
24 changed files
with
367 additions
and
350 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import sendgrid from '@sendgrid/mail'; | ||
|
||
import mailtemplate from './articleTemplate'; | ||
|
||
/** | ||
* get an article using slug as query parameter | ||
* @param {array} emails - array of receivers' email | ||
* @param {string} name - name of author | ||
* @param {string} slug - unique slug of posted article | ||
* @param {string} callback - return value after sending mail | ||
* @returns {error} - error if email is not sent | ||
*/ | ||
export default (emails, name, slug, callback) => { | ||
setTimeout(() => { | ||
const templateLink = `${process.env.URL_HOST}/${slug}`; | ||
|
||
sendgrid.setApiKey(process.env.SENDGRID_API_KEY); | ||
const msg = { | ||
to: emails, | ||
from: '"Authors haven" <noreply@authorhaven.sims.com>', | ||
subject: 'See what you are missing out on!', | ||
text: 'this is text', | ||
html: mailtemplate.emailTemplate(templateLink, name), | ||
asm: { | ||
groupId: 7240 | ||
}, | ||
}; | ||
sendgrid | ||
.sendMultiple(msg); | ||
callback('Mail address not found'); | ||
}, 1000); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.