Automatically Reply to Facebook Birthday Wishes with Python!

So, let’s say it’s your birthday. You’re super-excited and spend the day having your cake and eating it too. The next morning you log in to Facebook, only to find your timeline completely flooded with birthday posts from all your well-wishers. You want to reply to all of them, but it would take you all day! How do you automate this whole process of liking and commenting on each birthday post without toiling away on Facebook for hours? We turn to our trusty little friend: Python!

Here are the steps to automatically reply to Facebook birthday wishes with Python:

Step 1: Create a Facebook App ID

1. Go to

2. Click on “Add a New App” inside “My Apps”

My Apps

3. From the window that pops up, select Website.


4. Type any name for your app. I just put in “Ashish”.


5. Click on “Create New Facebook App ID”.

6. On the new pop up box, choose any category. I selected “Education”.

Screenshot from 2015-06-21 20:33:18

7. Now click “Create App ID”.

8. Scroll to the bottom of the new page and type in any URL.


9. Hit “Next”.


Step 2: Get an Access Token

1. Scroll all the way to the top of the page and under “Tools and Support” click “Graph API Explorer”. Alternatively, you can just go to

Graph API Explorer

2. Under “Application”, select the application you created in step 1.

Screenshot from 2015-06-21 19:43:37

3. On the dropdown menu to the right select “Get Access Token”.

Get Access Token

4. Click on “Extended Permissions” and tick “publish_actions” and “read_stream”.


5. Now click Okay on these screens.

Popup 1

Popup 2


6. Your unique access token has appeared in the box.

WARNING: Do not give this token to anybody. It allows people to post to Facebook on your behalf.

SAccess Token


Step 3: Set Up the Python Code

1. Download this code and save it as

2. In the configuration section, add in your access code and birthday in the same format as shown.

3. Install Facebook-SDK and ‘requests’. On linux it’s as simple as pip install facebook-sdk requests

(If you don’t have pip, you need to install python-setuptools and install it through easy_install. Just Google “install python pip”)

Step 4: Run the Code

1. Open up a terminal, navigate to the folder where you have and run it with: python2

2. Relax and watch Python do some magic!


If you run into problems in any step, feel free to comment below and I’ll try my best to help you out.

Ashish Acharya
I am an experienced full-stack web developer, specializing in Python and JavaScript, with a penchant for efficient, readable code. I have worked in, as well as led, software development teams and am comfortable within a modern Scrum/Agile-based team setting. I am passionate about automation, GIS, and data science.


Leave a Comment

Your email address will not be published. Required fields are marked *