Twilio SMS to email forwarding using Sendgrid for MFA
Set up Shared Mailbox
Create a shared mailbox i.e. sms@domain.com and add delegates to this mailbox
Set up SendGrid API (or equivalent)
https://app.sendgrid.com/settings/api_keys
Create a new Function
If you are using sub-accounts be sure you are in the right one https://www.twilio.com/console/functions/manage
Function Name: Forward SMS to SendGrid email
Path: /sms-to-email
Code:
|
|
Configure the Function
https://www.twilio.com/console/functions/configure
Key | Value |
---|---|
FROM_EMAIL_ADDRESS | sms@domain.com |
TO_EMAIL_ADDRESS | sms@domain.com |
SENDGRID_API_KEY | ********** |
Add ‘got’ version 8.3.1 in Dependencies
Set up number
https://www.twilio.com/console/phone-numbers Messaging → A Message comes in → Function → Forward SMS to SendGrid Email
Testing / Troubleshooting
Send a text to your number and ensure it is working. You can trace the message using the Twilio and Sendgrid logs:
Twilio Logs → Message Log