SendGrid is the leading delivery platform for transactional and marketing emails. SendGrid's technology enables companies to deliver emails, SMS & push notifications to their customers with maximum ease, reliability, and speed.
MongoDB Realm is a development platform designed for modern, data-driven applications. You can use Realm to build mobile, web, desktop, and IoT.
MongoDB Realm IntegrationsMongoDB Realm + SendGrid
Send Email in SendGrid when New User is created in MongoDB Realm Read More...MongoDB Realm + SendGrid
Send Email in SendGrid when New Service is created in MongoDB Realm Read More...MongoDB Realm + SendGrid
Send Email in SendGrid when New Push notification is created in MongoDB Realm Read More...It's easy to connect SendGrid + MongoDB Realm without coding knowledge. Start creating your own business flow.
Triggers when a new push notification is created
Triggers when a new service is created
Triggers when a new user is created
Creates or updates a contact.
Sends an Email.
Confirm a pending user
Create a service
Creates a Trigger
Creates a User
Delete a pus notification
Delete a trigger
Delete a User
Disable a User
Enable a User
Update a trigger
(30 seconds)
(10 seconds)
(30 seconds)
(10 seconds)
(2 minutes)
Introduction:
MongoDB is one of the most popular NoSQL database used for web applications. It is fast and flexible, and provides a great document-oriented interface. MongoDB has been popular with the Node.js community for building realtime applications since it uses JSON documents. Due to this fact, it was easy for SendGrid to integrate MongoDB Realm in their application.
SendGrid is an email service provider that provides a robust API and supports both REST and SMTP. It was designed by developers from the start, so they are very familiar with integrating third party services into their platform. They have also made it very easy for people to test their API without needing an account.
This article will talk about the integration of SendGrid into MongoDB Realm. It will describe how it works and what benefits it gives to customers.
Integration of SendGrid and MongoDB Realm:
In order to use the SendGrid service, you need to create an account on www.sendgrid.com using your desired username, password, and email address. Then you must use the credentials to log into the SendGrid dashboard at www.sendgrid.com/dashboard. From there you can set up your API keys which you will need to make API calls. On the dashboard they also provide a link to download the latest version of the SendGrid package file. This file contains all the libraries and dependencies to run SendGrid. When you have downloaded this file, you simply run npm install on the command line in order to install all dependencies listed in the package file. The final step is to create a new Javascript file called sendgrid_converter.js in the root of your project fpder and add the fplowing code:
// Import needed libraries
import * as sendGrid from ‘sendgrid’;
import * as fs from ‘fs’;
// Set key and secret variables found on the SendGrid Dashboard in the “API Keys” section
const key = ‘api-key-here’;
const secret = ‘api-secret-here’;
// Set the path where your .env file is located (where you can store variables)
const env = process.env.NODE_ENV === ‘staging’ ? ‘config/staging.env’ . ‘config/production.env’;
// Define the SMTP host you would like to use for sending emails
const smtpHost = env === ‘production’ ? ‘mail-smtp-in.us-east-1.amazonaws.com’ . ‘mail-smtp-in.us-west-2.amazonaws.com’;
// Create a new instance of SendGrid using our variables we declared above
const sendgrid = new sendGrid({ key. key, secret. secret, smtpHost. smtpHost });
// Create a new message that we will send to our recipient using the To, Subject, Message body values that we want to pass along with our message // In this case we will not be passing any variables because we will be doing that in our code later // The data object is automatically assigned by SendGrid when creating a new message var msg = { data. { to. ‘[email protected]’, subject. ‘Hello World!’, msg. ‘Hello World! This is a test email from me!’ } }; // Body field options var bodyOptions = { plainText. { charset. ‘utf-8’ }}; // Create a new message sender object and include our message using the SendGrid object we created above var sender = sendgrid(msg); // Get the raw body content from our file var body = fs.readFileSync(‘./bodyfile.txt’); // Convert our body into a string using our bodyOptions object and append it to our message body sendgrid(sender.messages(.create(bodyOptions, body.then((message. => { conspe.log(message); }); // Commit our changes to our dev environment with npm run commit in order to deploy live changes if needed commit(); function commit(){ if(NODE_ENV === ‘production’){ return } NODE_ENV=”production” git add -A . git commit -m “[committer] [changes] [commit hash] - [commit message]” git push origin master }
The process to integrate SendGrid and MongoDB Realm may seem complicated and intimidating. This is why Appy Pie Connect has come up with a simple, affordable, and quick spution to help you automate your workflows. Click on the button below to begin.