Friday, 6 May 2016

How to Delete the Useless Photos in your WhatsApp Automatically

WhatsApp is probably the largest space hog on our mobile phones. We all have friends and relative who diligently forward us every single motivation quote and meme they’ve received from their own network. Some think it is their duty to wake us with a “good morning” message accompanied with photos of the rising sun or chirping birds.

The bigger problem with WhatsApp is that these ‘spam’ messages often originate from contacts who are close to you in real life and thus blocking them would be considered rude. You have an option to mute WhatsApps groups but the downloaded images would still take up precious space on your mobile phone.

A simple solution to the problem would be that you open the Photo Gallery app on your Android phone, or use a File Manager app to locate the media folder of WhatsApp, and delete the entire folder containing those WhatsApps images. But since WhatsApp makes no distinction between real photographs and useless forwards, you risk deleting the good pictures too.


Siftr, an Indian startup founded by ex-Adobe employees, has launched an intelligent Android App that can help you get rid of all the junk photos from your WhatsApp with no effort.
The app, Magic Cleaner, scans the media folder of your WhatsApp app and automatically detects all the junk images including screenshots, memes, video screen grabs, cartoons and other pictures with overlay text. You are then offered an option to delete all the detected images in one go.
Previous: Create Photography Websites with Siftr
How does it work? Like Cloud Vision, Google’s image recognition API, Siftr has developed their own image recognition engine that analysis the content of an image to determine whether it’s junk or not. It requires an active Internet connection because the image analysis is done on Siftr servers and not locally on the mobile phone. However it is unlikely to blow up your data plan as the app only uploads a small hash of the image and matches it against their own database of images.
I ran the photo cleaner app against a WhatsApp account that had about 4000+ images and it could successfully clean it up in about 10 minutes. The accuracy was very impressive. The app is free but you can only auto-delete a limited number of images in a single run. If you would like to delete more images, you either need to invite a friend to use the app or wait for a day.

If you have WhatsApp, which you probably do, Magic Cleaner is a must-have app. An iPhone version is in the works. Also, though the WhatsApps images are deleted from the memory card, a blurred thumbnail will still exist inside your WhatsApp message logs and you’ll have to erase them manually.





How to Write a Twitter Bot in 5 Minutes

Twitter Bots can do interesting things. You can tweet questions like “how many calories are in diet coke” to @DearAssistant and the Twitter bot, like Google Now or Apple Siri, will reply with the answer. The @HundredZeros bot tweets links to eBooks that are free on Amazon. Another Twitter bot @WhatTheFare will tell you the Uber fare between two locations.




A bot is a program that runs in the background and, when it encounters a command, it performs some action. For instance, you can have a grammar bot that looks for tweets containing misspellings and tweet the correct spelling.
A bot can automatically favorite or retweet tweets that match certain criteria. It can follow Twitter user who have tweeted a particular phrase. A brand may build an auto-reply bot that automatically responds when the brand gets a @mention on Twitter. You may have a bot that auto-sends a DM (direct message) to users who follow you on Twitter.
Writing a Twitter bot is easy and you can get one up and running in 5 minutes. Our Twitter bots run on Google servers and you don’t need any coding skills to create the bot. The bots are internally written using Google Scripts.

How to Create your own Twitter Bot

The basic idea behind bots is simple. You specify a search phrase and choose an action. The bot will find all tweets that match the search phrase and perform the associated action on those tweets.
Twitter Bots

Step A: Make an App for the Twitter Bot

  1. Create a new account at Twitter that will work as a bot. Then go to apps.twitter.com, sign-in with your new Twitter account and create a Twitter app. Give your app a name, description and put any URL in the website field. Agree to the developer terms and submit the form.
  2. Once the Twitter app has been created, click Modify App Permissions under Application Settings and change the access level to Read, Write and Access Direct Messages.
  3. Next switch to the Keys and Access Tokens tab and click the Create my Access Token button. Twitter will generate the Consumer Keys and Access tokens that we will need in a next step.

Step B: Configure your Twitter bots

  1. Go to labnol.org/bots to open the Twitter bots application. You may have to authorize the bot once.
  2. Edit the values of Twitter Consumer Key, Consumer Secret, Access Token and Access Secret that were generated in the previous step.
  3. Next you need to specify the search phrase for the bots. The app will find all new tweets that match this search phrase and process them all, one at a time. If you have the premium version, you can create up to 5 bots in one go.
  4. Click the Create to initialize the Twitter bot. That’s it. The bots are now initialized and they’ll auto-run in the background.

