Skip to content

Standard Server

1) Clone repo & install dependencies

git clone https://github.com/valgaze/speedybot
cd examples/standard-server
npm install

2) Set your bot access token

You can set your BOT_TOKEN by running this script in the project directory:

npm run bot:setup <your_token_here>

Set token by hand

Copy the file .env.example as .env in the root of your project and save your access token under the BOT_TOKEN field, ex

BOT_TOKEN=__REPLACE__ME__

3) Boot it up!

  • Start up your agent w/ npm run bot:dev
npm run bot:dev

4) Run a test

To test only the incoming webhook, edit the /incoming_webhook route & run this command to send a test paylaod

curl -X POST -H "Content-Type: application/json" -d '{"id": 1234567890987654321}' http://localhost:8000/incoming_webhook

5) Register your webhooks

  • Right now if you try to interact with your "deployed" agent through the WebEx client nothing happens, nobody is "home" to answer the knock at the door

  • For this situation (where the whole agent is on a standard server) you'll need to find a way to securely expose that server in a way that is publically reachable

  • Hop on over to the SpeedyBot Garage (https://speedybot.js.org/garage), enter your access token, select the Webhooks tab, and then Add New Webhook and add the URL of your server and (optionally but hopefully) a webhook secret

6) Supply your Webhook "secret" to your server

Even though it's "optional", it's a really, really good idea to set a Webhook Secret too so you can make sure incoming requests are the real deal. For more detail, see https://speedybot.js.org/webhooks#securing-webhooks

To add a secret to an existing webhook, delete the current webhook and create a new one with the secret.

7) Take it for a spin

NPM Run Scripts

All you'll probably need are npm run bot:dev + maybe npm run bot:reset

ScriptDescription
npm run bot:onLaunches the SpeedyBot
npm run serveAlias for npm run bot:dev
npm run devAlias for npm run bot:dev
npm run bot:debugDisplays environment information for debugging
npm run bot:devLaunches the bot in development mode
npm run bot:resetResets the bot's configuration
npm run bot:setupSets up the bot for the first time
npm run bot:tokenAlias for npm run bot:setup
npm run bot:helpDisplays help information for the bot
npm run helpAlias for npm run bot:help
npm run bot:addsecretAdds a secret to the bot's configuration