Webhooks
Added in Version
v24.1.0Overview
This guide shows how to setup and use the Webhooks.
Use Case
Here are a few examples, how webhook can lead to a deeper integration with other systems:
3rd Party Software Integration
If a 3rd party software needs to be aware of users that login or logout, all ticket.*
events can be sent to that endpoint and providing real-time data to the software. This also allows you to react on used-up tickets.
Batch Access API
The Batch Access API is a perfect companion, as it allows you to create tickets or autologin devices. The webhook events will inform your service about expired tickets.
Monitoring
The system.*
events can be used to trigger alerts or notifications if the system is rebooting, creates backups, etc..
System settings
- Under APIs -> Webhooks enable the webhooks feature.
- Under the first tab, Webhooks new endpoints may be defined. See Webhook settings for details.
- The second tab shows processed events including the returned response.
- General settings, which apply to all webhooks can be found in the third tab.
Webhook settings
To setup a webhook fill out the required fields on the configuration page. The following table shows all available settings:
Setting | Type | Details | Format |
---|---|---|---|
Name | string | Name of the webhook (internal in webadmin) | e.g. Server1: System Events |
URL | string | URL pointing to endpoint | https://your.url/to?=endpoint |
Method | select | HTTP Method for sending data | POST , GET , PUT or DELETE |
Events | multiselect | Events which should be sent to this webhook. See Events | |
Headers | string | Header fields for sending data. One header per line | Field: Value |
Body | string | HTTP body format for sending event data | |
Body mime type | select | Mime type of body | application/json or application/xml |
Log body and headers | bool | For debugging purposes, all response headers and bodies can be logged. Do not enable in normal use, as this creates big amounts of data in the database. | |
Authentication settings | |||
Authentication type | select | Type of authentication. This determines which fields have to be filled below | none , basic or token |
Authentication URL | string | URL for authentication with the endpoint | |
Authentication method | select | HTTP Method for authentication | POST or GET |
Authentication headers | string | Header fields for authentication. One header per line | Field: Value |
Authentication body | string | HTTP body format for authentication | |
Authentication body mime type | select | Mime type of authentication body | application/json or application/xml |
Authentication username | string | username to be used for basic and token auth | |
Authentication password | string | password to be used for basic and token auth | |
Authentication token refresh intervall | int | Time intervall in min after which a new token is requested | |
Authentication token field | string | Name of the field in which the token is sent | e.g. auth_token or auth.token |
Authentication
Authentication settings depend on the setup of your desired webhook endpoint. The webhook endpoint supports no authentication (not recommended), HTTP basic auth and bearer token authentication.
Events
Currently the following events can be set to send a message:
- Ticket
- login
- logout
- logout due to timeout
- logout due to exceeded limit
- revoked
- System
- (re)start
- userlimit exceeded
- backup
- started
- done
- error
- More to come (talk to us, if you need specific events)
Note that the same endpoint can be used with different settings (e.g. headers or body) for different events by saving it as copy and changing the relevant fields.
Event data fields
field | description | type |
---|---|---|
event.uuid | UUID of the triggered event | string |
event.type | Type of the event, see above | string |
event.created_at | Time at which the event was triggered | timestamp as string |
event.ticket_id | Ticket id, which caused the event be sent | string |
event.data | A json body with more data about the event | json |
The event.data json
contains the following fields. All fields are sent, but only filled if data for them is available. All fields are also available as placeholder with the same field name.
field | type | values | comment |
---|---|---|---|
client_ip | string | last IP from ticket | |
client_mac | string | last Mac from ticket | |
client_vlan_rt | string | vlan from ticket | |
login_type | string | first , reconnect , n/a | n/a if not ticket.logged_in |
limit | string | time , volume , n/a | n/a if not ticket.logged_out.limit_exceeded |
description | string | ticket description | also needed for pms data |
template_id | int | id of template | |
template_name | string | name of template | |
ticket_type | string | single , parent , child | if customer wants to ignore parent events |
ticket_parent_group | int | id of parent_child group or 0 | allows grouping of child and parents |
ticket_price | int | Price of ticket * 100 | If webhook is used for calculation? |
backend | string | Ticket backend | allows identifying ticket backend (pms) |
backend_group | string | Ticket backend group | allows identifying ticket backend (pms) |
backend_data | string | Ticket backend data | Json of backend data |
timestamp_created | timestamp | ticket creation | |
timestamp_first_logon | timestamp | first logon | |
timestamp_expires | timestamp | expiration date | |
timestamp_lastseen | timestamp | lastseen (last traffic) | |
shared_limits | int | 1 or 0 | maybe relevant parent child setting? |
time_limit | int | time limit in sec | |
time_used | int | time used in sec | |
volume_limit | int | volume limit in bytes | |
volume_used_download | int | download in bytes | |
volume_used_upload | int | upload in bytes | |
volume_used | int | upload in bytes |
For PMS tickets, more data about the the ticket is contained in backend_data
. These fields can also be accessed via placeholder directly by using dot notation and are only filled depending on the type of ticket and PMS used. (e.g. backend_data.pms.room
, backend_data.pms.name
, backend_data.pms.departure
)
An example configuration is shown here:
{
"id":"{{event.uuid}}",
"event":"{{event.type}}",
"occured":"{{event.created_at}}",
"ticket_id":"{{event.ticket_id}}",
"volume_limit":"{{volume_limit}}",
"volume_used":"{{volume_used}}",
"volume_limit":"{{volume_limit}}",
"room_number":"{{backend_data.pms.room}}"
}
Event missing?
Please reach out to us via support@iacbox.com.
Event log
All processed events which are stored in the database are shown here to simplyfy debugging. More details can be displayed if the option to log body and headers is activated. Events will only be sent once to each endpoint, but errors (e.g. no response) will be logged here.
General settings
Cleanup event log
In order to avoid overfilling the database with old events, they are periodically removed. The interval can be set here. Logging for longer than one week is not recommended, for large system even lower intervalls may be sensible.
Read interval
Set the time interval in seconds in which the event queue will be processed. Defaults to 10 seconds.