📌 Available on Plus plan only.
Webhooks allow you to connect your Rack Manage account to any third party service by sending status updates upon triggered events. This can be used to update your asset management system, send information to a messaging app or email service, etc.
Rack Manage supports the following HTTP methods for webhooks:
GET
POST
PUT
PATCH
DELETE
While POST, PUT and PATCH methods allow you to send a custom JSON request to your webhook endpoint, GET and DELETE methods do not include a request body, so any data must be sent through URL query params or HTTP headers instead.
Rack Manage allows you to define any custom headers you would like to send with your request, such as an authentication header to secure your endpoint.
Variables
Rack Manage has a list of predefined variables you can use to insert data into your request, whether in the URL, headers (value only) or JSON body. All variables will be in the Handlebars templating form of {{VAR_NAME}}
.
Depending on the type of event that triggered your webhook, not all variables may be available. For example, on the rack deleted event, the rack details such as the slots, name, etc. will be empty. For variables that return arrays of objects like RACK_ROOMS
, RACK_SLOTS
, ROOM_RACKS
, ROOM_OBJECTS
, and ROOM_LABELS
, you must specify which parameters to retrieve. Lists of parameters are provided in the examples below. Not all parameters will be returned depending on the type of alert. Some position parameters may not be provided. To ensure your JSON output is valid, wrap these parameters in the if
helper like so:
{{#if item.rotation}} "rotation": {{this.rotation}} {{/if}
You can use the following variables in the URL, headers, or body:
Variable | Description |
ALERT_CATEGORY |
|
ALERT_TYPE |
|
ALERT_NAME | Name of webhook. |
RACK_ID | ID of rack. |
RACK_NAME | Name of rack. |
RACK_LOCATION | Location of rack. |
RACK_ROOMS | Array of room IDs linked to rack. See examples for usage. |
RACK_TAGS | An array of tags assigned to the rack. See examples for usage. |
RACK_SIZE | Integer size of rack in rack units. |
RACK_SLOTS | An array of slots in the rack. See examples for usage. |
ROOM_ID | ID of room. |
ROOM_NAME | Name of room. |
ROOM_LOCATION | Location of room. |
ROOM_RACKS | An array of racks in the room. See examples for usage. |
ROOM_OBJECTS | An array of other objects in the room. See examples for usage. |
ROOM_LABELS | An array of text labels in the room. See examples for usage. |
ROOM_TAGS | An array of tags assigned to the room. See examples for usage. |
ROOM_WIDTH | Integer width of room canvas. |
ROOM_HEIGHT | Integer height of room canvas. |
Helpers
Rack Manage uses Handlebars for webhook templating which allows you to use any of the built in Handlebars helpers in your requests. Additionally, Rack Manage supports a list of many additional Handlebars helpers to make your webhooks even more powerful.
Helpers | Description |
| Generates a random UUID/v4, i.e. 9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d. |
| Generates a random decimal number between 0 and 1000, i.e. 345. |
| Generates a date or time using moment.js and allows for formatting:
|
Examples
Example Rack Update Alert:
{
"message": "{{ALERT_NAME}}",
"description": "{{ALERT_CATEGORY}} {{ALERT_TYPE}}: {{RACK_NAME}} updated at {{moment 'YYYY-MM-DD'}}",
"rack": {
"name": "{{RACK_NAME}}",
"id": "{{RACK_ID}}",
"location": "{{RACK_LOCATION}}",
"rooms": [
{{#each RACK_ROOMS}}
"{{this}}"{{#unless @last}},{{/unless}}
{{/each}}
],
"tags": [
{{#each RACK_TAGS}}
"{{this}}"{{#unless @last}},{{/unless}}
{{/each}}
],
"size": "{{RACK_SIZE}}",
"slots": [
{{#each RACK_SLOTS}}
{
"serial": "{{this.serial}}",
"size": {{this.size}},
"type": "{{this.type}}",
"name": "{{this.name}}",
"slot": {{this.slot}},
"model": "{{this.model}}",
"id": "{{this.id}}"
}{{#unless @last}},{{/unless}}
{{/each}}
]
}
}
Example Room Update Alert:
{
"message": "{{ALERT_NAME}}",
"description": "{{ALERT_CATEGORY}} {{ALERT_TYPE}}: {{ROOM_NAME}} updated at {{moment 'YYYY-MM-DD'}}",
"room": {
"name": "{{ROOM_NAME}}",
"id": "{{ROOM_ID}}",
"location": "{{ROOM_LOCATION}}",
"racks": [
{{#each ROOM_RACKS}}
{
"id": "{{this.id}}",
"name": "{{this.name}}",
"x": {{this.x}},
"y": {{this.y}},
"width": {{this.width}},
"height": {{this.height}},
{{#if item.rotation}}
"rotation": {{this.rotation}},
{{/if}}
{{#if item.scaleX}}
"scaleX": {{this.scaleX}},
{{/if}}
{{#if item.scaleY}}
"scaleY": {{this.scaleY}},
{{/if}}
{{#if item.skewX}}
"skewX": {{this.skewX}},
{{/if}}
{{#if item.skewY}}
"skewY": {{this.skewY}},
{{/if}}
{{#if item.offsetX}}
"offsetX": {{this.offsetX}},
{{/if}}
{{#if item.offsetY}}
"offsetY": {{this.offsetY}}
{{/if}}
}{{#unless @last}},{{/unless}}
{{/each}}
],
"objects": [
{{#each ROOM_OBJECTS}}
{
"id": "{{this.id}}",
"name": "{{this.name}}",
"notes": "{{this.notes}}",
"type": "{{this.type}}",
"x": {{this.x}},
"y": {{this.y}},
"width": {{this.width}},
"height": {{this.height}},
{{#if item.rotation}}
"rotation": {{this.rotation}},
{{/if}}
{{#if item.scaleX}}
"scaleX": {{this.scaleX}},
{{/if}}
{{#if item.scaleY}}
"scaleY": {{this.scaleY}},
{{/if}}
{{#if item.skewX}}
"skewX": {{this.skewX}},
{{/if}}
{{#if item.skewY}}
"skewY": {{this.skewY}},
{{/if}}
{{#if item.offsetX}}
"offsetX": {{this.offsetX}},
{{/if}}
{{#if item.offsetY}}
"offsetY": {{this.offsetY}}
{{/if}}
}{{#unless @last}},{{/unless}}
{{/each}}
],
"labels": [
{{#each ROOM_LABELS}}
{
"id": "{{this.id}}",
"text": "{{this.text}}",
"x": {{this.x}},
"y": {{this.y}},
{{#if item.width}}
"width": {{this.width}},
{{/if}}
{{#if item.height}}
"height": {{this.height}},
{{/if}}
{{#if item.rotation}}
"rotation": {{this.rotation}},
{{/if}}
{{#if item.scaleX}}
"scaleX": {{this.scaleX}},
{{/if}}
{{#if item.scaleY}}
"scaleY": {{this.scaleY}},
{{/if}}
{{#if item.skewX}}
"skewX": {{this.skewX}},
{{/if}}
{{#if item.skewY}}
"skewY": {{this.skewY}},
{{/if}}
{{#if item.offsetX}}
"offsetX": {{this.offsetX}},
{{/if}}
{{#if item.offsetY}}
"offsetY": {{this.offsetY}}
{{/if}}
}{{#unless @last}},{{/unless}}
{{/each}}
],
"tags": [
{{#each ROOM_TAGS}}
"{{this}}"{{#unless @last}},{{/unless}}
{{/each}}
],
"height": {{ROOM_HEIGHT}},
"width": {{ROOM_WIDTH}},
}
}
Still need help?
Contact us