Every knight needs a squire - Squirebot helps you be at your best by doing tasks for you, with only minimal training.
- Node v6.5.0
- npm (comes with Node)
🔥🔥🔥 WINDOWS ONLY 🔥🔥🔥
- Clone the repo
- Run
./start.ps1
from the root of this project
This will spin up two powershell windows and when everything is loaded, it will start chrome.
- Clone the repo
cd ./src/tasks-functions
npm i
npm start
npm start
will run the func host start --cors *
command
This should spin up the Function host
cd ./src/webapp
npm i
npm start
This should spin up a local site hosting the static Angular content
When it has finished building, open up your favorite browser to "http://localhost:4200"
Squirebot uses HTTP to make requests to Task providers. These requests expect a certain format for the response.
The request sent to your API will be a POST with a simple dictionary of keys sent as the body.
{
"name1":"value",
"name2":"value"
}
The response returned from your task needs to have a status code of 200
. If you want to display text to the user, you can return a JSON body with a message
property. The content of message
will generally be treated like markdown.
{
"message":"# Hello world!"
}
This is a simple example of creating a hello world task
- Create a new http Function (
func new -l javascript -t HttpTrigger -n hello
) - Use this code for
./hello/index.js
module.exports = function (context, req) { context.log('JavaScript HTTP trigger function processed a request.'); if (req.query.name || (req.body && req.body.name)) { context.log('Sending response to bot!'); context.res = { // status: 200, /* Defaults to 200 */ body: {message: "# Hello222 " + (req.query.name || req.body.name)+ "!!!!"} }; } context.done(); };
- Create a new task in the portal UI
- Name it
hello world
- Make the action
http://localhost:7071/api/hello
with the method asPOST
- Create a parameter with the name as
name
and prompt asWhat is your name?
- Hit save and then open the bot emulator
- In bot emulator: set the url to
http://localhost:7071/api/bot
- Tell the bot:
hello world
- It should ask "What is your name?"
- Answer with your name
- It should say "Hello
<name>
"