Showing posts with label Twitter. Show all posts
Showing posts with label Twitter. Show all posts

Wednesday, 16 August 2017

How to Delete All Location Information from Your Previous Tweets

How to Delete All Location Information from Your Previous Tweets

Where you live is a pretty private location. Worryingly, it’s all too easy to leak it on social media without really meaning to. For example, it’s possible to share your exact location in a Tweet.

If you’re worried you’ve shared a private location some time in your last few thousand Tweets, there’s an easy way to alleviate your fears: remove location data from everything you’ve ever Tweeted. Here’s how to do it.

This only works on Twitter for the web, so start by heading to Twitter.com in your browser. Click on your profile icon, and then select Settings and Privacy.

Next, go to Privacy and Safety.

Under Privacy, select Delete Location Information.

How to Delete All Location Information from Your Previous Tweets

You’ll be asked to confirm that you want to remove location data from all your past Tweets. Click OK and it’s done. It might take up to 30 minutes for you to see the results.

Saturday, 22 July 2017

Make aPhoto Mosaic Online from your Friends Pictures



Would you like to create a mosaic style picture of your own self without doing any of the hard work? Then give Mosaically a try.

Mosaically will fetch profiles pictures of all your friends on Twitter and Facebook and turns them into one large mosaic that resembles one of your own pictures.

Mosaically, by default, will pick your default profile picture from your social networks but you may even upload a new one from your computer.

Wednesday, 19 July 2017

Send Direct Messages to Multiple Twitter Users

Direct Messages, or DMs, in Twitter are like private tweets that are visible only to the sender and the recipients. When you send a Twitter DM to another user, the tweet shows up in his Twitter Inbox while a copy of that message gets saved to your Sent Items just like email.

Twitter lets you send direct messages to any other Twitter user provided he or she is following you. The other limitation is that, unlike email, you can only send one direct message at a time.

There are situation when you want to send private DMs to multiple people on Twitter. For instance, it’s your birthday and couple of people have sent you birthday greetings through public tweets. Now you can either thank them all with public tweets (@replies) or you can send them private DMs containing the same note.

Neither Twitter’s web interface nor their desktop and mobile clients support multiple DMs but you can use an online app called TweetGuru to message multiple Twitter users with one go.


Embed Social Sharing Buttons in your SlideShare Presentations

SlideShare is a perfect place for uploading your PowerPoint presentations because it has all the eyeballs but here’s one little known secret – if you can add just one extra slide to your deck, it can possibly help drive even more traffic to your presentations.



HOW TO ADD SOCIAL SHARING BUTTONS IN POWERPOINT

If you want to give this a try, here’s a quick step-by-step guide on how you can easily add social sharing buttons to your PowerPoint Presentations.

1. Add the Twitter and Facebook logo to a new slide of your PowerPoint presentation.

2. Under Drawing, choose the Rectangle tool and draw it around one of the social buttons such that the rectangular shape completely covers the button.

3. While the shape is selected, set the Shape Fill and the Shape Outline options to None.

4. The rectangle is almost invisible now. Press Ctrl + K to turn that shape into a hyperlink. You may use the following values for the hyperlink field:

http://twitter.com/share?url=http://example.com&text=My+Presentation
http://www.facebook.com/sharer/sharer.php?u=http://example.com

Replace example.com with your own URL, save and upload it to SlideShare. 

How to Use Twitter During Office Hours

Some organizations have this policy that social media sites like Twitter, Facebook, etc. are a waste of time and therefore ban their staff from using such sites during office hours.

Then you also have companies that have no such rules in place and allow unrestricted access to the web as long as the employees are able to deliver what’s expected.


A. WHEN TWITTER IS NOT ALLOWED IN OFFICE

If you are working for a company that falls in the first category (no social media please), its better that you install a Twitter mobile app on your cell phone and not use the office computer at all for tweeting. After all, your boss will get a web usage report at the month-end and he will easily figure out which sites have you been visiting secretly during office hours.

If you don’t have a data-plan on your phone and cannot resist that urge to tweet ever 10 minutes, you may use tools like Posterous or Nutshell that allow anyone to send and receive tweets through regular office email.

There’s another option that will come handy if the twitter.com website itself has been blocked by your office firewall. You can use Twitter indirectly through third-party sites like Brizzly or Dabr.

