Send message as user to Facebook Chatbot - facebook

We develop a chatbot based on the Facebook Messenger Platform.
In the middle of the conversation, we do want to show a complex UI as a WebView. When the user clicks on a button in the WebView, it should close the webview and invoke a user-question in the conversation which will be answered by our bot.
I've managed to show the WebView, send back a message to my backend and give an answer to the user.
But how can I create a new message as "the user" out of my WebView?
Sample Dialog:
Bot (in the conversation):
Which hat do you want?
[Button to open hat-selection-WebView]
User (in the WebView):
[Click on a button in the hat-selection-WebView]
User (in the conversation):
I want the green one < How can I create this message here
Bot (in the conversation):
Ok, I'll send it to you soon

You can use "Quick Replies" for this: https://developers.facebook.com/docs/messenger-platform/send-api-reference/quick-replies
The button text will be the message from the user.

Related

Share link & text via Messenger button on webpage

I want to let people click a web page button, which upon clicking should open a Messenger share popup with the link (website) rendered and sharing text pre-filled. User only has to choose Messenger contact.s to share this content with. I haven't found any doc or working example. Who can help please?

How to let a user in "internal Facebook App browser" to like my page without directing to a new page?

When I visit this page (Facebook Like Button official page) in my Facebook browser, the like button is working very gracefully.
It works this way:
1 - Click the "like"
2 - There will be a sparkle animation showing
3 - Then the like action is done
However, when I put the same code in a page of mine, still in Facebook internal browser, after clicking the like button, there's no animation and I am redirected to a new page, in which I'm asked to confirm the like action.
Here is the screenshot of the new confirm box
Is there a way to let the user like my page directly without this "Do you want to like this page" confirm box? I want this feature because people are taking actions on my page and if they are directed to another page, the status of that page is gone.
Thanks for any kind of tips!

"Get Started" button does not appear in welcome screen for FB Messenger bot

I followed the solution in this thread and it is still not working
how to setup "Get started" button in facebook messenger bot and when to send welcome message
I tried both
graph.facebook.com/v2.6/me/thread_settings?access_token=xxxxx
and
graph.facebook.com/v2.6/page_id/thread_settings?access_token=xxxxx
with the raw body
{
"setting_type":"call_to_actions",
"thread_state":"new_thread",
"call_to_actions":[
{
"payload":"USER_DEFINED_PAYLOAD"
}
]
}
The response message is like this
{
"result": "Successfully added new_thread's CTAs"
}
But the message in welcoming screen just keep displaying "Type a message..."
Please help. This is so frustrating. The document on FB developer site is not helpful at all
https://developers.facebook.com/docs/messenger-platform/thread-settings/get-started-button
I found the solution. The "Get Started" button does not appear because I used the users who are not "Tester" for my app ( but the Welcome text appeared that why I confused)
There are a number of bugs/issue that seem to affect if the button appears or not once it is finally set using the POST request, this is what I have found.
You need to delete the conversation on facebook.com chat not messenger.com or mobile App. Click the little gear thing in the chat window to do this.
Once deleted on fb.com the button will appear the next time you try to chat on fb.com and on messenger.com
The button will not appear on any previously used Android Messenger clients after deleting on fb.com
To make the button appear again on Android Messenger client you need to clear the Messenger data/cache under Android Settings -> Apps , this will also clear your login and you need to login again.
I don't have an iOS device.
As says in documentation.
The Get Started button is only rendered the first time the user interacts with a the Page on Messenger.
So, if you has interacted with bot, you newer see this button again.
But, there is livehack. You can delete you chat with bot in web interface and add it again.
Note: Some new users on mobile apps may not receive button on old versions apps.
I think you must register event like image above

how to check who and when clicked facebook like button

I using this to check how many likes are on my website
http://api.facebook.com/restserver.php?method=links.getStats&urls=http://mywebsite.pl
My Question is:
How to check who and when clicked facebook like button on my website?
There is no way to identify users who clicked a Like Button on your external Website, for privacy reasons. You can only see friends who liked the same URL by setting the "data-show-faces" flag in the Like Button Plugin.
You can subscribe to the edge.create event if you want to know when it gets clicked, but this still does not return WHO clicked it: https://developers.facebook.com/docs/reference/javascript/FB.Event.subscribe

Facebook: Get when user clicks like button on fan page

I have created an app that will be used as a tab on my company facebook fan page. I have a new requirement to capture when the user clicks the like button on the facebook fan page and hide a portion of the app page (within the iframe) when the event fires. Although the like button is on facebook's page, is there a way to capture the click event of the like button (ie: javascript sdk) within my app iframe so I can hide appropriate elements?
Like this .... http://www.facebook.com/redbull
Thanks for any and all advice,
B
I found the answer...
How to detect Facebook Like button pressed and trigger event?
I checked the incoming request for fb_sig_is_fan.
I am afraid that this is not possible. Also it makes no sense! because Facebook will reload the page once you click on the like button!