notify check for new case ref tempate and pref lang
This commit is contained in:
@@ -25,11 +25,25 @@
|
||||
* description: Failed
|
||||
*/
|
||||
|
||||
import { consoleLogger } from "../../../actions";
|
||||
import { consoleLogger, getPreferredLanguage } from "../../../actions";
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
var data = req.body;
|
||||
|
||||
if (data?.reference === "PEDW-NEW-CASEREF") {
|
||||
try {
|
||||
const prefLang = await getPreferredLanguage(data.emailAddress);
|
||||
const preferredLanguage =
|
||||
prefLang?.value?.[0]?.pinswg_preferredlanguage;
|
||||
|
||||
if (preferredLanguage === 846040000) {
|
||||
data.templateId = "d2d9d0dc-e5d4-4da5-9156-775521d69c5c";
|
||||
}
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
}
|
||||
}
|
||||
|
||||
var NotifyClient = require("notifications-node-client").NotifyClient;
|
||||
|
||||
const notifyClient = new NotifyClient(process.env.NOTIFY_API_KEY);
|
||||
@@ -40,7 +54,7 @@ export default async function ApiProxy(req, res) {
|
||||
notifyClient
|
||||
.sendEmail(data.templateId, data.emailAddress, {
|
||||
personalisation: data.personalisation,
|
||||
reference: data.reference,
|
||||
reference: data.reference
|
||||
// emailReplyToId: emailReplyToId,
|
||||
})
|
||||
.then((response) => {
|
||||
|
||||
Reference in New Issue
Block a user