These sites offer a fresh interface to your Twitter account with all the regular features (retweets, @replies, etc.) but the more interesting part is that they will work even if Twitter domain is inaccessible from your office computer. You can track up to 5 accounts with Brizzly.

Your Twitter friends’ timeline feed is protected by a password but you may still subscribe to it with a simple hack involving FeedBurner.

You can then follow tweets from your friends using Outlook or any other newsreader. Alternatively, you can subscribe to the friend’s feed directly with FeedDemon provided that access to Twitter is open in your office.

If you are allowed to use IM clients in Office, you can add twitter@twitter.com as a buddy in Google Talk and send tweets through IM. TweetSwitch is another free service that lets you send and receive tweets through popular instant messaging clients including AIM, Windows Live Messenger, Yahoo! Messenger, Skype and GTalk.

B. USE TWITTER WITHOUT LETTING ANYONE KNOW

Now let’s look at the second category – you are very much allowed to use Twitter at work but you still don’t want to give your boss an impression that you are a Twitter addict.

In that case, here’s what you can do to possibly hide your Twitter addiction from boss and colleagues.

You can probably find a gazillion desktop apps for Twitter but if you are looking for something that doesn’t scream to the world that its a Twitter client, try Quitter.

Quitter is a simple twitter client that runs through the command prompt or the DOS window. With Quitter, you can read and reply to tweets, follow /unfollow people or even manage your direct messages. All you need is a Windows computer and no one in the office will ever have a clue that you are engrossed in Twitter.

If you are a Microsoft Office user, Spreadtweet is another interesting option for you. This is a proper Twitter client but in the guise of a spreadsheet so your boss will think that you’re working on an Excel sheet while you are up there tweeting your heart out!

With SpreadTweet, you can send and receive updates, @replies and direct messages all inside an application that looks like a clone of Excel 2007.

The other great option for Microsoft Office users in TwInbox – you probably have Outlook open on your screen all the time and this free Outlook add-in will simply turn your Outlook into a powerful Twitter client.

You can handle tweets just the way you manage your Inbox and the add-in will even let you tweet email messages with a click. The service is integrated with TwitPic so you can tweet pictures by simply dragging them into Outlook.

There’s more – all standard Outlook features like search, mail archiving, categories, etc. will also become available to your Tweets.

Monday, 12 June 2017

Know the Sleeping Time of anyone on Twitter

Sleeping Time, if you are new, is a web app that lets you determine the sleeping pattern of any Twitter user as long as they have a public profile on Twitter.

Sleeping Time launched in 2010 and since then, the app has been used to generate the sleeping schedules of more than 500,000 Twitter users. The response was unexpected and it even made it to the front page of a newspaper.



The app reads the time-stamp of the last 1,000 tweets of a Twitter user and then estimates their sleep cycle based on hours when he or she is least active on Twitter. To get started, sign-in with your Twitter account (it will never post anything to Twitter on your behalf) and enter the user name of any Twitter user to see their sleeping pattern.

Give it a try And check out the reports of tech writers and bollywood stars.

Wednesday, 7 June 2017

Set an Expiration Date for your Tweets

Some messages posted on Twitter are valid only for a short period of time. For instance, if you are sharing a discount coupon code that is set to expire in an hour, your tweet could still appear in the timeline of followers who happen to login the next day though that offer would have definitely expired.

Here's a very simple solution to this problem in the form of Spirit. You can set an expiration time for your tweets with the help of hashtags and the tweet will self-destruct after that time has passed.

Set an Expiration Date for your Tweets


To get started, you need to log into Spirit with your Twitter account and grant read & write permissions to the app. That’s it. The app will work behind the scenes and monitor your Twitter timeline for any time-sensitive tweets. If it finds one, the tweet will be automatically deleted after the set amount of time as specified by you in the hash tag.

You can use hash tags like #6m (for 6 minutes), #10h (for 10 hours) or #3d for tweets that are to be auto-deleted after 3 days. You can post tweets from the web, from your phone or even through an email message and Spirit will find it as long as you have added the hash tag in the correct (#\d+[mhd]) format.

If you ever wish to pause or disable Spirit from deleting your tweets, just go to your Twitter account settings page and revoke access to the app.

Thursday, 1 June 2017

