Redirect to FB messanger bot with text message. - messenger

I am redirecting the user from my website to 3rd party FB messanger bot. Let us take an example of a weather bot. The simple workflow is:
1. User click on the bot link .
2. User is on messanger bot page.
3. User types in his city name say Zurich and gets the weather report for it.
In my scenario I already know user's city i.e. Zurich. Is it possible for me to send city name (text message) along with redirect to weather bot so that user does not have to type it. I already looked into send api, but can't figure it out.

If you redirect to the bot with an m.me link you can include the city in the ref param. The ref is delivered to your webhook in a messaging_referrals or messaging_postbacks event, depending on whether the chat is new or existing. The bot can then parse that ref and return the appropriate message.
https://developers.facebook.com/docs/messenger-platform/discovery/m-me-links

Related

Prefill Facebook messenger message or send out to the group

for one client we are trying to prepare solution, that after click on button will send from the users facebook messenger message to the facebook group with details like URL of the product etc.
Generally, I come to the product detail as a user, click on the Contact us button and, it will
Prefill the message with the URL to the product and some message
AND / OR
Send the message to the Facebook group that is responsible for the website the user is sending it from.
Is there any way to do this? I know how to do the opposite way of messaging, from the company to the user, but is it possible to do it this way?

How to use the facebook send dialog but send a message and not a link

Everythin is in the title :
I want people that are on my website to send facebook messages between each others (between respective friends) : they signup on my site with their facebook account, and I know their friends. I just want them to easily talk between them without having to switch to facebook.
Or at least, if that is not possible, I want to open a new tab with their facebook on messenger with a prefilled to: field.
I never imagined this information could be so difficult to find

Facebook Bot: Message Mentioner

I'm trying to build a bot that would message anyone who mentions (#PageName) it. I have set up the mention webhook for my bot so that whenever anyone mentions my page in a comment or post, I receive a notification. Unfortunately, Facebook doesn't make it easy to message the person who mentioned my page, since there are different page IDs and messenger IDs. I am able to fetch the user ID from the mention by fetching the from field from the graph API, but is it possible to convert this user ID to a messenger ID so that I may actually message the user?

Passing a string to Messenger Bot from a link

Facebook Messenger allows us to deeplink to Messenger bots and track the referrer which is pretty useful, having read through the documentation on this I'm left wondering if it is also possible to send a text string to the bot via this method.
i.e a link that opens up the bot in Messenger and sends a text based message just as if the user had typed it themselves.
Can anyone point me in the right direction for this?

How to get the list of friends to whom a user has sent a private msg using the FB send button from my site?

I have a send button integrated on one of the pages of my site and I allow the users to share a link pointing to some private information with their facebook friends using this send button.
Only these friends who have received the message are supposed to access this link. In order to validate this, I want to capture the list of friends & possibly their FB ids to whom the user of my website sends a private FB message using the send button on my website.
Is there a way to capture this list i.e. the list of private message recipients as selected by the user?
Alternatively, is there a way that I provide a multi friend selector from where the user of my website selects the fb friends to whom they want to send a fb message and then using a FB send message api, I send this message - thus achieving the purpose as desired above?
The Send button does not allow you to see which Facebook Users the message was sent to.
You should instead use the Direct Requests Dialog instead:
http://developers.facebook.com/docs/reference/dialogs/requests/#direct_request
You can create your own multi-friend-selector and then use the above dialog to send the requests to friends. You can authenticate the request when the friend clicks on the Accept button. The function returns request and to, which contain the request_id and a array of user_ids, respectively.