- Setup Sender Authentication with Twilio SendGrid.
- Setup Inbound Parse
- Add MX record to DNS –
parse.yourdomain.com
-->mx.sendgrid.net
- Add webhook to SendGrid inbound parse UI per doc above. host in this case ==
parse.yourdomain.com
. Webhook url would be something likehttps://yourdomain.com/parse-sendgrid.js
- Add MX record to DNS –
- Buy a number on the Twilio phone numbers page
- Clone this repo
- Rename
example.config.js
toconfig.js
- Add your account sid & auth token to
config.js
. These are in your Twilio Console. yarn
ornpm install
- Install Now CLI if you don't have it installed.
- Optionally alias a domain or subdomain to now. Every deployment to Now, generates a new domain so aliasing a domain provides a static domain and thus a static URL for your SendGrid webhook to post to.
now
{
"version": 2,
"name": "sendgrid-now-lambda",
"alias": "yourdomain.com", // Optionally alias a domain - otherwise remove.
"builds": [
{ "src": "parse-sendgrid.js", "use": "@now/node" }, // lambda endpoint. The code that runs when a email is parsed by SendGrid.
{ "src": "index.html", "use": "@now/static" } // simply serve the static html file. For demonstration only. Does nothing.
]
}