i'm creating a registration code for users to a facebook messenger bot i am writing. instead of asking them to open a chat with my bot, and type in the registration code, i would like to provide them a link that will open their facebook messenger on a chat window with my bot, and send the registration code automatically.
i saw a link that opens the chat window (https://m.facebook.com/messages/compose?ids=USER_ID) but can't get it to send a message too.
if you know how to do that, or have an alternative suggestion, i would appreciate the help.
Messenger Links use a Page's username to create a short and memorable link (m.me/username) that, when clicked, opens a conversation with the business in Messenger. Messenger Codes work in the same way.
Open Messenger and tap your profile picture in the top left corner of the screen. Scroll down to find your username link. Tap your username link and then tap Share Link from the list of options that appears. Select how you want to share your username link (text, email, etc.)
Check out the new referral webhook-reference. It gives you a way to link users directly to your bot with support for passing arbitrary parameters via the link.
So a possible approach would be:
messaging_referral
event.m.me
link to include the registration code in the ref
param e.g http://m.me/mybot?ref=REGISTRATION_CODE
. if you're interested in security you might consider encrypting the code
messaging_referral
event at your webhook with a payload similar to{
"sender":{
"id":"USER_ID"
},
"recipient":{
"id":"PAGE_ID"
},
"timestamp":1458692752478,
"referral": {
"ref": "REGISTRATION_CODE",
"source": "SHORTLINK",
"type": "OPEN_THREAD",
}
}
ref
value and send your desired feedback to the user.Every messenger app use it's own link. For facebook https://m.me/XXXXXXXX
where XXXXXXXX - page name.
I always use https://msng.link/fb-messenger.html for generation FB link. Better to remember one website and genereate all messengers what you need.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With