Easily capture Meraki Dashboard alerts using webhooks and Google Sheets.

How it Works

The Meraki Dashboard has multiple ways of delivering notifications when an event occurs. For example, you may want to receive an email alert when settings have been changed, or an SNMP Trap is sent when a device goes offline. Now you can receive an HTTP post message. This is called a webhook, and it makes it easy to integrate into web services. Build custom solutions to trigger workflows based on the event or archive the alerts.

This Google Sheet solution acts as a simple webhook receiver to log all of the Meraki Alerts into individual spreadsheet tabs based on the alert type. Additional alerts will be added as a new row in the respective sheet. From there, you can add conditional formatting and other techniques to enhance the data.

Build it!

There are just a few steps to get this going. This guide will walk through each of these in detail.

  • Create a Google Sheet
  • Copy the Script
  • Publish the web app
  • Configure an Meraki Alert webhook server 

Google Sheet

Create a new Google Sheet.

Open the Script editor under the Tools menu.

Overwrite the existing code with the contents of the default code.gs file with the following code.gs file.

Publish the App

To make the script and sheet accessible so that we can send Meraki Alerts to it, we must publish the app.

Publish -> Deploy as web app

Execute the app as Me with access Anyone, even anonymous

Note the web app URL provided, this is the Meraki webhook URL destination.

Meraki Alerts

Open the Meraki Dashboard and navigate to your network that you want to receive alerts from.

Meraki Dashboard (select network): Network-wide -> Alerts

Add an HTTP Server using the URL provided by your Google Sheets app. You can select any name, and secret.

 Note: The Shared secret is currently ignored in this Google Sheets application. 

Add the new HTTP server to the list of Alert recipients and save your changes.

Test

Let’s test the solution by ensuring that we get an alert when settings are changed.

Then, make a change to the network configuration and save. Adding additional alerts is a simple change, that won’t affect the network. 

You should now see your Google Sheet populate with events. 

Success!

You should now have a working solution to capture all of the Meraki Alerts to a Google Sheet using webhooks. 

 

Script Details 

The script is triggered when an HTTP post is received. The JSON data is parsed and then formatted to fit into the spreadsheet. 

// Webhook Receiver - triggered with post to published App URL.
function doPost(e) {
  var params = JSON.stringify(e.postData.contents);
  params = JSON.parse(params);
  var postData = JSON.parse(params);
  
  display(postData);
  
  // HTTP Response
  return HtmlService.createHtmlOutput("post request received");
}

The other bits in the code will handle creating the sheet tabs and formatting the nested JSON data into a spreadsheet structure. Read the comments for more info.

What can you do with this?

Share your ideas and feedback on our community!