I have a mysql database and would like the user to provide information concerning his product(name, description,price) at once without asking by chatting. While reading I found it could be possible to show a user a form using messenger webview but I don't know where to put the form in my botkit project and even how to send the from botkit to the webview.
Asked
Active
Viewed 413 times
0
-
Have you searched for examples? Done any research? Lookup "how to ask a question" on Stackoverflow. – Sloan Thrasher Apr 11 '17 at 07:30
-
@SloanThrasher yes before posting a question I have to make sure that it hasn't been asked, if I couldn't see please can you provide me with the link where the same question is asked or where there is a tip. The problem is I don't understand well the structure or architecture behing a botkit bot. – aidonsnous Apr 11 '17 at 08:20
-
It's not just about whether the question has been asked. It's about _how you ask your question_. Stackoverflow has a great article with lots of helpful info on asking a question so that you get good answers. – Sloan Thrasher Apr 11 '17 at 14:25
1 Answers
0
Url Buttons for the FB Messenger api allow you to load a webpage in a webview from messenger. This page has to be hosted somewhere, or otherwise return html from a GET request to the url.
You would build an html page that has the forms you want the user to fill out, host it on your server, and link to it in a webview button.
More from the Botkit Docs on sending attachments, buttons, and templates to FB.
Sending a webview button with Botkit in FB messenger looks like this:
controller.hears('test', 'message_received', function(bot, message) {
var attachment:{
"type":"template",
"payload":{
"template_type":"button",
"text":"Please fill out your product details",
"buttons":[
{
"type":"web_url",
"url":"https://YOUR_URL/botkit-form",
"title":"Enter Info",
"webview_height": "compact"
}
]
}
}
bot.reply(message, {
attachment: attachment,
});
});

Jon Church
- 2,320
- 13
- 23