Experiment Cisco Spark Webhooks

Complete all three Spark API Learning Labs and we’ll update your DevNet profile with a Spark Early Adopter Badge, worth 250 points.


Completion Time: 15 minutes

  • Understand how webhooks work
  • Create a Spark webhook
  • View a webhook in action


  • Cisco Spark account
  • This lab includes steps in the above How to Setup Your Computer section to setup your development environment.

Introduction: What are Webhooks?

Webhooks are a developer's way of receiving notification from the Spark platform that an event has occurred. This is a great way for your application to receive real-time data from Spark. You can think of webhooks as "reverse APIs" where the Spark Cloud platform posts data to your application. For example, you can register your application to receive a notification every time a new message is posted in a Spark Room.

Webhooks diagram

*: Webhooks require a publicly reachable URL of your application.

As your local code is not accessible from the internet in development phase, we see several options to make your code visible from the Cisco Spark Cloud platform, so that you can receive notifications from your wekbhook, and do interactive debugging:

  1. Create a tunnel from your local machine to the internet. The “tunneling” tool will act as a reverse proxy to your application exposed on http://localhost:port. 3rd party tools include localtunnel and ngrok.
  2. Leverage a Web IDE which will run and expose your code on a public URL. 3rd party tools include Cloud9, EclipseChe.

In this lab, we will create a Webhook with Cisco Spark's interactive documentation, then inspect the data posted to a "Requestb.in" public URL.

Step 1. Pick a Room identifier

We assume you are already a member of a Spark room and you want
In this learning lab we want our application to receive every new message posted in the 'Network Administrators' room. However, most of us are subscribed to multiple rooms, so we will use the filter parameter in our webhooks request to receive messages only from the Network Administrators Spark room. We first need to get the ID of the room we are interested in.

To get started, let's create a simple HTTP request to the Spark web service to get the names and IDs of all of the rooms using the Rooms resource

You will need to use your access token in the request which you can get by logging into developer.ciscospark.com, clicking your profile picture, clicking copy.


There are many HTTP clients that can help you quickly test web services. We are going to use Postman to retrieve a list of rooms.

Postman Request

  1. Complete the fields with the following details:

    • Method
      • Select GET in the Method drop down
    • URL
    • Headers
      • Header: Authorization Value: Bearer {access token}
        • Include the word Bearer and one space before the Spark access token
  2. Click Send.

    • Postman will send the request to the Spark server, and then display the response.
    • You can see the Response Code is 200 OK.
    • You can see the JSON that contains the list of rooms and their room IDs.

Postman Response

As you can see the ID of the Network Administrators room in this example is Y2lzY29zcGFyazovL3VzL1JPT00vN2FjN2UxNzAtODRjZC0xMWU1LTg0ZWUtNjkyN2IwNWIzMTVi. We will use this ID in our next step to create a webhook that is subscribed to this room.