Creating Custom Config Template Webhook Payload Template

Solved
david_n_m_bond
Building a reputation

Creating Custom Config Template Webhook Payload Template

I'm trying to create a custom Config Template Webhook Payload Template.

 

I'm sending the following body to:

  • POST {{meraki_url}}/networks/{{meraki_configTemplate_id}}/webhooks/payloadTemplates

...but am getting "403 Forbidden".  Sending bad body content results in 400, so I think that what I have below is OK.

 

Questions:

  1. Is it OK to add a custom Config Template Webhook Payload Template to a Config Template?
  2. OK, so what am I doing wrong?!

 

Body:

{ "name": "AlertMagic", "headers": "{\n \"Authorization\": \"Bearer {{sharedSecret}}\"\n}", "body": "{\n \"sourceSystem\": \"meraki\",\n \"alertData\": {{ alertData | jsonify }},\n \"alertId\": \"{{alertId}}\",\n \"alertLevel\": \"{{alertLevel}}\",\n \"alertType\": \"{{alertType}}\",\n \"alertTypeId\": \"{{alertTypeId}}\",\n \"deviceMac\": \"{{deviceMac}}\",\n \"deviceModel\": \"{{deviceModel}}\",\n \"deviceName\": \"{{deviceName}}\",\n \"deviceSerial\": \"{{deviceSerial}}\",\n \"deviceTags\": {{deviceTags | jsonify }},\n \"deviceUrl\": \"{{deviceUrl}}\",\n \"networkId\": \"\",\n \"networkName\": \"{{networkName}}\",\n \"networkTags\": {{networkTags | jsonify }},\n \"networkUrl\": \"{{networkUrl}}\",\n \"occurredAt\": \"{{occurredAt}}\",\n \"organizationId\": \"{{organizationId}}\",\n \"organizationName\": \"{{organizationName}}\",\n \"organizationUrl\": \"{{organizationUrl}}\",\n \"sentAt\": \"{{sentAt}}\",\n \"version\": \"{{version}}\"\n}" }

Author, https://www.nuget.org/packages/Meraki.Api/
1 Accepted Solution
david_n_m_bond
Building a reputation

Since I wrote this, Meraki have fixed a bug.

 

The same POST now complains:

 

"Body Liquid error: undefined variable version"

 

Removing the final ",\n \"version\": \"{{version}}" from the post body then works.

Author, https://www.nuget.org/packages/Meraki.Api/

View solution in original post

2 Replies 2
DexterLaBora
Meraki Employee
Meraki Employee

Hi @david_n_m_bond ,

 

Webhook Payload Templates do support Network Config Templates. (I just tested again to verify)

FYI, If you are having issues uploading the templates using Postman, it sometimes gets in the way and will evaluate the {{variables}} before the content is sent to Meraki. 


One easy way to avoid this is to create a *.liquid file for your template headers and one for your template body.

 

You can then use the other API parameters headersFile & bodyFile to upload the files without conflict.

DexterLaBora_0-1646346145547.png

 

You can find a list of example templates here as well as utilities to help create and manage them..
https://github.com/meraki/webhook-payload-templates

 

or you can read more on the webhook documentation site

https://developer.cisco.com/meraki/webhooks/#!template-examples-overview

 

 

 

david_n_m_bond
Building a reputation

Since I wrote this, Meraki have fixed a bug.

 

The same POST now complains:

 

"Body Liquid error: undefined variable version"

 

Removing the final ",\n \"version\": \"{{version}}" from the post body then works.

Author, https://www.nuget.org/packages/Meraki.Api/
Get notified when there are additional replies to this discussion.
Welcome to the Meraki Community!
To start contributing, simply sign in with your Cisco account. If you don't yet have a Cisco account, you can sign up.