What is a webhook and how are they used in Device42?
Webhooks are used to initiate an external action in another part of your IT environment when some “event”, based on rules you define, occurs. Also known as HTTP callbacks, webhooks are “fired” at HTTP endpoints (URLs) when a configured “Webhook Action” criteria is met. Within Device42, anything that produces an audit-log entry can also be configured to “fire” a webhook.
For example, when a Device42 auto-discovery job finds a new device, when details about an existing device change, or when an existing device is deleted are three simple examples of actions that can be configured to trigger webhooks from Device42. An IT Administrator might configure a webhook to deliver a “message” to one or more IT employees via a webhook-compatible endpoint (like Slack or Skype), letting them know that this action took place.
Creating a webhook action in Device42
Configuring Device42 to send a webhook is a simple two-step process:
- Define one or more Webhook Endpoints: the HTTP URLs Device42 should send your webhooks to via Tools -> Webhooks -> Enpoints -> Add Webhook Endpoint
- Define a Webhook Action: the Device42 action(s) that will trigger your webhook, and the endpoints they should go to via Tools -> Webhooks -> Actions -> Add Webhook Actions
Webhook Action Screen options
Name: User-defined name for webhook action
Process All Categories: Hides “Available Categories” choices; webhooks fired on changes in all categories
Available Categories: Specify the CI categories you’d like to trigger the webhook on
Process Add Events: Trigger a webhook if a new CI is added to a Chosen Categories
Process Delete Events: Trigger a webhook if a CI in any of Chosen Categories is deleted
Process Chaange Events: Trigger a webhook if a CI in any of Chosen Categories is Changed
Process View Events: Trigger a webhook if a “View event” is logged on a CI in Chosen Categories
Process Login Events: Trigger a webhook if a “Login event” is recorded on a CI in Chosen Categories
Destination: Choose the defined endpoint(s) to receive triggered webhook events
Webhook Endpoint Screen options
Name: User-defined name for webhook endpoint
URL: URL destination for webhook
Endpoint: Choose Slack or Zapier to reveal fields specific to those endpoints; Choose custom if targeting anything else
Channel: Slack Endpoint only; Specify Slack channel that should receive message when webhook is received
Username: Slack Endpoint only; Specify the Slack username the message will originate “From”
Icon: Slack Endpoint only; Specify a custom “From” icon
Webhook Header: Define custom Header payloads; each includes a user-defined ‘Name’ and ‘Token’ field.