Get gender of user on Facebook

When user talk to my bot on Facebook, I want to know their gender in order to call them she or he. So, how can I do it.

Thank you./

The part of getting the gender from Facebook is completely and only related to Facebook and not Rasa.

Once you got that gender, you somehow need to find a way to secretly send a payload (again it depends on Facebook only) like /inform{"gender": "male"} to Rasa, which will then force parse the entity gender and save its value in a slot.


If there’s no way to automatically send messages or metadata from Facebook, you could still ask the user their gender and give them buttons.

Also, happy new year :partying_face:

1 Like

Hello @mai_bui Can you tell us about your use-case and why you need to find the user gender ? In the AI conversational Design/Dialogue we not asked the gender’s of the user (Eliminating Gender Bias) and vice-versa, that’s why bot only asked the name of the user and later use the same in conversation, I’d also recommend to only stick with the generic process. Further, as Chris suggested and recommended you can follow any approach.

Tip:

1.If you still want to stick please see this blog and try use that code: Machine Learning — Gender Identifier with NLTK in less than 15 lines of code | by Abhishek Jain | Medium

  1. You can even collect the user Title, Name and Last Name in the start of the conversation and then you can addresss them with Mr. X OR Ms. Y or Dr. X etc etc.

I hope this will help you.

@nik202 I don’t think they want to do something complicated with the gender like NLP and such.

They just want to know the gender so that the bot says “he” or “she” when referring to the user:


If they have access to this information, they surely have access to the gender as well, as all of these are stored in Facebook. The only thing they need to do is find a way to send metadata (e.g. gender) from Facebook to Rasa.

@ChrisRahme It’s my suggestion as I have never seen so far in chatbot development that Bot is asking the Gender of the user? OR referring the user with “he” or “she”. I have only explored the chatbots using the user names.

That’s what I suggested in my 2nd point that you can collect the title and in this post, they just asked “I want to know” so it means they don’t have any prior information of the user details OR if user chat with the “as Guest” and don’t want to share the information? You can not acess the any user information without the concern (Its GDPR Compliance) : Ref: Permissions Reference - Graph API - Documentation - Meta for Developers | https://developers.facebook.com/docs/development/release/individual-verification

And I guess they are integrating rasa with Facebook (Facebook Messenger) so I guess everything much depends on Rasa in this case or they need to explicitly ask the user information for the same.

mai_bui It’s your call what you want to do and I have just given my honest suggestions :slight_smile: . Good Luck!

2 Likes