Automatic Facebook replies using Gmail
Yesterday I noticed that you can reply to your Facebook notification emails to answer wall posts and messages. Since I have decided not to use Facebook as actively as I used to now that Google+ is around, I thought I should use this feature to send an “out of Facebook” response to my Facebook friends.
Here’s how you do it, using canned responses and filters in Gmail:
- To be able to send automatic replies in Gmail, you need to enable the “Canned responses” feature. Look in Gmails settings → “Labs” tab and make sure it’s enabled. Don’t forget to save your changes.
- It’s time to create the automatic response. Start writing a new email. I wrote something like “Automatic reply: I have not been using Facebook very much lately. Please come see me at Google+ instead!”. Now, click the “Canned responses” menu (just below the subject line) and select “New canned response…”. Select an intelligent name for your response.
- Now you need to find out which email address your notification comes from. Look in your inbox for a Facebook notification and look at the sender’s email address. It should look something like this: notification+xyz@facebookmail.com where xyz is a seemingly random string. Copy this address.
- To tie it all together, create a new filter (there’s a link to the right of the search box). Enter the following settings:
From:update+xyz@facebookmail.com OR notification+xyz@facebookmail.com(where xyz is the value you found in the previous step)
Subject:"new messages from" OR "new message from" OR "commented on your wall post" OR "posted on your wall" - Click “Test search” to see if your filter matches the notifications you want to reply to. If it doesn’t, chances are that you don’t have English as your current language setting on Facebook. Either change it on Facebook or enter the equivalent subject lines in your language.
- Final step: Click “Next step” and check the box next to “Canned response”. Select your message and save your filter.
Note: You can remove any of the strings in the subject line filter, to match only the kinds of notifications that you want to reply to.
Emacs, Facebook and lisp
I’m still learning new stuff in Emacs every day. It’s probably one of the main reason why Emacs is my favourite text editor; it’s just plain fun.
I happen to know a little Lisp, which come in handy sometime. Changing or extending the behavíour of a program is seldom easy, fun or even productive. Emacs is of course an exception. Once you know the basics you can do pretty much whatever comes to mind.
Today I made my first attempt at building an “interactive” function. A function that you can run by entering M-x function-name, that is. It’s called facebook-log-fix and I needed it because I really like saving my online conversations. Pidgin does this for me most of the time but when I chat on Facebook I need to save them myself. The problem is that Facebook’s stylesheets takes care of the layout of the chat, so when you simply copy the conversation to a text editor it gets all jumbled up. This simple little function takes care of this for me. Maybe you’ll like it, or just learn something about how to modify Emacs a little. Please tell me if you have got any suggestions for improvements — I’m a pretty big noob when it comes to lisp and Emacs.
Here it goes, just paste it into your .emacs file or whatever.
(defun facebook-log-fix nil "Make proper adjustments to a cut'n'pasted Facebook chat" (interactive) ; make the function available to the user (message "Trying to cleanup Facebook chat") (save-excursion ; restore stuff (point, mark and current buffer) when done ; Fancy regexp: (name)\n((anything+\n)*?[non-greedy])(time of day) (replace-regexp "\\(.*?\\)\n\\(\\(?:.*\n\\)*?\\)\\([0-9][0-9]:[0-9][0-9][a|p]m\\)" "\\3 \\1 \\2\n" nil 0 (buffer-size))))