Trigger User Action from Facebook Messenger Bot - facebook-graph-api

I have a working Facebook messenger bot.
From the Messenger app, I would like my bot to trigger the "camera" action (to snap a new picture or video) for the user.
To clarify with a hypothetical context, I would create persistent menu action which mimics the behavior of clicking the "camera" button under the message text area.
I looked into the "Page Call To Action" operation of the Graph Api but could not find parameters that would produce the desired behavior.

Here is the solution to your problem.
In Facebook Messenger, you can open a webview and load a webpage. But remeber that good old HTML 5 provides us with a simple way of asking the user to use their camera when they are on mobile.
These steps below work today
You can use a url button to open a webview as such
"buttons":[
{
"type":"web_url",
"url":"https://url_to_your_webpage",
"title":"View Item",
"webview_height_ratio": "compact"
}
]
In your webpage, include this HTML5 element that allows user to take image via camera on mobile
<input type="file" accept="image/*" capture="camera" />
Submit the image to your servers, close the webview, and do any processing required. For example you can now send the image back to the user from your bot.

I'm pretty sure there is no way to do what you want, right now. Hopefully, in the future, the Messenger team will add more features like this to bots.

You can simply send a message to the user to click on the camera icon, click the picture and send it to the bot. You can then receive that image as the attachment -> read 'Message with image attachment' and reply to the user. This will be more of the native experience. In webview the user can deny permission to the camera (if asked for). Hope this helps!

Related

How to set welcome message for messanger chat bot build using AWS Lex

I built a chat bot for my project using AWS Lex and then I integrated it with Facebook Messenger. After integrating with Facebook Messenger my chatbot interface looked like this.
In the image you can see when some open the messenger he will get suggestions like "Where are you located?" or "What are your hours?" etc. by default.
Expected output: I want instead of these default suggestions messenger should display customized message like "Hello welcome".
You can create a customized greeting from your Page that will appear in Facebook messages and in the Messenger app for iPhone, iPad and Android when someone begins a conversation with your Page for the first time. Your Page's greeting will appear before any messages are sent.
To create a Messenger greeting:
Click Settings at the top of your Page.
Click Messaging in the left column.
Next to Show a Messenger greeting, click to select On.
Click Change, edit the greeting, then click Save.

how to get a welcome message in aws lex chat bot

I am creating a chatbot using amazon lex.
There is a use case for which I have to display a welcome message like 'Hello my name is LexC. How can i help you?'
How can I implement this? This message should be displayed without user type anything, so basically without invoking any intent.
Your Lex bot cannot display a "welcome" message without any prompts from the user. You would have to implement this functionality on the client side where the bot is integrated.
Since you mention that you're using the bot inside your web/mobile app, you can implement your own code to simply show a message to the user once your chat UI loads up in the app. For Slack however, you would have to look into their docs to see if something like that can be configured.
If you are trying it to do with Facebook Page, Then you can do this by following steps:
You can create a customized greeting from your Page that will appear in Facebook messages and in the Messenger app for iPhone, iPad and Android when someone begins a conversation with your Page for the first time. Your Page's greeting will appear before any messages are sent.
To create a Messenger greeting:
Click Settings at the top of your Page.
Click Messaging in the left column.
Next to Show a Messenger greeting, click to select On.
Click Change, edit the greeting, then click Save.

Facebook Chatbot How: Programmatically get notified when call_to_action button on Facebook Page clicked or selected

Hi facebook builders :)
Do you guys know how to get notified every time users click on call_to_action buttons? Those buttons are visible at many places in facebook page for example: on page, under post, under photo on mobile devices <- this is new since about a week!...
Currently, when user click on "Send Message", they are leaded to Facebook Messenger without our webhook-backend to be notified.
It would be great if we can catch the event!
Thank you

like and subscribe button conflict?

I have a like button on my website, which has a corresponding FB page and App. The like button is functional and has been for a while. I recently decided to add a subscribe button to my webpage, so that users could get updates on our content, posted directly to their wall, if they chose to. However, although I have generated the subscribe button code directly from the FB developers page with the correct App ID, the subscribe button does not show up or function when the code is inserted into my webpage. I am not sure if this is a conflict with the pre-existing like button. I have tried all 3 variations of the subscribe button, but none of them are showing up when tested locally or on the server.
So, first, please clarify if the subscribe button would indeed allow subscribers to get updates from our FB page that they subscribe to. And if that is the case, why can I not activate it on my website?

fblike api of facebook

hi i am using fblike api of facebook. this is working fine. i am using this script
when i open this page a text "fblike"and facebook icon are showing.but when i click on this a popup window opens and asking for login on facebook.
my question is that when user like this page the text which is display previously "fblike" change to "1 person".
can i stop this. i just want when user like this the texe should not be change.
I can do this or not?
Short Answer: You cant do that... :)
But you can achieve this by adjusting height and width of STANDARD LIKE BUTTON which will hide other part of that plugin (users, counter, etc) :)