How to Add Twitter to your Website or Blog

Twitter is a useful tool for both businesses and professionals. Unlike traditional blogging, Twitter only allows posts, called "tweets," of up to 140 characters or less. Many of Twitter's 300 million users tweet with smartphones as well as on the computer. 

How to Add Twitter to your Website or Blog

If you would like to use Twitter as a way to update your blog readers or website fan base, then a badge can be added. Although many websites have a built in Twitter option, Twitter.com has also created a Twitter badge that can be posted in your website's HTML web coding. This article will tell you how to add Twitter to your website or blog.

Steps :- 


1.) Ask a web developer or IT person to help you with this process, if you do not know how your website works.

For most situations, you will need to have some knowledge of HTML code to properly place a Twitter box on your site or blog.




2.) Log into your website or blog admin page.

Before automatically using Twitter's own badge, you should check to see if your website template already includes a Twitter option. Many websites, such as WordPress, have a Twitter widget included in the administrative dashboard options.
  • If you are using WordPress for a website or blog, you should go to your dashboard and click on the "Appearance" tab. Click on the "widgets" option. Drag the Twitter widget box into the area of the website that you would like it to appear. These website area boxes are usually located in the upper right section of the widget page. Enter your Twitter website URL, choose a title and choose how many tweets you would like to appear on your website.



3.) Open a new browser tab, go to Twitter.com, and log into your Twitter profile.

If your website did not have an option to add Twitter automatically, then you can still do it with one of Twitter's badge options.




4.) Find the "Twitter" box on the left or right hand side of your screen.

Click on "Resources." This should take you to a page called "Buttons, widgets, logos, and more".



5.) Click on the "widgets" option.

Click on "My Website." Read the brief descriptions of the types of Twitter boxes you can put on your website, and then click the "Profile", "Search", "Faves", or "List" option.
  • Most people would choose to use the Profile widget. This would only post your tweets, rather than the tweets of your followers. It gives you the most control over what your website viewers will see.



6.) Click on all the option tabs on the "Customize your Profile Widget" page. 

You can choose your username, the number of tweets that show up, the color of your Twitter box, the dimensions and more. Each choice that you make will be added to the HTML code for your website Twitter box.
  • You can see an example of what your Twitter box will look like on the right hand side of the screen. Change the colors and size according to what will best match your website's appearance.



7.) Click "Test" or "Finish and Grab Code".

Once the code is generated, copy the entire box. Make sure to get every symbol, or your Twitter box may not work.



8.) Return to your blog or website's admin page.

Choose the area of your website where you would like the Twitter box to appear. Paste the HTML code in the correct place on your website.
  • If your website is very user-friendly, it may have an "easy editor" on the admin page. Find the "HTML Code" tab or section. Paste the Twitter HTML code in this section.



9.) Save your changes on your website.

If you want to make changes to your Twitter badge in the future, you will need to return to your Twitter page and go through the same process, in order to create new HTML code.


Things You'll Need : -

Web programmer/IT help Web browser Twitter account Website/blog administrative account

Tuesday, 30 May 2017

How to Link Your Website to Your Twitter

People all over the world use Twitter and many other social media websites as a way to advertise their businesses and products. If this is something you do, one of the important things you must do is to connect your website to your Twitter so people who are interested in your product or service can get quick and easy access to your website. You will need a desktop or laptop computer in order to connect your website.

Steps

How to Link Your Website to Your Twitter

1.) Log in to your Twitter account.
  • Keep a note of your username and password so that you will never have to worry about being locked out of your account.
How to Link Your Website to Your Twitter

2.) Click on the small gear symbol on the top-right portion of your screen.
This will be between the “Direct messages” and “Compose a new tweet” options. After you click on the gear, the site will take you to the Settings page.
  • Check on the left side, you will see a clickable list of options.

How to Link Your Website to Your Twitter


3.) Choose the option that says Profile.
After you click Profile, you will see a list of modifiable objects.

How to Link Your Website to Your Twitter
4.) Look for the Website box.
This should be between the “Bio” and Location” boxes on the right side.

How to Link Your Website to Your Twitter
5.) Enter in the Website box the direct link to your website you wish for people to see.

How to Link Your Website to Your Twitter
6.) Scroll toward the bottom and click “Save changes.
” It is CRUCIAL that you click on this box because this confirms that your website will show up on your profile.

