简体   繁体   中英

Messenger “Get Started” button doesn't start conversation

The button is added to the messenger. When a user clicks it, "Get Started" message pops up. Nothing happens after that Bot never posts the message back to "Get Started". No webhook is triggered. Button remains in the same spot. It disappears only after messenger page reloads or when click to another chat in messenger.

How can I make it disappear and open messenger at least? How can I track the "GET_STARTED_PAYLOAD" if there was no webhooks in general? I mean, that the message "Get Started" provided by the button never triggers the webhook, while typing in "Get Started" works fine.

setupTheBot();
function setupTheBot(){
  var button = {
      "setting_type": "call_to_actions",
      "thread_state": "new_thread",
      "call_to_actions": [
        { 
          "payload": "GET_STARTED_PAYLOAD"
        }
      ]
    };
  request({
    uri: 'https://graph.facebook.com/v2.6/me/thread_settings',
    qs: { access_token: PAGE_ACCESS_TOKEN },
    method: 'POST',
    json: button
  },
  function (error, response, body) {
        if (!error && response.statusCode == 200) {
            // Print out the response body
            console.log("Button: Setup changed GETSTARTED_BUTTON_PAYLOAD");
            console.log(body);
        } else { 
            // TODO: Handle errors
            console.log("Button: Failed. Need to handle errors.");
            console.log(body);
        }
    });
}

I've investigated tens of similar questions. Tried different ways of implementation. Result is the same.

Using node.js server and ngrok to test it.

If someone is interested, the reason was in setting up the bot at developers.facebook.com. You want to select "Messenger" -> "Settings" Scroll to "Webhooks" and press "Edit events" to add select events.

In documentation they say, that you can subscribe to those in "Weebhooks" (Step 2.4) , where you specify the TOKEN and tunnel. It's not correct. You can subscribe to "mesages" only. Which not include "messaging_postbacks", "messaging_optins", "message_deliveries" etc.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM