Event
Compatible Application Events for the “Event” entity
The official repository for the extensions can be found here.
Extensions allow you to link Alf.io with your existing tools, such as:
Extensions can be added and modified by each user. However, some limitations are applied that can be found here.
Each extension consists of a JavaScript script and is registered to one or more Application Events, and is fired as soon as the Application Event occurs.
You can find some sample code in the introduction page.
Alf.io provides some objects and properties to the script in the script scope:
| Variable | Type | About |
|---|---|---|
log | Log4j | Logging utility |
extensionLogger | ExtensionLogger | A logger that writes in the extension_log table. |
simpleHttpClient | SimpleHttpClient | A simplified version created by Alf.io for calling external services |
GSON | GSON | JSON parser/generator |
returnClass | java.lang.Class<?> | The return class of the methods |
extensionParameters | Map<String, Object> | Defined parameters as in the script metadata |
event | Event | Alf.io's implementation of a general event |
eventId | int | The id of the event |
organizationId | int | The id of the organization that organized the event |
Utils | ExtensionUtils | A collection of utilities |
executionKey | String | An identifier for the execution, which can be treated as an idempotency key. |
Other event-related variables are also injected in the scope.
getScriptMetadataThis method returns the actual configuration options and capabilities of the extension.
It must return a JSON object with the following properties:
boolean: whether or not the script should be invoked asynchronously.string[]: list of supported eventsstring): string}: the extension configuration (WIP)executeScriptThe actual event handling. Return types are event-dependent. Will always receive a single parameter (scriptEvent)
which is the event that triggered the script.
Some events provide the details of the organizer in the organization variable. It is an object with the following properties:
| Property | Type | About |
|---|---|---|
id | int | The id of the organization |
name | String | The name of the organization |
description | String | The description of the organization |
externalId | String | The id of the organization in an external system. Empty string if not set |
slug | String | The slug of the organization, used in its public address. Empty string if not set |
Below is a list of all the supported Application Events by related entity, with some additional global variables, expected result type and a short explanation.
Compatible Application Events for the “Event” entity
Compatible Application Events for the “Reservation” entity
Compatible Application Events for the “Ticket” entity
Compatible Application Events for the “Subscription” entity
Compatible Application Events for the “Email” entity
Other Application Events