#Info Code is Hidden. If you need to access. feel free to contact me / DM me on LinkdIn
A simple function that listens for incoming POST requests containing email data, then sends a corresponding SMS message using Twilio.
- Maps sender email addresses to phone numbers for specific recipients.
- Uses Twilio API to send SMS messages.
- Returns relevant HTTP responses based on the action taken.
- A Twilio account with valid
TWILIO_ACCOUNT_SID
andTWILIO_AUTH_TOKEN
. - The phone number associated with your Twilio account (in this example,
+61412345678
).
This is currectly working on the server side. I'm working on specified email events (like delivery), SendGrid triggers its Webhook Event and sends an HTTP POST request to the private server endpoint.
- Deploy this function to your preferred server platform.
- Send a POST request to the function's endpoint with the following JSON structure:
{
"sender": "support@yourdomain.com",
"body": "Your email body content here"
}
- User with an approved email sends an email via SendGrid.
- SendGrid processes the email.
- On specified email events (like delivery), SendGrid triggers its Webhook Event and sends an HTTP POST request to the our server endpoint.
- Server checks the sender's email against a predefined mapping of email-to-mobile numbers.
- If the sender is approved, an API call to Twilio with the associated mobile number.
- Twilio processes the API request and sends an SMS to the mapped mobile number.
- Test SMS received by the associated recipient.