How to Link Your Website to Your Twitter
7.) Go back to your profile page and see if your website is listed.  If it is, for sure others can see it as well.

Tips

  • You do not even need to post a business page; you can post your blogs and private information if you want to post it for entertainment purposes.
  • You can only post one website at a time. So if you have more than one page you want people to see, make a website and list all of your websites on that page so your followers can get to all of your pages.


Friday, 19 May 2017

Prevent Twitter from Converting @Mentions into Links

If your tweet contains two words that are separated by a dot (or period), Twitter may sometimes interpret that combination as a web address and will auto-convert the words into a clickable hyperlink wrapped inside a t.co URL.

Similarly, if you add the “@” symbol before any word in a tweet, Twitter may see that as a mention and will automatically link that word to a Twitter profile. And words starting with the # hash sign are converted into links pointing to search results as well.

These auto-generated links are useful in most cases but sometimes you may just want twitter to display your tweets in plain text and not convert words into links.




It includes the same text (labnol.org) twice but in the first case, Twitter is pointing to a website and in the other case, it’s pointing to a Twitter profile.

The trick is simple ↓

If you would like to prevent Twitter from interpreting two consecutive words as a URL, just add a zero width space after the dot. Similarly, if you would not like Twitter to auto-convert @mentions or #tags into hyperlinks, add a zero width space after the @ or # symbol respectively.

HOW TO INSERT ZERO WIDTH SPACE IN TWEETS

The HTML code for zero width space is ​ but you cannot add HTML codes directly inside Twitter so here’s a simple workaround.

Enter text:


Enter some text in the input box above and it will automatically add zero width space after every dot, #hash or @mention. You can then copy-paste the converted text into you Twitter and none of the words will ever get converted into hyperlinks.

How to Find Twitter Users Near You

If you enable location sharing your Twitter setting, your current geographic coordinates (latitude and longitude) are added to your tweets.

You may not want to share the exact location of your house in a public tweet for obvious reasons but if you are visiting a new place or attending a local event, these “geo-tagged” tweets can help you quickly find other Twitter users who may be located in that area.





FIND TWITTER USERS NEARBY

Here’s a very easy way that will help you find local Twitter users around a location.

Go to the Twitter website and click the search box in the upper right corner. Here put the query near:{location name} and Twitter will will show you a list of tweets that have been sent from that area. Yes, people can fake location on Twitter but that’s a different issue.

For location, you can enter the city name, the street name or even the zip code if you are in the United States. You can further increase the accuracy by adding the “within” parameter to the near search operator. For instance, you can says near:agra within:15 to see all tweets written within 15 miles of the Agra city.

Now here’s the interesting part. What we have done so far is searched for geo-tagged tweets. While you are on the search results page, switch to the People tab in the left sidebar and it will show you Twitter users from that area.

Use One Email Address with Multiple Twitter Accounts

If you have multiple accounts on Twitter, you are probably aware of the fact that it is not possible to associate the same email address with more than one Twitter account. Try it and Twitter will throw up an error saying – “Email has already been taken”.



LINK MULTIPLE TWITTER ACCOUNTS WITH 1 EMAIL

There’s however a simple workaround that will let you use the same email address with all your Twitter handles – the only condition is that you should be using a Gmail or Google Apps email address.

In Gmail, you can add a dot (.) anywhere in the username and all emails address to that new alias will still reach your mailbox. For instance, if your original email address is hello@gmail.com, any emails sent to he.llo@gmail.com or he.ll.o@gmail.com will land in your mailbox because Gmails ignores periods in the email username.

And that’s what you can use to trick Twitter. Twitter will consider hello@gmail and he.llo@gmail as two separate and valid email addresses even though they point to the same Gmail Inbox.

Update: Please do that note that you have to enable the catch-all option in your domain setting to use email aliases inside Google Apps. Thus it is a better option to use a free Gmail address for Twitter.

Another Workaround

When you open an account in Gmail, you automatically get another valid email address that uses the googlemail.com domain.

So if you only have two handles on twitter, you can use the gmail.com address with one handle and the googlemail.com address with the second handle.

Monday, 15 May 2017

How to Send Out of Office Replies in Twitter

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?



