// This script shows how to send a Facebook custom template message. // The message is sent from inside the script, then an empty template is returned so this is the only response. state Test { pattern "test facebook template" answer facebookTemplate(); function facebookTemplate() { var command = {type:"facebook", attachment:{ "type":"template", "payload":{ "template_type":"button", "text":"What do you want to do next?", "buttons":[{"type":"web_url","url":"https://www.botlibre.com","title":"Show Website" }, { "type":"postback", "title":"Start Chatting", "payload":"start" }] }}}; FacebookMessaging.sendMessage("", conversation.id, JSON.stringify(command)); return Template(""); } }