Created
March 15, 2018 19:00
-
-
Save codefoster/90fab31316023714b1cdce974c8c431e to your computer and use it in GitHub Desktop.
Bot Framework v4 m2 Echo Bot with BotFrameworkAdapter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { BotFrameworkAdapter } from 'botbuilder'; | |
import * as restify from 'restify'; | |
let server = restify.createServer(); | |
server.listen(process.env.port || process.env.PORT || 3978, function () { | |
console.log(`${server.name} listening to ${server.url}`); | |
}); | |
const adapter = new BotFrameworkAdapter(); | |
server.post('/api/messages', (req, res) => { | |
adapter.processRequest(req, res, async ctx => { | |
if (ctx.request.type === 'message') { | |
ctx.sendActivity(ctx.request.text); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment