Our great sponsors
-
// src/api/admin-users/email-alert-users.ts // Connect to the Auth0 management API const auth0 = new ManagementClient({ domain: `${process.env.GATSBY_AUTH0_DOMAIN}`, clientId: `${process.env.AUTH0_BACKEND_CLIENT_ID}`, clientSecret: `${process.env.AUTH0_BACKEND_CLIENT_SECRET}`, scope: 'read:users', }); try { const users = await auth0.getUsers(); // Filter out only those users that have subscribed to email alerts // This is defined in the user_metadata field on Auth0 const userEmails = users .filter((user) => { return ( user && user.user_metadata && user.user_metadata.subscribeToEmails === true ); }) .map((user) => user.email); // using Twilio SendGrid's v3 Node.js Library // https://github.com/sendgrid/sendgrid-nodejs sgMail.setApiKey(process.env.SENDGRID_API_KEY); const msg = { to: userEmails, from: 'Boligsameiet Gartnerihagen ', templateId: 'd-123456789', // The ID of the dynamic Sendgrid template dynamic_template_data: { articleURL, articleTitle, articleExcerpt, }, }; await sgMail.sendMultiple(msg); // ...code continues
-
gartnerihagen
Webside for Boligsameiet Gartnerihagen. Basert på Gatsby m/Chakra UI, Contentful, Netlify og Auth0.
The source code for this project is on my Github. If you're just interested in the email alert Gatsby Function, you'll find it here.
-
SurveyJS
Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
-
What I have made could easily be adapted to other needs or purposes. If you're not using Gatsby, you don't need to make any big changes to make it work with Netlify Functions or Next.js API routes. The code is pretty similar to how you would create this using the Node.js Express framework.