Issue with Facebook messenger bot (welcome message and button message)
<p>I'm facing 2 issues when developing a Facebook messenger bot, and I'm a newbie to programming.</p>

<ol>
<li><p>I followed FB's tutorial to add the code - welcome message and deployed it in heroku, but my bot didn't pop up the said message.</p>

<blockquote>
<pre><code>app.post('/webhook/', function (req, res) {
let messaging_events = req.body.entry[0].messaging
for (let i = 0; i &lt; messaging_events.length; i++) {
  let event = req.body.entry[0].messaging[i]
  let sender = event.sender.id
  if (event.message &amp;&amp; event.message.text) {
    let text = event.message.text
    if (text === 'Generic') {
        sendGenericMessage(sender)
        continue
    }
    if (text === 'button') {
        sendbuttonmessage(sender)
        continue
    }
    welcomemessage(sender)
    //sendbuttonmessage(sender)
  }
  if (event.postback) {
    let text = JSON.stringify(event.postback)
    sendTextMessage(sender, "Postback received: "+text.substring(0, 200), token)
    continue
  }
}
res.sendStatus(200)   })
</code></pre>
</blockquote></li>
</ol>

<blockquote>
<pre><code>function welcomemessage (sender) {   let messageData = {
    "setting_type":"call_to_actions",   "thread_state":"new_thread",   "call_to_actions":[
    {
      "message":{
        "text":"Welcome to My Company!"
      }
    }   ] }   request({
    url: 'https://graph.facebook.com/v2.6/me/messages',
    qs: {access_token:token},
      method: 'POST',
      json: {
          recipient: {id:sender},
          message: messageData,
      }   }, function(error, response, body) {
      if (error) {
          console.log('Error sending messages: ', error)
      } else if (response.body.error) {
          console.log('Error: ', response.body.error)
      }   }) }
</code></pre>
</blockquote>

<ol start="2">
<li>How do I pop up another button when ppl clicked them? For example:
send function <code>sendbuttonmessage(sender)</code> after they click the web url of the button.</li>
</ol>

<blockquote>
<pre><code>function sendbuttonmessage (sender) {
    let messageData = {
        "attachment": {
          "type":"template",
          "payload":{
            "template_type":"button",
            "text":"Welcome to Taikoo Place. How can we help?",
            "buttons":[
              {
                "type":"web_url",
                "url":"https://peterapparel.parseapp.com",
                "title":"Show Website"
              },
              {
                "type":"postback",
                "title":"Service Lift Booking",
                "payload":"what"
                //"payload":"USER_DEFINED_PAYLOAD"
              },
            ]
          }
        }
      }
</code></pre>
</blockquote>