Twitter Bots Video Tutorial

Please watch the Twitter Bots Video Tutorial (download) for a more detailed getting started guide. It is important to note that Twitter TOS discourages automation so you may want to test the waters with a test Twitter account.



You can use Twitter search operators to find more specific tweets for processing through bots. For instance, use min_faves or min_retweets operator to filter out spammy tweets from search results. Here are some area where bots are handy:
  • If you are changing your Twitter username, set an auto-DM bot for the old account so followers can know about your new screen name.
  • If you are offline during specific hours, setup out of office replies so people can expect a delayed response.
  • Follow users or add them to a Twitter list who tweet on particular topics.

Twitter Bots – Unlock Premium Features

The Twitter bot is available in free and premium editions. The latter includes more features and you are entitled to technical support for 3 months.

Features Free Premium
Favorite Tweets Yes Yes
Retweet Tweets Yes Yes
Auto-Reply to Tweets Yes Yes
Emoji Support Yes Yes
Run bot at specific time Yes Yes
Follow Users No Yes
Add Users to Twitter List No Yes
DM New Followers No Yes
Reply via DMs (to users who allow) No Yes
 How often do the bots run? Once per hour Every 15 minutes
How many Twitter bots can be created? One Five
Support options None Email
Buy Premium Edition

How to Embed Facebook Message Buttons in your Website

Email has always been the preferred mode for reaching out to people on the Internet. Websites would put their email addresses on web pages and made them clickable hyperlinks using the mailto protocol. Things have changed and while email is still considered important, the new generation is known to prefer instant texting apps like Facebook Messenger over email. For them, writing an email is as boring as creating a résumé.

This step-by-step guide explains the various techniques that you can use to easily embed the Facebook Messenger button in your website. When someone clicks the Message Me button, it will directly launch the Facebook Messenger app on their mobile phone or the messenger.com website if they are on the desktop. You can choose to receive messages in your Facebook profile or your Facebook page, if you have one.

A: Simple Facebook Messenger Link


The default Facebook Messenger button is rendered using JavaScript but you can also write them in pure HTML without requiring JavaScript. The advantage is that these buttons (see demo) would show up even if the user has enabled ad blockers and second, you can embed message links inside email newsletters.



All you have to do is replace “XYZ” in the snippet below with your Facebook vanity username. If you don’t have a username yet, you can use your numerical Facebook profile ID instead. The link may be customized    with CSS to resemble a button as seen in this live demo.

  1. <a href="https://m.me/XYZ">
  2. Message us on Facebook
  3. </a>
Tip: If you are not seeing messages sent to your Facebook profile, it is because Facebook automatically hides messages from people that are not in your contacts / friends list. Go to facebook.com/messages, click the “More” dropdown and choose “Filtered” to see all messages that are not in your main inbox.

B: Facebook Messenger Button

This is the default Facebook Messenger button (see live demo) rendered with JavaScript. Unlike the previous option that allows messaging to personal profile as well, this button is only available to Facebook Page owners for them to receive messages from other Facebook users.
To get started, copy-paste the following snippet in your blog template but remember to replace “XYZ” with the numeric ID of you Facebook Page. You can set the color as white for a blue text on white background button.
  1. <script>
  2. window.fbAsyncInit = function() {
  3. FB.init({
  4. appId : '95100348886',
  5. xfbml : true,
  6. version : 'v2.6'
  7. });
  8. };
  9.  
  10. (function(d, s, id){
  11. var js, fjs = d.getElementsByTagName(s)[0];
  12. if (d.getElementById(id)) {return;}
  13. js = d.createElement(s); js.id = id;
  14. js.src = "//connect.facebook.net/en_US/sdk.js";
  15. fjs.parentNode.insertBefore(js, fjs);
  16. }(document, 'script', 'facebook-jssdk'));
  17. </script>
  18.  
  19. <div class="fb-messengermessageus"
  20. messenger_app_id="95100348886"
  21. page_id="XYZ"
  22. color="blue"
  23. size="large">
  24. </div>
