在 Messenger 中发送主动消息的时间间隔

Interval of hours or days to send proactive message in messenger

我可以通过 botframework 向 facebook Messenger 用户发送主动消息的时间范围是多少小时或几天?

NodeJS SDK - botbuilder 版本 3.14

我正在使用下面的代码示例

// send simple notification
function sendProactiveMessage(address) {
  var msg = new builder.Message().address(address);
  msg.text('Hello, this is a notification');
  msg.textLocale('en-US');
  bot.send(msg);
}

var savedAddress;
server.post('/api/messages', connector.listen());

// Do GET this endpoint to delivey a notification
server.get('/api/CustomWebApi', (req, res, next) => {
    sendProactiveMessage(savedAddress);
    res.send('triggered');
    next();
  }
);

// root dialog
bot.dialog('/', function(session, args) {

  savedAddress = session.message.address;

  var message = 'Hello! In a few seconds I\'ll send you a message proactively to demonstrate how bots can initiate messages.';
  session.send(message);

  message = 'You can also make me send a message by accessing: ';
  message += 'http://localhost:' + server.address().port + '/api/CustomWebApi';
  session.send(message);

  setTimeout(() => {
   sendProactiveMessage(savedAddress);
  }, 5000);
});

引用 Facebook Messenger 政策:

24-Hour Messaging Window

Businesses and developers using the Send API have up to 24 hours to respond to a message sent by a person in Messenger when using standard messaging. A bot may also send one additional message after the 24-hour time limit has expired. The 24-hour limit is refreshed each time a person responds to a business through one of the eligible actions listed in Messenger Conversation Entry Points. This is commonly referred to as the '24 + 1 policy'.

For information on how you may be able to send messages outside the 24-hour messaging window, see the Tags documentation, and Sponsored Messages.

此政策可在此处获得:https://developers.facebook.com/docs/messenger-platform/policy/policy-overview#standard_messaging