I might have your number from Facebook

gibbs nguyo
2 min readDec 6, 2016

--

Don’t you just love Safaricom and Airtels Customer Service on Facebook. Just comment your problem on their facebook pages and in a matter of minutes your query is solved. Well, faster than trying to call their service lines. So many people will post their troubles with their phone numbers. I don’t blame them. A customer in pain will do anything to resolve their issues without even thinking about the side effects.

This got me thinking. mmh.. How many phone numbers can i get from these pages.

Using facebook api, I was able to get Safaricom’s Page Comments

From the comments I just searched for messages with 07********.

// Replace "+254" with "o"
message = message.replace(/\s/g, '').replace('+254', '0');
// Find all numbers with 07********
var regex = /07\d{8}/g;
var m;
var phones = [];while ((m = regex.exec(message)) !== null) {
if (m.index === regex.lastIndex) {
regex.lastIndex++;
}
m.forEach((match, groupIndex) => {
phones.push(match);
});
}
// Save the numbers
phones = _.uniq(phones)
return phones;

Created a script to fetch and save the numbers.

Script that filters through the comments

So far i have found 75,000 numbers. People should learn to inbox their numbers instead of posting as a comment.

--

--