I'm trying to get my bot ask the user for file attachment or images. Is there a way I can call the image attachment or file attachment command from a facebook messenger button?
Unfortunately, this isn't possible yet with FB Messenger. The best way to deal with this scenario just asks the user attach a file manually (by clicking on the attachment button on the messenger). You can then create a command to catch the attachment and parse.
Step 1: Code the bot to ask "Please upload your attachment".
Step 2: User clicks on attachment button, attach file
Step 3: Code the Bot to catch the file and parse
If any changes to the Messenger that supports this, I'll update this post.
Related
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.
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!
I am developing a e-commerce project using django.It is a image based project where user can download image after subscription.
There is a single image download subscription package available to the user where user can only download an image for a single time.My home page have an image thumbnail.
If any user wants to download any image ,he can click on the selected image and then will take the user in the image detail page of the clicked image with download button option.If he subscribed,he can download the image.
Though its a single image download subscription,so user can only download a single image.but the problem is,after a single download,if the user don't leave the page,he is able to download the same image for an unlimited time.I want to restrict it but i have no idea how to do this in django.
After a single download,redirecting the user to the home page or my image thumbnail page can be solution,but i don't think it will be great idea.Because there will be a possibility to disconnection of internet or something right after the download event which will create situation where may be the user can not complete the download action.
so i want to settle the user in the image download page after a single download and immidietly wants to clear the session and restrict him to download the same image for unlimited time.
Can it be possible to clear the session after a single download,i think if i can clear the session after a single download or an event or whatever you say,then the user can not download the image for twice.Is it possible to clear the current session after an event in django?
I'm trying to piece together information and different chunks of code scattered throughout the documentation on how to make this happen, since there aren't good examples.
I know I have to first get the create_event extended permission which I get with this code:
FB.login(function(response) {
// handle the response
}, {scope: 'create_event'})
;
I know that I also have to issue a HTTP POST request to 'PROFILE_ID/events' with the create_event permissions and the necessary parameters.
My problems are: 1. I don't know how to collect the create_event permission once it is given. If I run the code above, a dialog box will open asking for the permission but once I accept, only a blank page follows.
2. If everything works the way it supposed to with the permissions request and the post request, will my app see a create event page like I would if I were to create an event on my own from my profile? What interface gets seen from the app? Can I take a user from my app directly to the facebook create event page?
I don't know how to collect the create_event permission once it is given. If I run the code above, a dialog box will open asking for the permission but once I accept, only a blank page follows.
That’s how it works. Everything you want to show to the user after successful login, you have to implement yourself.
If everything works the way it supposed to with the permissions request and the post request, will my app see a create event page like I would if I were to create an event on my own from my profile? What interface gets seen from the app?
No “interface” at all – it’s up to you to build that.
Can I take a user from my app directly to the facebook create event page?
The user can go their by themselves. Why would the need your app for that?
Can anyone tell me how this facebook application was able to make 'MemeGen' a link in this post? I have a photo upload application, and everything works great, but I can't figure out how to stick a link like this in the posts.
This is the markup that they managed to get into the message.
MemeGen
Thanks for any help!
That is obviously not a normal photo upload, but an Open Graph action, which publishes a user generated image – https://developers.facebook.com/docs/opengraph/actions/#usergenerated
(And at that, it is in violation of the rules, because actions are only supposed to post real photos that the user publishing the action took at that very moment with his camera – and I doubt that this particular image with text on it qualifies as such.)