WHAT WILL THE TWITTER AUTO-RESPONDER DO

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 this simple Google Script.

Use this Google Script to setup Out of Office auto-replies in Twitter. The script reads all the Twitter @mentions and sends them a tweet with a custom status message.

 

/*     O U T   O F   O F F I C E   F O R   T W I T T E R    */
/*     - - -   - -   - - - - - -   - - -   - - - - - - -    */


function start() {
  
  // Please enter dates in YYYY-MM-DD HH:MM format
  
  var OUTOFOFFICE_START_DATE  = "03/11/2013 18:13"; 
  var OUTOFOFFICE_END_DATE    = "03/11/2013 19:00";
  
  // This is your Out-Of-Office reply. Keep it less than 120 characters.
  
  var OUTOFOFFICE_TEXT = "I am currently out of the office,
                              with limited access to Twitter. Thanks!";  
   
  // Get your Twitter keys from dev.twitter.com
  
  var CONSUMER_KEY     = "AAA";
  var CONSUMER_SECRET  = "BBB";

  // Change this with your Twitter handle

  var TWITTER_HANDLE   = "way2trick"; 
    
  // DO NOT MODIFY ANYTHING AFTER THIS LINE
  
  storeKeys ( CONSUMER_KEY, CONSUMER_SECRET, 
                       OUTOFOFFICE_TEXT, TWITTER_HANDLE );
  
  initialize ( OUTOFOFFICE_START_DATE, OUTOFOFFICE_END_DATE );
  
  // Make sure that Twitter oAuth is working

  doTwitter();
   
}


// Delete exiting Apps Script triggers, if any

function removeTriggers() {

  var triggers = ScriptApp.getScriptTriggers();
  
  for(var i=0; i < triggers.length; i++) {
    ScriptApp.deleteTrigger(triggers[i]);
  }
  
  clearDatabase();

}

function storeKeys(key, secret, text, handle) {
  
  ScriptProperties.setProperty("TWITTER_CONSUMER_KEY",    key);
  ScriptProperties.setProperty("TWITTER_CONSUMER_SECRET", secret);
  
  ScriptProperties.setProperty("OUTOFOFFICE_TEXT", text);  
  ScriptProperties.setProperty("MAX_TWITTER_ID",   0);  
  ScriptProperties.setProperty("TWITTER_HANDLE",   handle);  

}

// Clean and Initialize the ScriptDB database

function clearDatabase() {
  
  var db = ScriptDb.getMyDb();
  while (true) {
    
    var result = db.query({}); 
    
    if (result.getSize() == 0) {
      break;
    }
    
    while (result.hasNext()) {
      db.remove(result.next());
    }
  }
}

// Setup triggers for the START and END dates

function initialize(start, end) {
  
  var startDate = new Date(start);
  var endDate   = new Date(end);
  
  removeTriggers();
      
  ScriptApp.newTrigger("autoReply")
           .timeBased()
           .at(startDate)
           .create();
  
  ScriptApp.newTrigger("removeTriggers")
           .timeBased()
           .at(endDate)
           .create();
   
} 

function autoReply() {
  
  clearDatabase();

  ScriptApp.newTrigger("outOfOffice")
           .timeBased()
           .everyMinutes(5)
           .create();

}

function oAuth() {

 var oauthConfig = UrlFetchApp.addOAuthService("twitter");
 oauthConfig.setAccessTokenUrl("https://api.twitter.com/oauth/access_token");
 oauthConfig.setRequestTokenUrl("https://api.twitter.com/oauth/request_token");
 oauthConfig.setAuthorizationUrl("https://api.twitter.com/oauth/authorize");
 oauthConfig.setConsumerKey(
                 ScriptProperties.getProperty("TWITTER_CONSUMER_KEY"));
 oauthConfig.setConsumerSecret(
                 ScriptProperties.getProperty("TWITTER_CONSUMER_SECRET"));
 
}

// This function will poll twitter every 5 minutes for any @mentions

