User's phone number in messenger bot? - facebook

Is it possible to get user's phone number from web hook sent by messenger bot when a user initiates a chat?
I need to check if a user by phone number is existing in my database or not.

No you cannot do it, check it.
https://developers.facebook.com/docs/messenger-platform/user-profile
One system you can apply, when anyone enter the bot first time check the psid in this user exist in db or not, so when if not exist, send a message "Please enter your number", if number match the db then update psid.
So need to access user phone number once time in chatbot lifetime,because when after verification you again insert the chatbot, it shows you verified because your psid then exist.

Related

Is there an API endpoint to see if a phone number is "in service" with our account

I'm new to the Twilio API. I'd like to verify whether a set of phone numbers is "in service" with our account. These are phone numbers like PN0c8XXXX...... and is there a way to send numbers in bulk to be sure that they are associated with our account and in working order? I see a call like this (would Sid be our PN0c8... number?):
GET https://verify.twilio.com/v2/Services/{Sid}
but not clear if this is what we want or if it supports batch mode. Any ideas?
I'm not entirely sure what you mean by verifying a set of phone numbers in "in service" with your account.
However, you can check the details of a phone number in your account using the Incoming Phone Numbers API. If you have a phone number SID, the ID that starts with PN, you can fetch an individual phone number resource by making a request to:
https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers/{PhoneNumberSid}.json
There isn't an API request that allows you to send multiple SIDs, but you can list all your incoming phone numbers and then check against that list in your own code.
As an aside, the URL you asked about in the question is the Twilio Verify API. Verify allows you to verify user's phone numbers over SMS or voice, and can also perform verification via TOTP, push notification or emails. It's meant for verification or two factor authentication.

Use both email and phone number in Account kit together

I am working with facebook Account Kit. During signup, I want the user to verify both email and phone so they can login with either of them. But currently facebook lets only phone or only email for one user id. Is there a way I can use both for a single user?
No, there is currently no way for an email and a phone number to share the same user ID. You would need to handle this yourself by using only one of these values as the user ID, and having an association between these 2 values.

Start conversation without user interaction in Facebook Messenger

Is it possible to send a message to a user without the user interacting with the bot first?
I'm using the following guide to retrieve psids from users that have already connected their profile to an app that I own.
https://developers.facebook.com/docs/messenger-platform/connecting-accounts.
For users that have at least one interaction with a page that I also own, I'm able to get their id. For all other users the endpoint returns an empty array.
Im aware of customer matching but is that the only way to achieve this?
You can't send a message by bot before the user initializes the conversation.
Facebook Messanger Bot permits a standard messages, with a 24-hour interval
to reply to a message initiated by a user. In Some specific cases, Facebook permits to send a message after this time.
A message are triggerd when the user either sends a message to a company or clicks a call button for action in Messenger, or when the user requests a message from a company through a plugin, such as send to Messenger.
Check out the policies here : https://developers.facebook.com/docs/messenger-platform/policy-overview
You are correct, customer matching is your only option for this.
Just learned this today, if you have a user's phone number, you can message them unprompted. You also need the pages_messaging_phone_number permission, which you can only get by paying the $99 customer matching fee.
Check the docs on sending to phone numbers here. Customer matching docs here

Facebook-Like without users logged in?

In my physical store, I have a few tablets available in which I use to obtain shoppers' email addresses. I'll leave them up on a simple web page where they just enter their email address to join my companies email mailing list.
I would like to add the ability for these individuals to also 'Like' my company on Facebook without actually logging into Facebook. My thoughts are that they will not want to log into Facebook via a shared machine due to security concerns and also the added time to log on will deter them from even adding their email address to begin with.
Here is what i am thinking...I was hoping to send the 'Like' update to their account based on the email address that they provided without actually loggin on. Can this be achieved?
Thanks for your time.
No, the user must be logged in to send requests to facebook on their behalf

How to get email of a face book account

I have an android application which need the email address of the face book logged in candidate.
My application works as follows
the user can log in to my application using his face book account. After logged in he can select some items and clicks on OK button. When the user clicks the button ok we need to send an email to his "email address" telling that the details of the items he selected.
I am able to get the first_name and Last_name values but i also need the email address.
can any one tell me how to get the email.
You need to get Facebook extended permissions for that. Specifically you need the email extended permission.
Here's the link to the documentation where you can take a look at all Facebook's permissions you can use in its API.
When you authenticate, just make sure scope contains email like this:
https://www.facebook.com/dialog/oauth?
client_id=YOUR_APP_ID&redirect_uri=YOUR_URL&scope=email,read_stream