Route Requests with Meteorite
To receive email, you can use SendGrid’s inbound Parse Webhook. This will POST new emails to any URL you specify. Since we want to receive email with Meteor, we need to add a Meteor route.
Once you have Meteor installed, you want to set up Meteorite to handle packages. Then you can add the router functionality:
mrt add router
In this case I’m looking at the subject of the email and using that value to update the database.
To make this work in your application, log in to your SendGrid account and point the Parse Webhook to /inbound on your Meteor app. You can test webhooks locally with ngrok, or put it up on your own server.
See This Example Live
To showcase the real-time aspect of Meteor, I made an application that lets you change the background color of the page.
» Go to hook.meteor.com
Send an email to email@example.com and in the subject put the color you want.
You can access the source code for the sample app in GitHub.