Thursday, November 27, 2014

Google Apps Script - Send SMS when receiving an email in GMail

So, you don't have Internet access but still want to be notified whenever someone special email you (GMail)? Here you go: Google Apps Script FTW.

1. In GMail, create a label name "Send SMS", then create a filter to apply that label to whichever messages you want. For example, every message coming from the email address will be applied the "Send SMS" label.

2. Go to Google Apps Script, create a blank project, paste this script into the script editor:

  • Every time the Gms_send_sms runs, it will get all email messages which have "Send SMS" label.
  • Create an event in the Google Calendar for each message.
  • Create an SMS notification for each of those events.
  • Remove the label of those messages

3. In the script editor, select Resources menu >> Current project's triggers >> create a trigger to run the Gms_send_sms function every 5 minutes. You will need to grant permissions for the script to access your gmail and calendar apps.