How to Get SMS Alerts for Gmail via Twitter
How do you get SMS notifications on your mobile phone for important emails in your Gmail? Google doesn’t support text notifications for their email service but Twitter does. If we can figure out a way to connect our Twitter and Gmail accounts, the Gmail notifications can arrive as text on our mobile via Twitter. Let me explain:
Twitter allows you to follow any @user via a simple SMS. They provide short codes for all countries (see list) and if you text FOLLOW to this shortcode following by the username, any tweets from that user will arrive in your phone as text notifications. For instance, if you are in the US, you can tweet FOLLOW labnol to 40404 to get my tweets as text messages. Similarly, users in India can text FOLLOW labnol to 9248948837 to get the tweets via SMS.
The short code service of Twitter can act as a Gmail SMS notifier. You create a new Twitter account, set the privacy to private and this account will send a tweet when you get a new email in Gmail. Follow this account via SMS from you main Twitter account and the SMS notifications will start pouring in.
Here’s a step by step guide on how you can use Twitter to get SMS notification for important email in your Gmail account. It will take a minute to setup and, internally, there’s a Google Apps Script that’s doing all the magic. It monitors your Gmail mailbox in the background and as soon as a new message arrives in your account, the script sends out a tweet.
- Log out of your existing Twitter account and then go to twitter.com/signup to create a new Twitter account for your Gmail account.
- Confirm your email address, then open the Twitter settings page and check the option “Protect My Tweets.” This will make your Gmail notifications private and neither search engines nor other Twitter users will be able to see tweets generated through Gmail.
- Click here to copy the Google Sheet and choose Authorize under the Gmail to Twitter menu (near Help). Remember to authorize with your new Twitter account.
- Once authorized, choose Start from the Gmail to Twitter menu and enter your Gmail search query. For instance you can say _is:important is:unread in:inbox newer_than:1d _to only receive notification for new, unread and important emails in your Gmail. Click OK.
That’s it. The Gmail notifier is running and it will tweet when a matching email is found. It runs every 10-15 minutes and will only work on incoming email, not the old message. The messages will also be logged in the Google Sheet so you know what’s happening behind the scene.
Open a new browser session in Incognito mode, log in to your old Twitter account and send a follow request to your new Gmail account on Twitter. Approve the new follower request and you should now see tweets for new Gmail messages, as they arrive, in your main Twitter timeline.
Should you wish to receive SMS alerts on your mobile phone for new Gmail messages, just open the Twitter profile page of your Gmail bot and turn on Mobile Notifications. This will obviously work only if you have connected (and verified) your mobile phone with your main Twitter account.
Also see: How to Write a Twitter Bot
Google Developer Expert, Google Cloud Champion
Amit Agarwal is a Google Developer Expert in Google Workspace and Google Apps Script. He holds an engineering degree in Computer Science (I.I.T.) and is the first professional blogger in India.