diff --git a/node/basic-sample/bot/index.js b/node/basic-sample/bot/index.js index 766a30f..8d18685 100644 --- a/node/basic-sample/bot/index.js +++ b/node/basic-sample/bot/index.js @@ -91,7 +91,14 @@ server.post('/api/proactive', async (req, res) => { let reference = req.body.reference; let message = req.body.message; await adapter.continueConversation(reference, async (turnContext) => { + // Wait two seconds + await timeout(2000); await turnContext.sendActivity(message); }); res.send(200); }); + +// Promisified timeout helper +const timeout = (ms) => { + return new Promise(resolve => setTimeout(resolve, ms)); +}