Meraki Dashboard comes with built-in payloads for webhooks (Webex, Slack, Teams, …).
Those payloads are a ready to use solution for interacting with existing applications. But if you are using the given Webex payload (Network-wide > Alerts > Webhooks > Add or edit webhook templates)...
{
"markdown": "**{{alertType}}**\nAlert ID: {{alertId}}\nAlert level: {{alertLevel}}\nOccurred at: {{occurredAt}}\nOrganization name: [{{organizationName}}]({{organizationUrl}})\nOrganization ID: {{organizationId}}\nNetwork name: [{{networkName}}]({{networkUrl}})\nNetwork ID: {{networkId}}\nNetwork Tags: {{networkTags | join: ', '}}\nDevice name: {{deviceName}}\nDevice serial: [{{deviceSerial}}]({{deviceUrl}})\nDevice MAC: {{deviceMac}}\nDevice tags: {{deviceTags | join: ', '}}\nDevice model: {{deviceModel}}\n**Alert Data** {{ alertData | markdown_with_additional_formatting_for_webex }}\n"
}
...you will need to host a script listening for Meraki webhooks, and then posting a message to Webex API (via your Webex Bot).
This workflow is correct, however for the Custom app, you will need to deal with:
❗Setting up a self-hosted / cloud-hosted application can thus be time/money consuming.
In this article, I am presenting a workaround, allowing you to post Webex messages directly from the Meraki Dashboard using a custom webhook payload:
👍Same result, but one less hop!
Custom payload templates allow you to define the structure of webhooks sent from Meraki Dashboard. By using it, you will be able to decide which data you want to send, and how those data are formatted.
The structure will be written in Liquid, both for the header and the body of the HTTP POST request.
A new webhook payload template can be created from the Meraki Dashboard (Network-wide > Alerts > Webhooks > Add or edit webhook templates).
Or via Meraki APIs:
https://developer.cisco.com/meraki/api-latest/#!create-network-webhooks-payload-template
The custom webhook payload template needs to:
Be sent to Webex API (https://webexapis.com/v1/messages)
Authenticate to the Webex API with the bot token
Include expected formated data
(Optional) Provide an Adaptive Card for better display
For the given requirements, I am going to use the Meraki Dashboard.
Network-wide > Alerts > Webhooks
Network-wide > Alerts > Webhooks > Add or edit webhook templates
Network-wide > Alerts > Webhooks > Add or edit webhook templates
Then, do not forget to apply the custom webhook template to your alerts (Network-wide > Alerts):
Network-wide > Alerts > Webhooks > Add or edit webhook templates
In the Liquid Body, you can keep the markdown format of the native Webex payload template, or you can specify an Adaptive Card for better display.
An example of card is available on the following GitHub repo : https://github.com/xaviervalette/meraki-webex-custom-webhooks/blob/main/liquidBody.json
To create your own custom Adaptive Card, you can use the Button and Card Designer Tool of Webex.
Here is the result! I hope it helps!
That is much better. No one in this space really wants to be hosting their own code.
Just for completion.
You don't have to host something. Webex is also supporting an integration for incoming webhooks to post something into a room
https://apphub.webex.com/applications/incoming-webhooks-cisco-systems-38054-23307
I'm using this and the basic integrated template.
Hello Guys,
The Adaptive Card is possible used with incoming-webhooks?
Hi @xaviervalette , as @Greenberet mentioned, this statement is inaccurate:
@xaviervalette wrote:But if you are using the given Webex payload (Network-wide > Alerts > Webhooks > Add or edit webhook templates)...
...you will need to host a script listening for Meraki webhooks, and then posting a message to Webex API (via your Webex Bot).
Webex supports incoming webhooks out of the box. Link: https://apphub.webex.com/applications/incoming-webhooks-cisco-systems-38054-23307-75252