Open Abgaryan opened 6 years ago
You should create a Card Component for your widget
@adantoscano how should I create it, is there any documentation reference?can you show some example, please ?
In this project, public/ folder is for Widget purposes and you're free to customize it. Take a look how quick replies works in public/client.js and try to do the same with cards.
//client.js
that.on('message', function(message) {
that.clearReplies();
if (message.quick_replies) {
var list = document.createElement('ul');
var elements = [];
for (var r = 0; r < message.quick_replies.length; r++) {
(function(reply) {
var li = document.createElement('li');
var el = document.createElement('a');
el.innerHTML = reply.title;
el.href = '#';
el.onclick = function() {
that.quickReply(reply.payload);
}
li.appendChild(el);
list.appendChild(li);
elements.push(li);
})(message.quick_replies[r]);
}
Start adding if(message.attachment)
and do magic below :smile:
Hope this helps you
@adantoscano what about webViews? is three webView available currently?
That's maybe harder...
Fast way: open link in other tab <href target="_blank" ...
Pretty harder way: insert an iframe into the widget but you have to add close buttons and so on
I used Botkit for FB bot ,this is code from FB bot, how can you create templates like this for Web bot?