function outOfOffice() {

  oAuth();
  
  var twitter_handle = ScriptProperties.getProperty("TWITTER_HANDLE");
  
  var phrase = "to:" + twitter_handle;
  var search = "https://api.twitter.com/1.1/search/tweets.json?count=10" 
             + "&include_entities=false&result_type=recent&q="
             + encodeString(phrase) + "&since_id=" 
             + ScriptProperties.getProperty("MAX_TWITTER_ID");    

  var options =
  {
    "method": "get",
    "oAuthServiceName":"twitter",
    "oAuthUseToken":"always"
  };
  
  try {

    var result = UrlFetchApp.fetch(search, options);    

    if (result.getResponseCode() === 200) {
      
      var data = Utilities.jsonParse(result.getContentText());
      
      if (data) {
        
        var tweets = data.statuses;
        
        if (tweets.length) {
          
          var db    = ScriptDb.getMyDb();
          var reply = ScriptProperties.getProperty("OUTOFOFFICE_TEXT");
          
          for (var i=tweets.length-1; i>=0; i--) {
            
            var sender = tweets[i].user.screen_name; 
            var found = db.query({user: sender});
            
            if ( ! found.hasNext() ) {
              db.save({user:sender});
              sendTweet(sender, tweets[i].id_str, reply);
            }
          }
        }
      }
    }    
  } catch (e) {
    Logger.log(e.toString());
  }
}

// If an @mention is found, send an Out of Office tweet to that user.

function sendTweet(user, reply_id, tweet) {

  var options =
  {
    "method": "POST",
    "oAuthServiceName":"twitter",
    "oAuthUseToken":"always"    
  };
  
  var text   =  "@" + user + " " + tweet;
  text   =  encodeString(text.substr(0, 140));
  
  var status = "https://api.twitter.com/1.1/statuses/update.json"
             + "?status=" + text + "&in_reply_to_status_id=" + reply_id;
  
  try {
    var result = UrlFetchApp.fetch(status, options);
    ScriptProperties.setProperty("MAX_TWITTER_ID", reply_id);
  }  
  catch (e) {
    Logger.log(e.toString());
  }  
  
}

function doTwitter() {

  oAuth();
  
  var req = "https://api.twitter.com/1.1/application/rate_limit_status.json"; 
      
  var options =
  {
    "method": "get",
    "oAuthServiceName":"twitter",
    "oAuthUseToken":"always"
  };
  
  try {

    var result = UrlFetchApp.fetch(req, options);    
   
  } catch (e) {
    Logger.log(e.toString());
  }
}


