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

Facebook Messenger

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.

 <a href="">
    Message us on Facebook

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

      window.fbAsyncInit = function() {
          appId      : '95100348886',
          xfbml      : true,
          version    : 'v2.6'

      (function(d, s, id){
        var js, fjs = d.getElementsByTagName(s)[0];
        if (d.getElementById(id)) {return;}
        js = d.createElement(s); = id;
        js.src = "//";
        fjs.parentNode.insertBefore(js, fjs);
      }(document, 'script', 'facebook-jssdk'));      

    <div class="fb-messengermessageus" 

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.

      window.fbAsyncInit = function() {
          appId      : '95100348886',
          xfbml      : true,
          version    : 'v2.6'

      (function(d, s, id){
        var js, fjs = d.getElementsByTagName(s)[0];
        if (d.getElementById(id)) {return;}
        js = d.createElement(s); = id;
        js.src = "//";
        fjs.parentNode.insertBefore(js, fjs);
      }(document, 'script', 'facebook-jssdk'));

    <div class="fb-page" 
      <div class="fb-xfbml-parse-ignore">

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.

Related: How to Embed Facebook Posts in Webpages

The story, How to Embed Facebook Message Buttons in your Website, was originally published at Digital Inspiration by Amit Agarwal on 03/05/2016 under Code, Embed, Facebook, Internet.

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.

Are junk WhatsApp images filling up your phone's memory?

Are junk WhatsApp images filling up your phone’s memory?

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.

WhatsApp Photo Cleaner

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.

Also see: Sync WhatsApp Photos with Google Drive or Dropbox

The story, How to Delete the Useless Photos in your WhatsApp Automatically, was originally published at Digital Inspiration by Amit Agarwal on 02/05/2016 under Android, WhatsApp, Internet.

Learning CSS with Cats and a Dinner Table

CSS, short for Cascading Style Sheets, are rules (or “styles”) that define how content should look on a web page. To give you an example, if your web page contains a table, you can use CSS to specify the thickness of the border and the color of text inside that table.

Learning CSS is easy. There are a plethora of good online tutorials or, if you prefer the traditional route, get a book. My favorites CSS books include HTML & CSS by John Duckett and CSS Secrets by Lea Verou.

You should also watch the YouTube series by Travis Neilson and Guy Routledge, probably the best free video resources for learning everything about CSS.

I recently stumbled upon a couple of web resources that take the help of cats and post-it notes and make learning CSS even more interesting and entertaining.

CSS Basics with Post-It Notes (link)

Designer Kaylan takes the help of colorful post-it notes for visualizing the the basic concepts of CSS.

CSS Box Model

CSS Selectors Explained with CSS (link)

If you have figured out how to write selectors in CSS, half the battle is one. Mike Borsare uses #cats to help you learn the basic CSS selector syntax.

CSS Selectors

CSS Dinner Table (link)

If you know the basic of CSS selectors, use the Dinner table to practice your CSS skills. Here you have plates and fruits placed on a dinner table and your task is to select the various elements using selectors.

CSS Dinner Plate

Related: Learn to Code Online

The story, Learning CSS with Cats and a Dinner Table, was originally published at Digital Inspiration by Amit Agarwal on 15/04/2016 under Code, Internet.

How to Copy Draft Emails in Gmail

You have composed a draft email inside Gmail and would like to send the same message to multiple people, but separately. The subject, the email body, the attachments are common and the only thing that differs between each message is the recipient’s email address.

Maybe you are sending your résumé to multiple companies. How can you do this without having to copy-paste the subject and body of the draft message multiple times?

Gmail Draft Emails Copy

Create Duplicate Email Messages in Gmail

When you compose a draft email in Gmail and hit the Send button, the email is automatically removed from the Drafts folder and moved to the Sent Items folder.

There are however two easy ways to create duplicate draft emails inside Gmail. You can either use Mail Merge for Gmail or, if you are looking for a more simple one-click option, use the Duplicate Drafts feature available inside Email Studio.

Here’s how to get started.

  1. Open your Gmail mailbox, compose a new email message and save it as a draft. You can attach files, embed inline images and other rich content.
  2. Go to Email Studio and authorize the app* to access your Gmail account. This is required since the app will read your Gmail drafts and create copies inside your Gmail account.
  3. Once the app is authorized, click the Draft Copier section.

Copy Gmail Drafts

To quickly clone a message to send separately to someone else, select the source draft from the drop-down, then select the number of copies you wish to have and click the Create Drafts button. The copied drafts will include the complete contents of the original message, including file attachments and inline images.

The Gmail clone tool works on both desktop and mobile so you can copy Gmail draft messages on a mobile phone as well.

The web app is written in Google Scripts and uses the Gmail API to create drafts copies. The app only requires Gmail access to copy your drafts and does not share, store or upload your data anywhere.

Email Studio is free for basic usage. Free users can copy a maximum of 3 email drafts at a time while premium users can duplicate up to 10 Gmail drafts in a single batch. No branding is included in premium version.

[*] If you have trouble authorizing the app, please ensure that you are not logged into multiple Google accounts. You can try try Email Studio in Chrome’s incognito mode or use this link to sign-out of your Gmail accounts.

The post How to Copy Draft Emails in Gmail appeared first on Digital Inspiration.

How to Track Google Spreadsheet Views with Google Analytics

You have been using Google Analytics to track visitors (or page views) on your website but did you know that the same analytics service can also be used for tracking views inside Google Spreadsheets. You insert a little snippet of tracking code inside your spreadsheet and when someone opens the sheet, that visit will be recorded permanently in your Google Analytics account.


Google Analytics provides a JavaScript snippet that can be inserted into web templates for tracking visits. You cannot insert JavaScript inside the cells of a Google Spreadsheet but we can use the IMAGE function combined with some Apps Script to enable tracking inside spreadsheet. The visit is recorded as an “event” and not a “page view” and thus your spreadsheet opens will not artificially inflate your Google Analytics reports.

To get started, go to your Google Analytics dashboard and make a note of the Google Analytics tracking ID which is a string like UA-12345-67. This web tutorial explains how you can locate the ID inside your Analytics dashboard.

Now open any Google Spreadsheet that you wish to track and go to Tools, Script Editor and copy-paste the following code. This is a custom Google Spreadsheet function that will embed the 1×1 tracking GIF image in our spreadsheets.

 * Track Spreadsheet views with Google Analytics
 * @param {string} gaaccount Google Analytics Account like UA-1234-56.
 * @param {string} spreadsheet Name of the Google Spreadsheet.
 * @param {string} sheetname Name of individual Google Sheet.
 * @return The 1x1 tracking GIF image
 * @customfunction

function GOOGLEANALYTICS(gaaccount, spreadsheet, sheetname) {
  * Written by Amit Agarwal 
  * Web: 
  * Email: 
  var imageURL = [
    "&tid=" + gaaccount,
    "&cid=" + Utilities.getUuid(),
    "&z="   + Math.round( / 1000).toString(),
    "&ec="  + encodeURIComponent("Google Spreadsheets"),
    "&ea="  + encodeURIComponent(spreadsheet || "Spreadsheet"),
    "&el="  + encodeURIComponent(sheetname || "Sheet")
  return imageURL;


Save the code, close the Apps Script editor window and return to the spreadsheet.

Click an empty cell and insert the following formula. The cell will be blank but it contains an embedded image. You may want to change the background color so it is easy to figure out which cell in the spreadsheet contains the tracking formula.

Google Formula

The GOOGLEANALYTICS() formula takes 3 parameters – the analytics ID, the spreadsheet name and the sheet name. This helps if you would like to separately track individual sheets inside a spreadsheet.

Now open the spreadsheet in a new browser window and go to Google Analytics, Real Time, Overview to test if the tracking is working. It may sometimes take a minute to record the visit. If you would like to see all the visits, go to Behavior – Events – Overview and click on the Google Spreadsheets category.


Also see: Track Gmail Messages with Google Analytics

The tracking would work even if the user has enabled ad blocking and that’s because Google Spreadsheets, like Gmail, serves images through a proxy server. The downside is that you will never know the location of the visitor since all visits will be show up as United States (the location of Google servers).

The story, How to Track Google Spreadsheet Views with Google Analytics, was originally published at Digital Inspiration by Amit Agarwal on 09/03/2016 under Google Analytics, Google Docs, Internet.

How to Make eBooks with Google Docs

Adobe PDF may be the most popular document format on the web but there’s a reason why eBook lovers prefer the ePub format over PDF. PDF documents have a static layout with fixed page breaks but the layout of an ePUB document is “responsive” meaning it will automatically adjust for different screen sizes.

You can read an ePub book on your desktop or inside the Google Play Books app on your Android phone and they’ll look good. Also, since ePub files are essentially HTML5 documents under the hood, the text size and font family can be easily adjusted for an improved reading experience.

Download ePUB ebooks

How to Create your ePUB eBooks

Adobe Stanza and Calibre are popular desktop software for  creating ePub ebooks but now can now easily make one in the browser using Google Docs itself. Just write a document in Google Document, or upload an existing Microsoft Word file to your Google Drive, go to File menu and choose download as EPUB publication.

Here’s an ePUB version of this article, generated with Google Docs.

You get an ePub file that you can copy to your mobile phone or, better still, upload the ePub to the Google Books website and access the ebook from anywhere. You can even read it in the browser. To upload an eBook to Google Books, go here and click the Upload Files button. The files are only visible to you.

ePub files are readable on iPad, Nook and Google Play books. Amazon Kindle doesn’t support the ePub format but there’s an easy way to convert ePub into MOBI format that is supported by Kindle.

The story, How to Make eBooks with Google Docs, was originally published at Digital Inspiration by Amit Agarwal on 08/03/2016 under Convert, Epub, Google Docs, Internet.

How to Use Github for Hosting Files

Github, in simple English, is a website for hosting source code. The site is built for programmers and, if you are not one, it is highly unlikely that you have ever used Github. Repositories and Forks, the basic building blocks of Github, may seem like second-nature to developers but, for everyone else, Github continues to be a complicated beast.

Github isn’t just a place for developers though. The site can be used a writing platform. It can host HTML websites. You can use Github to visually compare the content of two text files. The site’s Gist service can used for anonymous publishing and as a tasklist. There’re so many things do on Github already and you can how use it as a free file hosting service as well.

How to Host Files on Github

It takes few easy steps to turn your Github into a file repository. You can upload files from the browser and you can add collaborators so they can also upload files to a common repository (similar to shared folders in Google Drive). The files are public so anyone can download them with a direct link. The one limitation is that the individual files cannot be larger than 25 MB each. There are no known bandwidth limits though.

Step 1: Go to and sign-up for a free account, if you don’t have one. Choose the free plan as that’s all we need for hosting our files.

Step 2: Click the “New Repository” button, or go to, to create a new repository for hosting your files. You can think of a repository as a folder on your computer.

Github for File Hosting
Step 3: Give your repository a name and a description and click the Create button. It helps to have a description as it will help others discover your files on the web. You can have Private repositories too but that requires a monthly subscription.

Step 4: Your repository will initially be empty. click the Import Code button on the next screen to initialize the repository.

Import code into Github
Step 5: Paste the URL into the repository field and click Begin Import to create your Github repository for hosting files.

Upload Files to Github

Your Github repository is now ready. Click the Upload Files files button and begin uploading files. You can drag one or more files from the desktop and then click Commit Changes to publish the files on the web. Github will accept any file as long as the size is within the 25 MB limit.

Github has a built-in previewer for PDF, text and image files (including animated GIFs) so anyone can view them without downloading the actual file. Else there’s a simple URL hack to get the raw (downloadable) version of any file hosted on Github.

Upload Files to Github

Direct URLs for Github Files

After the file has been uploaded to Github, click the filename in the list and you’ll get the file’s URL in the browser’s address. Append ?raw=true to the URL and you get a downloadable / embeddable version.

For instance, if the file URL is, the direct link to the same file would be If the uploaded file is an image, you can even embed it in your website using the standard img tag.

Here’s a sample file repository on Github. The T-Rex image is here and the direct link is here. You can go to the Repository settings and add one or more collaborators. They’ll get write access to your repository and can then add or delete files.

The story, How to Use Github for Hosting Files, was originally published at Digital Inspiration by Amit Agarwal on 22/02/2016 under Embed, Upload, Internet.

How to Make Org Charts with Google Sheets

Do you need a quick organization chart to show the hierarchy of employees in your business? Well, just open a blank Google Spreadsheet, put the employee names in a column and your org charge should be ready in minutes. Here’s a sample org chart created with nothing but Google Sheets.

Org Charts with Google Sheets

Create Organizational Charts with Google Spreadsheets

Here’s how you can put together an org chart in Google Sheets. It will be a live chart meaning as you update the employee names or hierarchy in the spreadsheet, the org chart would update itself. Let’s get started.

Step 1. Open a Google Sheet and put the employee names in column A and the names of the immediate managers in Column B.

Step 2. Select the cells that you’ve just entered and choose Chart from the Insert menu in the spreadsheet.

Step 3. The Chart Editor will open inside Google Sheets. Switch to the Chart Types tab and uncheck the option that says “Aggregate Column A.” Then scroll down the list of available chart types, choose “Organizational Chart” and click Insert to add the chart into your spreadsheet.

Organization Charts

Unlike flowcharting tools like Visio, you don’t have enough formatting options for org charts in Google Sheets except for changing the background and fill colors of various nodes in the chart. And if you hit the little drop-down arrow in the chart box, you’ll see an option to download the charge as a PNG image for embedding on other websites.

The story, How to Make Org Charts with Google Sheets, was originally published at Digital Inspiration by Amit Agarwal on 22/02/2016 under Charts, Google Docs, Internet.

How to Add Speech Recognition to your Website

Open the Google website on your desktop computer and you’ll find a little microphone icon embedded inside the search box. Click the icon, say something and your voice is quickly transcribed into words. Unlike earlier speech recognition products, you no longer have to train the browser to understand your speech and, for those who don’t know touch typing, speech is often a faster mode of input than the keyboard.

Sounds like magic, right? Well, did you know that you can also include similar speech recognition capabilities to your own website with a few lines of code. Visitors can search your website, or even fill forms, using just their voice. Both Google Chrome and Firefox browsers support the speech recognition API.

Web Speech Recognition

Before we dive into the actual implementation, let’s play with a working demo. If you are viewing this page inside Google Chrome (desktop or mobile), click the voice icon inside the search box and say a search query. You may have allow the browser to access your microphone. When you are done speaking, the search results page will open automatically.

Add Voice Recognition to your Website

The HTML5 Web Speech API has been around for few years now but it takes slightly more work now to include it in your website.

Earlier, you could add the attribute x-webkit-speech to any form input field and it would become voice capable. The x-webkit-speech attribute has however been deprecated and you are now required to use the JavaScript API to include speech recognition. Here’s the updated code:

<!-- CSS Styles -->
  .speech {border: 1px solid #DDD; width: 300px; padding: 0; margin: 0}
  .speech input {border: 0; width: 240px; display: inline-block; height: 30px;}
  .speech img {float: right; width: 40px }

<!-- Search Form -->
<form id="labnol" method="get" action="">
  <div class="speech">
    <input type="text" name="q" id="transcript" placeholder="Speak" />
    <img onclick="startDictation()" src="//" />

<!-- HTML5 Speech Recognition API -->
  function startDictation() {

    if (window.hasOwnProperty('webkitSpeechRecognition')) {

      var recognition = new webkitSpeechRecognition();

      recognition.continuous = false;
      recognition.interimResults = false;

      recognition.lang = "en-US";

      recognition.onresult = function(e) {
                                 = e.results[0][0].transcript;

      recognition.onerror = function(e) {


We have the CSS to place the microphone image inside the input box, the form code containing the input button and the JavaScript that does all the heavy work.

When the user click the mic image inside the search box, the JavaScript checks if the user’s browser supports speech recognition. If so, it waits for the transcribed text to arrive from Google servers and then submits the form.

The Dictation App also uses the speech recognition API though it writes the transcribed text to textarea field instead of an input box.

Some notes:

  1. If the HTML form / search box is embedded inside an HTTPS website, the browser will not repeatedly ask for permission to use the microphone.
  2. You can change the value of the recognition.lang property from ‘en-US’ to another language (like hi-In for Hindi or fr-FR for Français). See the complete list of supported languages.

The story, How to Add Speech Recognition to your Website, was originally published at Digital Inspiration by Amit Agarwal on 19/02/2016 under Speech Recognition, Software.

Wow, It’s Been a Long Time: Where Am I Now?

oliverIt’s pretty amazing how quickly time flies. It’s been nearly a year since my last blog post, where I had all of these grand ideas of where I was heading next.

Sure enough, not much has happened with my online business.  I’m still focused on my day job and other offline obligations in my life, but I continue to keep on eye on my return to blogging and building a business online.

It’s not really fair to say I’ve been working at this for years, because the truth is, it’s been a few years since I’ve really put in any effort here.

That’s not to say there haven’t been some exciting things going on, so if you’re still with me here, I’ll explain.

So, What’s New?

Although I haven’t been blogging or working on my online business in general, here are some of things that have happened in the past year:

1) Celebrated my first anniversary with my wife.

Married since November 2014, my wife and I recently celebrated our one year anniversary.

Married life has been great so far! I can’t really say a ton has changed, because we’ve lived together for quite awhile and, all in all, have been together for about 12 years now.  😀

2) Got a new puppy (pictured above).

About 6 months ago, my wife and I adopted a puppy! His name is Oliver, he’s a beagle/lab mix, and is definitely a handful.

Even though I grew up with dogs most of my childhood, I never realized how much work they could be.  Gone are my mornings before heading work, sipping coffee and playing around (sometimes working) online.  Now I’m feeding Oliver, walking him, and playing with him a bit while I rush to get ready to go to work.

I guess the time management challenge is good practice for having a child…

3) Sold!

As some of you may remember, I spent nearly a year (a few years ago) building a site, The Daily Interview.  I put a ton of work into it, ultimately completing and publishing over 100 interviews with some incredibly interesting and inspiring internet entrepreneurs.

While I never got to the point of monetizing the site before stopping my work on it, it remained a great collection of valuable content.

Late last year, I was approached by someone who was interested in purchasing the site and bringing it back to life.  I’m happy to say, I successfully sold the site for a mid-4 figure amount.

As of this writing, they haven’t yet begun work on it, but all of the content I created is still live. Considering all the work I put into it, and the fact that I never made much money from it before, I was thrilled to be able to reap at least a little bit of a financial reward.

I’m confident that the team who purchased the site will be able to turn it into a great success if they are able to dedicate a bit more time and attention to it than I was able to.

4) Continued to earn $300-500/month passively.

Even though it’s been years since I’ve done any real work online, I still continue to earn up to $500/month from sites and content created a long time ago.  It’s amazing that the work from a long time ago is still paying off today.

If you’re on the fence about starting a blog or building up some passive income streams, now is the time start.  Even if you’re barely successful (like me), there’s still plenty of long term benefits for putting in hard work now.

What’s Next?

I’m not going to make any specific “promises” about what’s coming next, because I have a tendency to announce projects before I’ve actually committed to working on them.

However, I am working on a new “authority” site in a very competitive niche that I think has a lot of potential if I’m able to put the time into it.  I’ve got an initial plan to publish 100 pieces of content by the end of 2016.

It’s ambitious, but I’ve already made some progress:

  • Mapped out 60 article titles
  • Created 20 article outlines
  • Began actually writing 5 of those articles
  • Completed 2 articles, and published one.

It’s a long road, and I know my track record isn’t great when it comes to ambitious goals for my online business, but if I can achieve even 50% of my goal, it’ll be a great start.

If you still read this blog, what are you up to these days?  I’d love to hear from you in the comments below.


Thanks for subscribing to my feed! For more great content, check out my Muse Creation Newletter for tips, tricks, and ideas that I won't share on my blog.

Also, follow me on Twitter!

Thanks again!

Wow, It’s Been a Long Time: Where Am I Now?