A set of examples to discover the framework's features :
-
onEvent-all-all, onEvent-messages-created: examples of listeners to specific Webhook (Resources/Event) triggers. Leverages node-sparkbot function: webhook.onEvent().
-
onMessage: examples of listeners invoked when new message contents are succesfully fetched from Webex. Leverages node-sparkbot function: webhook.onMessage().
-
onMessage-asCommand: illustrates how to interpret the message as a bot command. Leverages node-sparkbot function: webhook.onMessage().
-
onCommand: shortcut to listen to a specific command. Leverages node-sparkbot function: webhook.onCommand().
-
onCommand-webhook: example of an automated creation of a webhook.
You may also check express-webhook which illustrates how to create a bot without any library :
- express-webhook: a simple HTTP service based on Express, listening to incoming Resource/Events from Webex Teams
Each sample can be launched from the same set of command lines install then run calls.
Note that the ACCESS_TOKEN env variable is required to run all samples that read message contents.
Once your bot is started, read this guide to expose it publically and create a Webex Teams webhook.
# Installation
git clone https://github.com/CiscoDevNet/node-sparkbot
cd node-sparkbot
npm install
# Run
cd tests
DEBUG=sparkbot* ACCESS_TOKEN=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX node onCommand.js
...
Webex Teams Bot started at http://localhost:8080/
GET / for Healthcheck
POST / to receive Webhook events