Search code examples
javascriptnode.jsrequestfacebook-messengerfacebook-messenger-bot

Nodejs: Messenger broadcast message not working


I am trying to send a broadcast through my facebook messenger bot. Here is my code:

if (subscribe === true) {
  // Send the HTTP request to the Messenger Platform
  request({
    "uri": "https://graph.facebook.com/v2.11/me/broadcast_messages",
    "qs": { "access_token": PAGE_ACCESS_TOKEN },
    "method": "POST",
    "message_creative_id": message_creative_id,
"notification_type": "REGULAR",
"messaging_type": "MESSAGE_TAG",
"tag": "NON_PROMOTIONAL_SUBSCRIPTION"
  }, (err, res, body) => {
    if (!err) {
      console.log('message sent!')
    } else {
      console.error("Unable to send message:" + err);
    }
  });
}

But, no message is being sent to any of my users. Is my code wrong, or does it take a lot of time to send out the messages?


Solution

  • I did not have subscription messages enabled at that time, so this question is invalid.