Sync Facebook Birthdays to Google Calendar: Hard Mode
Life is a DIY-Project

Facebook’s Birthday Calendar had been a lifesaver. Remembering some birthdays is okay and doable. However, remembering every birthday of every acquaintance is one, unnecessary and two, not expected.
It does feel nice to receive an unexpected birthday text, and so, I like to send them too. That’s precisely why I had my Facebook Calendar’s Birthday channel synced to my Google Calendar.
It was easy to set it up then. All you needed to do was get a Calendar URL from Facebook specifically for Birthdays and then, add that as a Google Calendar on the web interface of the same.
Enter last Monday when all birthdays disappeared. Coincidentally, I was praising the entire process on the previous weekend itself. It was disappointing, and I felt borderline betrayed.
I double-checked Facebook’s Event Page, and the calendar they now provide is only for Facebook Events, that is, no birthdays anymore.
The Hunch
Facebook has to bring that data from somewhere when you load the page. So, I, along with a friend, got to fiddling with the NetworkRequests
on facebook.com/events/birthdays
.

As you scroll down on the Birthdays screen, to populate a box for whatever month is supposed to come next, a request pops up in the XHR
section.
The easy way to identify it is to look for ?date=

That’s it! The parameter will be followed by a large number, which is nothing but the Epoch timestamp of the month’s first day.
This parameter will come in handy later, so let’s just put a pin on it.
The next step was to look at the response and fetch it. So, we decided to check the Response
being sent after clicking on the request.
Hold On A Second
It was unexpected. There was no standard data format, just HTML. It was pre-rendered/compiled, and so, this wasn’t as easy as it might have looked in the first go.
Upon scanning the HTML’s content, we realised that each element has a property called data-tooltip-content
which has both the Full Name
and the Birthday
without year for each person whose birthday falls in that month.
Not a problem. A simple RegEx expression can do the job of finding such patterns.
([a-z0–9 ]+)(\([0–9]*\\\/[0–9]*\))
Easy does it. This will give us a name, followed by their birthday. For example,
John Doe (01\/01)
Let’s Do This
Now that we have everything. The next step was to pull this off using a simple Python script.
But before we embark on the journey, let’s fill our backpack with things we’d need.
- The
Request URL
from the Network call. This is easy. Once we click on the?date=
request, we’ll be in theHeaders
tab. TheRequest URL
is in theGeneral
section. - Scrolling down to the bottom in the same box will give us the
Request Headers
. We need these to make their servers believe that we’re logged in. - Remove the
accept-encoding
parameter. This makes sure that the response we receive is plaintext instead of encoded. - Finding the Epochs for each month for 2019:
1546300800, 1548979200, 1551398400, 1554076800, 1556668800, 1559347200, 1561939200, 1564617600, 1567296000, 1569888000, 1572566400, 1575158400
Geronimo!
We’re all set now. Let’s do this. To help you out, here’s a GitHub gist.
There are a few things you need to do for the script to work, though.
Here’s a list of modifications you need to make.
- Replace
YOUR_URL_HERE
with yourRequest URL
found using the method shown earlier. - Replace the
headers
section with the values from yourResponse Headers
. - Remove the numeric value that looks similar to those in the
epochs
list and replace it with{}
for it to be formatted in the loop. - All set, the script should produce a .csv with data for the next five years.
- This count can be changed by changing the
range
in thefor
loop down toward the end of the code.
What Now?
The final step is to go to Google Calendar from a web browser and do the following.
- Scroll down, find
Other Calendars
in the sidebar and click the+
button beside it. - Click
Create new calendar
. Fill in theName
and theDescription
and hitCreate calendar
. - Then, in the same
Other Calendars
screen, clickImport & Export
on the sidebar. - Upload the
.csv
file, and select the calendar you just created from the drop-down. - Click on
Import
.
That’s All Folks!
The Birthdays from your Facebook should be in your Google Calendar now.
This may not be in live-sync, but it’s not that hard to redo the entire process now and then if your script is ready.
That is until Facebook stops breaking the perfectly good things about their platform.