Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
list_ids: [EmailService.LIST_IDS.MENTORS],
contacts: [
{
email: contact.email,
first_name: contact.name,
country: contact.country,
custom_fields: {
// We can clean our list in SG with this field
e2_T: isProduction ? 'production' : 'development',
},
},
],
}),
};
return await sgClient.request(request);
}
}
async sendDev(args: MailArgs) {
const request = {
method: "GET",
url: `/v3/templates/${args.templateId}`,
}
const [template] = await sendgridClient.request(request)
const version = template.body.versions[template.body.versions.length - 1]
const html = this.interpolateVariables(args.variables, version.html_content)
const subject = version.subject
const text = this.interpolateVariables(
args.variables,
version.plain_content,
)
this.devMail.sendMail({
to: args.to,
from: this.from,
subject,
html,
text,
})
}
sendgrid.addSubscription = async (
email: string
): Promise<[ClientResponse, any]> => {
request.body = [{ email }];
return client.request(request);
};