Facebook Messenger Bot Persistent Menu <p>I am generating my first bot working with node.js and heroku but finding some difficulties to understand the persistent menu functionalities. </p> <p>Question 1) How do can I attach event as callbacks? </p> <pre><code>function persistentMenu(sender){ request({ url: 'https://graph.facebook.com/v2.6/me/thread_settings', qs: {access_token:token}, method: 'POST', json:{ setting_type : "call_to_actions", thread_state : "existing_thread", call_to_actions:[ { type:"postback", title:"FAQ", payload:"DEVELOPER_DEFINED_PAYLOAD_FOR_HELP" }, { type:"postback", title:"I Prodotti in offerta", payload:"DEVELOPER_DEFINED_PAYLOAD_FOR_HELP" }, { type:"web_url", title:"View Website", url:"https://google.com/" } ] } }, function(error, response, body) { console.log(response) if (error) { console.log('Error sending messages: ', error) } else if (response.body.error) { console.log('Error: ', response.body.error) } }) </code></pre> <p>}</p> <p>Question 2) The only way I have found for empty the persistent menu and generating a new one is with a delete request via terminal ("as Facebook documented")m is there a possibily to clear inserting a refresh function on my app.js file?</p> <pre><code>curl -X DELETE -H "Content-Type: application/json" -d '{"setting_type":"call_to_actions","thread_state":"existing_thread"}' "https://graph.facebook.com/v2.6/me/thread_settingsaccess_token=PAGE_ACCESS_TOKEN" </code></pre>