How to Send Out of Office Replies in Twitter
Twitter, for many, has become a preferred medium of communication. Your email messages may never get read or, in the worst case, may get caught in the Spam folder but tweets and @mentions are very likely to get noticed.
When you are travelling or going on a vacation, with limited access to the Internet, you often create an “out of office” reply in your email program to let people know that you won’t be able to respond to them right away. How about doing something similar for people who are trying to reach you through Twitter?
Unlike your email program, Twitter offers no easy way for you to setup out of office auto-replies but we can easily and quickly add such a feature to our Twitter account(s) with the help of a simple Google Script.
You specify the start date and the end date when the auto-responder should be active and any tweets sent to you during this period will automatically get a reply from your Twitter account saying you are out of office (the auto-reply text can be configured). The replies are sent only once so if a person sends you two or more tweets during your vacation period, they will get only one out-of-office auto-reply.
- Go to apps.twitter.com and sign-in with your existing Twitter account. Create a new Twitter app (screenshot), add a description, website (any URL) and put https://spreadsheets.google.com/macros/ in the callback URL field.
- Once the Twitter app has been created, click the Permissions tab and set Read and Write as the Application Type. Click Update Settings to save your changes.
- Switch to the API Keys tab and make note of the Consumer API Key and API Secret.
- Click here to make a copy of the auto-responder script into your Google Drive.
- Enter the start and end dates of your vacation, the Twitter API keys (from the previous step), and your Twitter handle.
- Go to Run -> Start to initialize the auto-responder. Say Yes if the script requires you to authorize access to certain Google Script services.
- Choose Run -> Start again and authorize the script to post tweets from your Twitter account.
The script will invoke itself on the specified start date and will respond to all incoming tweets until the end date. It will then stop itself automatically. As always, you are free to use, modify and distribute the source code with attribution.
When you are taking another vacation, just open the auto-responder script already present in your Google Drive, change the Start and End dates and choose Start from the Run menu to initialize the autoresponder again.
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.