Run a Cisco Spark Bot locally

Objectives

As introduced earlier, Cisco Spark Bots are applications that invoke the Cisco Spark API under a Bot account identity.

In this lab, you will learn to run your own Cisco Spark Bot by taking several steps: create a Bot account, run a sample Cisco Spark bot on your local machine, expose your bot to the internet and register Webhooks in order to have Cisco Spark post notifications to your bot. Finally, you will chat with your new friend:

Objectives_chat


Pre-requisites

You will need a Cisco Spark user account to complete this lab. If you're not a Cisco Spark user yet, click to sign up.

Step 1: Create a Bot account

Log in at “Spark for Developers” and open the "My Apps" menu.

Step1_my_apps


Click on the “+” button, and choose “Create a Bot”.

Step1_bot


You will access the “New Bot” creation form below.

Fill in a name, a unique email identifier, and specify a publicly accessible image URL with a minimal resolution of 512x512 pixels. Feel free to pick this image example for the sake of this lab.

Note that you will not be authorized to pick the email "my-awesome-bot@sparkbot.io" as it is already reserved. Make sure to replace future mentions with the unique email you have just chosen for your bot.

Step1_my_awesome_bot


Click “Add Bot” to get your Cisco Spark Bot created.

Your Bot's access token is displayed. Paste it in a safe place as it won’t show up again, and we will use it in steps 2 and 3 of this lab.

Note that a Cisco Spark Bot access token lasts 100 years. If you ever lose or reveal it, you can come back to your Bot Details page and regenerate an access token. The previously issued token will then be automatically deprecated.

Step1_token


Your bot can now be added to any Cisco Spark Room by specifying its email: my-awesome-bot@sparkbot.io in our example.

Go to your Cisco Spark client, and create a new room with your Bot as a participant.

Step1_new_room_share


Even though you can chat with your bot, you won’t see him answer... as we haven’t connected it yet to any custom code logic. We’ll work on that in the next steps.