Home

Awesome

ciscospark-websocket

This module can be used to build a bot for Cisco Spark that only uses outbound connections (useful if you want to run the bot from behind a firewall where inbound webhook connections are not possible). Two types of outbound connections are used - a websocket connection for the bot to receive notifications of events and REST API calls to the Spark service to retrieve messages, etc.

Getting Started

Prerequisites

Usage

Example

An example of how this can be used is included in example-echobot.py but the simplest example is:

from ciscosparkwebsocket import CiscoSpark

token = '<REPLACE WITH YOUR TOKEN FROM developer.ciscospark.com>'

def on_message(message):
  # TODO: handle the message received by the bot. Below just echos the message back to the sender
  spark.spark.messages.create(roomId=message.roomId, text=message.text)
  
spark = CiscoSpark(token=token, on_message=on_message)
spark.run()

Notes

Acknowledgements