forked from fuselabs/echobot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2412d8e
commit 3b93518
Showing
4 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,14 @@ | ||
# echobot | ||
A sample bot for getting started with Bot Framework | ||
|
||
This repo is an example of using Node.js to build a bot, which is hosted on Azure and uses continuous deployment from Github. | ||
|
||
Here's how to use this bot as a starter template for your own Node.js based bot: | ||
|
||
1. Fork this repo. | ||
2. Create an Azure web app. | ||
3. Set up continuous deployment to Azure from your Github repo. | ||
4. Register your bot with the Bot Framework. | ||
5. Enter your Bot Framework App ID and App Secret into Azure settings. | ||
6. Chat with your bot. | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<html> | ||
<head> | ||
<title>EchoBot</title> | ||
</head> | ||
<body> | ||
Hello world! This is the EchoBot home page :) | ||
</body> | ||
</html> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"name": "echobot", | ||
"version": "1.0.0", | ||
"description": "A sample bot for getting started with Bot Framework", | ||
"main": "server.js", | ||
"scripts": { | ||
"test": "" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/fuselabs/echobot.git" | ||
}, | ||
"keywords": [ | ||
"botframework" | ||
], | ||
"author": "Fuse Labs", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/fuselabs/echobot/issues" | ||
}, | ||
"homepage": "https://github.com/fuselabs/echobot#readme", | ||
"dependencies": { | ||
"botbuilder": "^0.6.5", | ||
"restify": "^4.0.4" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
var restify = require('restify'); | ||
var builder = require('botbuilder'); | ||
|
||
// Get secrets from server environment | ||
var botConnectorOptions = { | ||
appId: process.env.BOTFRAMEWORK_APPID, | ||
appSecret: process.env.BOTFRAMEWORK_APPSECRET | ||
}; | ||
|
||
// Create bot | ||
var bot = new builder.BotConnectorBot(botConnectorOptions); | ||
bot.add('/', function (session) { | ||
|
||
//respond with user's message | ||
session.send(session.message.text); | ||
}); | ||
|
||
// Setup Restify Server | ||
var server = restify.createServer(); | ||
|
||
// Handle Bot Framework messages | ||
server.post('/api/messages', bot.verifyBotFramework(), bot.listen()); | ||
|
||
// Serve a static web page | ||
server.get(/.*/, restify.serveStatic({ | ||
'directory': '.', | ||
'default': 'index.html' | ||
})); | ||
|
||
server.listen(process.env.port || 3978, function () { | ||
console.log('%s listening to %s', server.name, server.url); | ||
}); |