function encodeString (q) {
   var str =  encodeURIComponent(q);
   str = str.replace(/!/g,'%21');
   str = str.replace(/\*/g,'%2A');
   str = str.replace(/\(/g,'%28');
   str = str.replace(/\)/g,'%29');
   str = str.replace(/'/g,'%27');
   return str;
}

&nbsp;
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.

HOW TO SETUP OUT OF OFFICE REPLIES IN TWITTER

STEP A: SETUP A TWITTER APP

1. Go to apps.twitter.com and sign-in with your existing Twitter account. Create a new Twitter app , add a description, website (any URL) and put https://spreadsheets.google.com/macros/ in the callback URL field.

2. 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.

3. Switch to the API Keys tab and make note of the Consumer API Key and API Secret.

STEP B: SETUP THE AUTO-RESPONDER SCRIPT

1. Make a copy of this auto-responder script into your Google Drive.



/*     O U T   O F   O F F I C E   F O R   T W I T T E R    */
/*     - - -   - -   - - - - - -   - - -   - - - - - - -    */


function start() {
  
  
  
  
  // Please enter dates in YYYY-MM-DD HH:MM format
  
  var OUTOFOFFICE_START_DATE  = "2014/08/20 18:00"; 
  var OUTOFOFFICE_END_DATE    = "2014/08/24 09:00";
  
  // This is your Out-Of-Office reply. Keep it less than 120 characters.
  
  var OUTOFOFFICE_TEXT = "I am currently out of the office, with limited access to Twitter. Thanks!";    
  
  // Get your Twitter keys from dev.twitter.com
  
  var CONSUMER_KEY     = "YOUR_KEY_HERE";
  var CONSUMER_SECRET  = "YOUR_SECRET_HERE";
  var TWITTER_HANDLE   = "YOUR_HANDLE_HERE";
  
  // Ignore everything after this line
  
  storeKeys( CONSUMER_KEY, CONSUMER_SECRET, OUTOFOFFICE_TEXT, TWITTER_HANDLE );
  
  initialize( OUTOFOFFICE_START_DATE, OUTOFOFFICE_END_DATE );
  
  // Make sure that Twitter oAuth is working
  
  doTwitter();
  
}

function removeTriggers() {
  
  var triggers = ScriptApp.getScriptTriggers();
  
  for(var i=0; i < triggers.length; i++) {
    ScriptApp.deleteTrigger(triggers[i]);
  }
  
}

function storeKeys(key, secret, text, handle) {
  
  var props = PropertiesService.getScriptProperties();
  
  props.setProperty("TWITTER_CONSUMER_KEY",    key);
  props.setProperty("TWITTER_CONSUMER_SECRET", secret);
  
  props.setProperty("OUTOFOFFICE_TEXT", text);  
  props.setProperty("MAX_TWITTER_ID",   0);  
  props.setProperty("TWITTER_HANDLE",   handle);  
  
}


// Setup triggers for the START and END dates

function initialize(start, end) {
  
  var startDate = new Date(start);
  var endDate   = new Date(end);
  
  removeTriggers();
  
  ScriptApp.newTrigger("autoReply")
  .timeBased()
  .at(startDate)
  .create();
  
  ScriptApp.newTrigger("removeTriggers")
  .timeBased()
  .at(endDate)
  .create();
  

function autoReply() {
  
  ScriptApp.newTrigger("outOfOffice")
  .timeBased()
  .everyMinutes(5)
  .create();
  
}

function oAuth() {
  
  var props = PropertiesService.getScriptProperties();
  var oauthConfig = UrlFetchApp.addOAuthService("way2trick");
  oauthConfig.setAccessTokenUrl("https://api.twitter.com/oauth/access_token");
  oauthConfig.setRequestTokenUrl("https://api.twitter.com/oauth/request_token");
  oauthConfig.setAuthorizationUrl("https://api.twitter.com/oauth/authorize");
  oauthConfig.setConsumerKey(props.getProperty("TWITTER_CONSUMER_KEY"));
  oauthConfig.setConsumerSecret(props.getProperty("TWITTER_CONSUMER_SECRET"));
  
}

// This function will poll twitter every 5 minutes for any @mentions

function outOfOffice() {
  
  oAuth();
  
  var props = PropertiesService.getScriptProperties();
  
  var twitter_handle = props.getProperty("TWITTER_HANDLE");
  
  var phrase = "to:" + twitter_handle;
  var search = "https://api.twitter.com/1.1/search/tweets.json?count=10" 
  + "&include_entities=false&result_type=recent&q="
  + encodeString(phrase) + "&since_id=" 
  + props.getProperty("MAX_TWITTER_ID");
  
  var options =
      {
        "method": "get",
        "oAuthServiceName":"way2trick",
        "oAuthUseToken":"always"
      };
  
  var key = "Twitter" + Utilities.formatDate(new Date(), "UTC", 'yw');
  
  try {
    
    var result = UrlFetchApp.fetch(search, options);    
    
    if (result.getResponseCode() === 200) {
      
      var data = Utilities.jsonParse(result.getContentText());
      
      if (data) {
        
        var tweets = data.statuses;
        
        if (tweets.length) {
          
          var db    = props.getProperty(key) || "";
          var reply = props.getProperty("OUTOFOFFICE_TEXT");
          
          for (var i=tweets.length-1; i>=0; i--) {
            
            var sender = "#" + tweets[i].user.screen_name + "#"; 
            if (db.indexOf(sender) == -1) {
              props.setProperty(key, db + sender)
              sendTweet(tweets[i].user.screen_name, tweets[i].id_str, reply, props);
            }
          }
        }
      }
    }    
  } catch (e) {
    Logger.log(e.toString());
  }
}

// If an @mention is found, send an Out of Office tweet to that user.

function sendTweet(user, reply_id, tweet, props) {
  
  var options =
      {
        "method": "POST",
        "oAuthServiceName":"way2trick",
        "oAuthUseToken":"always"    
      };
  
  var text = encodeString("@" + user + " " + tweet).substr(0, 140);
  
  var status = "https://api.twitter.com/1.1/statuses/update.json"
  + "?status=" + text + "&in_reply_to_status_id=" + reply_id;
  
  try {
    var result = UrlFetchApp.fetch(status, options);
    props.setProperty("MAX_TWITTER_ID", reply_id);
  }  
  catch (e) {
    Logger.log(e.toString());
  }  
  
}

function doTwitter() {
  
  try {
    
    var req  = "https://api.twitter.com/1.1/application/rate_limit_status.json?resources=search";
    
    var options =
        {
          "method": "get",
          "oAuthServiceName":"way2trick",
          "oAuthUseToken":"always"
        };
    
    oAuth();
    
    var result = UrlFetchApp.fetch(req, options);    
    
  } catch (e) {
    throw(e.toString());
  }
}


function encodeString (q) {
  q = q.replace(/\!|\*|\(|\)|\'/g, '');
  return encodeURIComponent(q);
  
  //str = str.replace(/!/g,'%21');
  //str = str.replace(/\*/g,'%2A');
  //str = str.replace(/\(/g,'%28');
  //str = str.replace(/\)/g,'%29');
  //str = str.replace(/'/g,'%27');
  //return str;
  
}


2. Enter the start and end dates of your vacation, the Twitter API keys (from the previous step), and your Twitter handle.

3. Go to Run -> Start to initialize the auto-responder. Say Yes if the script requires you to authorize access to certain Google Script services.

4. 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.

Related Posts Plugin for WordPress, Blogger...

Labels

404 AdBlock Add-on Airtel GPRS Trick Airtel SMS Trick Alexa Amazon Amazon Kindle Amazon Prime Android Android 8 Android Oreo antivirus Apple Apple Mac ASCII Audacity Audio Authotkey Backup Balance Transfer in Vodafone Battery Bing Blogger Blogging Bookmarklet Browser Camera Chromebook clock Cloud colors command lines Computer Computer Tricks configuration Contact Creative Commons Credit Card CSS devolop DIY Doodle DOS Download Dropbox E-Mail eBook Email Email Attachment Embed Encryption English Error Evernote Eyes Facebook Facebook Tricks Feedburner Flipkart Font Foursquare Free Internet Free sms trick in Vodafone G Mail Gadget Game Getty Images GIF Gists Github Google Google AdSense Google Analytics Google Apps Google Chrome Google Contacts Google Currents Google DNS Google Docs Google Drive Google Earth Google Font Google Forms Google Images Google Map Google Photos Google Play Store Google Plus Google Print Google Reader Google Script Google Sheets Google Spreadsheet Google Translate GPRS Setting GPS Hacking Health App HelloFax Hindi Hoodie HTML Icons idea Image Editing Images IMEI Indian Railways Infographics Instagram Internet Internet Explorer Internet Tricks iOS iPad iPhone IRCTC iTunes iTV JavaScript JioCinema JioTV Junglee Kindle Language Translation Laptop Laptop. TV Life Time FREE GPRS Life-Style Link Linkedln Linux logo Make Money Online Microdoft Powerpoint Microdoft Word Microsoft Office Microsoft Outlook Mobile Mosaic Music Name Networking nexus Notepad OCR Online Shopping Open DNS OS Outlook Password PDF Petya Phillips Hue Lights Photogtraphy Pixel Play Station Podcasts Pokemon Pokemon Go Polls Print Productivity Proxy Server Pushbullet QR Code Ransomware Reddit Reliance Hack GPRS Reliance Jio RGB Ringtone Router RSS Safe Mode Samsung Galaxy S Scrabble Screen Capture Screen Sharing Screencast Secrets Security Send free sms from PC SEO Sierra Skype Slideshare SMBv1 SMS Snapchat Snapdeal Social Media Solution Sound Device Speech Recognition Sql Steam Sync Synology NAS Tata Docomo GPRS trick Teleprompter Torrent Trick Tricks TV Twitter UltraISO Unicode Unknown Extension Unlimited 2GB Unlimited 3GB Unlimited GPRS USB USB Security Key Video Editing virtual desktop Virus attack VLC Vodafone 110% working trick for GPRS Vodafone 3g Vodafone GPRS VPN wallpapers WannaCry Web Design Web Domain Website Wget Whatsapp WiFi Wikipedia Windows Windows 10 Windows 10 S Windows KN Windows Tricks windows updates Winows N Wolfarm Alpha WordPress XBox YouTube Zip
Twitter Delicious Facebook Digg Stumbleupon Favorites More