Survey Bot for Cisco Spark
A self-hosted Cisco Spark bot for taking surveys.
Create surveys through a web-based user interface.
Conducts surveys via Cisco Spark.
Watch survey results update in real-time.
Setup & Configuration
Create a new user on Cisco Spark to be the bot. Admittedly, it's untraditional to use a user account, but because of the way the bot works, it needs to be a user and cannot be a bot or an integration.
Once you create a user, go log in at Cisco Spark for Developers
Click on your avatar in the top right hand corner to show your Access Token.
Copy that token and use it as your
As that new user, create an integration:
Feel free to use this image URL.
You'll want this to be the
PUBLIC_ADDRESSenvironment variable with
/auth/spark/callbackat the end.
Choose the following scopes:
Scope Reason for needing it
so OAuth can fetch user info (name, avatar, etc...)
for letting you choose a room to survey
for knowing who is in a room
for sharing survey results
for letting you choose a team room to survey
Once you create the integration, grab the Client ID and Client Secret. These will be the environment variables
Set the following environment variables. If developing locally, you can put these in the
Environment variable Description
the address at which your bot can be reached
the access token from the user you created
the client id of the integration you created
the client secret of the integration you created
secret for validating the origin of webhooks and for encrypting cookies. Generate a random string for this value. If you are using Heroku, this will be generated for you if you use the "Deploy to Heroku" button. In development, feel free to ignore this as one will be generated for you but it will be different every time your app starts.
URL of your Redis server. If you are using Heroku, this will be added for you.
the port to run the web server. If you are using Heroku, this will be added for you.
only allow users to log in if they match certain domains. Set to a comma separated list of allowed domain names. E.g.
example.com,example.net,email.example.biz. Must provide the full domain-- e.g.
email@example.com not be allowed to log in if your list is
example.com. If not set, it will allow logins with any domain name.
Deploying on Heroku
Use the "Deploy to Heroku" button above from this repo or a fork of this repo.
Running the bot via Docker
A Dockerfile has been included to run the bot via Docker. Here are some additional instructions for running the bot via Docker locally.
Put your environment variables in
.env.local and run via:
docker build -t my-survey-bot . docker run -it --env-file .env.local my-survey-bot
Work on the bot
Follow the instructions in Setup & Configuration above, with the following notes:
- Set your
PUBLIC_ADDRESSenv variable to your ngrok URL, e.g.
SPARK_SECRETis not needed in development.
- Set the
1to let you log into the app without needing an internet connection. This will let you create and modify surveys, but will not let you conduct surveys.
- Set your
Start the local development server & redis:
If you already have Redis running as a deamon or aren't using a local Redis server, do:
If using Docker, you can run the image specifying the environment file and exposing port 3000:
docker run -it --env-file .env.local --publish 3000:3000 my-survey-bot
Run ngrok (or something like it).
Because Spark uses webhooks to talk to bots, you must run something like ngrok locally to expose your server to the web. We've included a script to do this for you (requires ngrok).
Add a Redirect URI to your Spark Integration settings that uses your ngrok URI. E.g.
Run the tests:
Run the linter:
Run the test watcher, which will re-run tests after every file change: