Skip to content

Latest commit

 

History

History
275 lines (198 loc) · 6.71 KB

README.md

File metadata and controls

275 lines (198 loc) · 6.71 KB

meraki-webhook-payload-templates

This is a collection of Meraki Webhook Payload Templates.

Each folder consists of one integration which includes a couple of key files.

  • /integration/

    • readme.md

      Description of the template, links to the related API service and screenshots of results.

    • body.liquid

      The body template file

    • headers.liquid

      The headers template file

Alert Types

The template files will leverage the Liquid language and render the final results based on the alertType that is sent via the webhook.

  • alertTypes.json
    Included sample of alert types and the variables that are available to the template.

Using Liquid Templates

The Liquid template language provides a number of options to present and transform the data. For more information and helpful tools, checkout these resources.

Liquid Docs

Liquid for Designers

Meraki Liquid Filters

In addition to the standard Liquid filters, Meraki has provided a few extras for helpful tasks. Use these by appending a pipe and the name of the filter

alertData | jsonify

jsonify

Converts a JSON object into a JSON string.

Hint, if you see [Object object] try using this

alertData | jsonify

--- Returns ---

{"portNum":3,"description":"Gigabit link negotiation failed","status":"10 Gbps","prevStatus":"100 Gbps","portDesc":"Corp Access"}

json_markdown

Converts a JSON object into a markdown friendly view of the keys and values and avoids clashing when nested in other JSON.

alertData | json_markdown

--- Returns ---

portNum: 3
description: Gigabit link negotiation failed
status: 10 Gbps
prevStatus: 100 Gbps
portDesc: Corp Access

REST API

Using the Dashboard API, the templates can be uploaded, managed, tested and applied.

Payload Templates

get /networks/{networkId}/webhooks/payloadTemplates getNetworkWebhooksPayloadTemplates
post /networks/{networkId}/webhooks/payloadTemplates createNetworkWebhooksPayloadTemplate
get /networks/{networkId}/webhooks/payloadTemplates/{payloadTemplateId} getNetworkWebhooksPayloadTemplate
delete /networks/{networkId}/webhooks/payloadTemplates/{payloadTemplateId} deleteNetworkWebhooksPayloadTemplate
put /networks/{networkId}/webhooks/payloadTemplates/{payloadTemplateId} updateNetworkWebhooksPayloadTemplate

Webhook Tests

post /networks/{networkId}/webhooks/webhookTests createNetworkWebhooksWebhookTest
get /networks/{networkId}/webhooks/webhookTests/{webhookTestId} getNetworkWebhooksWebhookTest

Webhook HTTP Servers

get /networks/{networkId}/webhooks/httpServers getNetworkWebhooksHttpServers
post /networks/{networkId}/webhooks/httpServers createNetworkWebhooksHttpServer
get /networks/{networkId}/webhooks/httpServers/{httpServerId} getNetworkWebhooksHttpServer
put /networks/{networkId}/webhooks/httpServers/{httpServerId} updateNetworkWebhooksHttpServer
delete /networks/{networkId}/webhooks/httpServers/{httpServerId} deleteNetworkWebhooksHttpServer

Utilities

A graphical web app to build and test template files.

Run in Postman

  • Webhooks Management.postman_collection.json

    A postman collection for the related Meraki API operations to manage webhooks is included in this folder.

Node-RED

  • node-red-webhook-payload.flows.json A Node-RED flow to help test and manage payload templates

Python

  • CRUD_Webhooks.py A python script to manage payload templates in a Meraki organization

    Navigate into the integration directory, then run the python script (from its relative directory).

    cd webex
    ../CRUD_Webhook.py
    
    
    
    
                                   ./(((((((((((((((((/.
                              *(((((((((((((((((((((((((((((
                           .(((((((((((((((((((((((((((((((((((/
                         ((((((((((((((((((((((((((((((((((((((((/
                       ,((((((((((((((((((((((((((((((((((((((((((((
                     .((((((((((((((((((((     ((((((/     ((((((((((,
                    ((((((((((((((((((((((     ((((((/     (((((((((((
                 /((((((((((((((((((((((((((((((((((((((((((((((((((((
                ((((((((((((((((((((((((((((((((((((((((((((((((((((((*
               ((((((((((((((((((((((((((((((((((((((((((((((((((((((((
              (((((((((((((((((((((((((((((((((((((((((((((((((((((((((
             ((((((((((((((((((((((((     ((((((((((((((/     (((((((((
            ,((((((((((((((((((((((((     ((((((((((((((/     ((((((((/
            (((((((((((((((((((((((((    .//////////////*    .((((((((
           ,(((((((((((((((((((((((((((((/              ((((((((((((.
           ((((((((((((((((((((((((((((((/              (((((((((((
           (((((((((((((((((((((((((((((((((((((((((((((((((((((((*
          .(((((((((((((((((((((((((((((((((((((((((((((((((((((*
          /((((((((((((((((((((((((((((((((((((((((((((((((((*
          (((((((((((((((((((((((((((((((((((((((((((((((*
          (((((((((((/.                     ....
          (((((((/
          (((((
          (((
          /.            Welcome to the power of the Meraki API
    
    
      This is a demo on how to manage custom Webhook-payloadTemplates
      If you like to upload your custom Webhook-payloadTemplate,
      the headers.liquid and body.liquid file needs to be in the same dir as this script.
    
                The use of this tool is on your own risk.
    
      Please visit:  https://meraki.io
    
    
    
          Press Enter to continue
    
    
    ```