Tip: If you are unable to use the Facebook Messenger button, it is likely that your Facebook Page is configured to not receive messages. Go to your Facebook Page settings, choose General, Messages and turn on the option that says “Allow people to contact my Page privately by showing the Message button”.

C: Facebook Messenger Box

You have seen the Facebook Like box embedded in websites but did you know that the same box can also include an inline form allowing any Facebook user to contact you without even leaving your webpage. Here’s a live demo.
In this case you need to replace “XYZ” in the snippet below with the vanity username or ID of your Facebook Page. Anyone who is logged into Facebook can message you from your website itself, similar to regular contact us forms.
  1. <script>
  2. window.fbAsyncInit = function() {
  3. FB.init({
  4. appId : '95100348886',
  5. xfbml : true,
  6. version : 'v2.6'
  7. });
  8. };
  9.  
  10. (function(d, s, id){
  11. var js, fjs = d.getElementsByTagName(s)[0];
  12. if (d.getElementById(id)) {return;}
  13. js = d.createElement(s); js.id = id;
  14. js.src = "//connect.facebook.net/en_US/sdk.js";
  15. fjs.parentNode.insertBefore(js, fjs);
  16. }(document, 'script', 'facebook-jssdk'));
  17. </script>
  18.  
  19. <div class="fb-page"
  20. data-href="https://www.facebook.com/XZY/"
  21. data-tabs="messages"
  22. data-width="400"
  23. data-height="300"
  24. data-small-header="true">
  25. <div class="fb-xfbml-parse-ignore">
  26. <blockquote></blockquote>
  27. </div>
  28. </div>
 You should also check the Facebook Page Plugin to learn about all the other configuration options that can be easily set using the data attributes.

How to Copy an Entire Folder to Another Folder in Google Drive

Google Drive, launched almost 4 years ago, is an online vault where you can store all your files and documents. It offers nearly all the functionality that you would expect in a file manager app making it easier for you to manage files from within the browser. You can move files between folders, rename files, differentiate them with colors, add text notes for easier lookup and more.

However the one piece that is still missing in Google Drive is the ability to copy folders. You can duplicate any file in Google Drive by right-clicking the file and selecting “Make a Copy” but this option is not available for folders. A Google Script exists to copy folders in Google Drive but it is complicated.



The option to duplicate folders doesn’t exist in Google Drive

How to Copy Folders in Google Drive

Wouldn’t it be nice if there were an xcopy (Windows) or rsync (Mac, Unix) like command for Google Drive that would recursively copy everything inside a folder, easily It should not only copy all the files and subdirectories but also retain the directory tree structure and maintain the shared file permissions.
Well, we are not sure if Google will ever provide an option to duplicate folders in Google Drive but there’s an open source web app by Eric YD that does exactly what you are looking for. Here’s how to get started:
  1. Go to labnol.org/xcopy and click the Authorize button.
  2. Allow the app to access your Google Drive files. The app would perform the copy operation directly inside your Google account without involving a third-party server.
  3. Once authorized, select the source folder using the Google File picker and specify the destination folder name.
  4. Click the Copy Folder button to begin the cloning process.
That’s it. The script will run in the background and copy files, one-by-one, into the target folder.  It will log everything in a Google Spreadsheet so you know what’s happening behind the scene.

While optional, the app can also retain permissions and in the case the copied files will be editable/viewable by the same people as the original files. The copying process would however take longer if you choose to copy the sharing permissions.

Copy Folders to another Google Drive Account

Say you have a folder in one Google account (A) that you would like to copy to another Google account (B). While the app doesn’t support copying across accounts, there’s a simple workaround:
  1. Use labnol.org/xcopy to copy the folder in its original account (A).
  2. Log into account B, create a blank folder and share it with account A.
  3. Log into account A and move the copied folder into the shared folder.
  4. Go back to account B and remove the sharing permissions for the folder.
The Alternative – If you are not comfortable giving access to your Google Drive to another app, you can manually copy folders using the Google Drive desktop client for Windows and Mac. Go to Windows Explorer (or Finder), select the source folder and press Ctrl+C followed by Ctrl+V to duplicate the folder.

This would however not retain the original file permissions. The other downside is that Google Drive will have to reupload all the copied files whereas in the previous case, the copying happened on Google servers directly.