The API


A simple GET request

api.friendlyrobot.fr/v2/nicknames/william/email/myemail@gmail.com/company/mycompany

That returns a beautiful JSON :)


{
  "name": "william",
  "gender": "M",
  "nicknames": [
    {
      "nickname": "Bill",
      "intimacy": "1"
    },
    {
      "nickname": "Willy",
      "intimacy": "2"
    }
  ]
}
		


Make sure to fill a working email address

2022 update: I had to switch to v2 because of massive bot DDOS, so the API is no longer anonymous and requires you to fill your email address and company inside the query. Thanks for your understanding, and keep building great stuff 🤙



Just copy-paste this PHP code ;)

NPM and Composer coming soon

// Friendliness powered by www.FriendlyRobot.fr
$firstname = "william"; $email = "john@mycompany.com"; $company = "mycompany";
$curl = curl_init();
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_URL,
  "http://api.friendlyrobot.fr/v2/nicknames/" . $firstname . "/email/" . $email . "/company/" . $company
);
$result = curl_exec($curl);
$nicknamesArray = json_decode($result, true);

// We pick a random nickname
if ($nicknamesArray != null) {
	$rand = rand(0, (sizeof($nicknamesArray["nicknames"])-1) );
	$nickname = $nicknamesArray["nicknames"][$rand]["nickname"];
}
else { $nickname = $firstName; }

// And we print a beautiful friendly message to our user :)
echo "Hey " . $nickname . ", how are you doing today ? :D ";
		


Let's propose new nicknames !

Of course, every first name hasn't a nickname right now. FriendlyRobot is an open API, enriched by the community. So feel free to propose new nicknames :)

api.friendlyrobot.fr/v2/propose/bill/for/william