Scripts
Make the panel do something of your own when an event happens.
Open Admin > Scripts. Each script waits for one event, then either calls a web address you give it or runs a short piece of JavaScript.
The events you can hang a script on
| Event | Fires when |
|---|---|
on_server_start | A game server starts. |
on_server_stop | A game server stops. |
on_player_join | A player joins a server. |
on_player_leave | A player leaves a server. |
on_console_match | A console line matches a trigger. |
on_ticket_created | A customer opens a support ticket. |
on_incident_opened | An incident is opened. |
Writing one
- Click to add a script.
- Give it a Name, such as
Welcome message. - Pick a Language. Choose webhook to call an address you already have, or javascript to write the logic here.
- Pick the Event it waits for.
- Fill in the body, which is a URL for a webhook and code for JavaScript.
- Tick Enabled to let it run.
- Click Save.
A webhook script receives the event as a POST to the address you gave.
A JavaScript script gets three things: event holds the details of what happened, console.log collects the output you see afterwards, and fetch makes an HTTP request.
Trying it before it goes live
Click Test run. The panel offers a sample event, which you can edit before running it, and shows you what came back.
Use it after every change. A script that fails on a live event fails quietly, and the run history is the only place it shows.
The run history
Recent runs lists what the script has done, newest first.
| Column | Shows |
|---|---|
| When | The time it ran. |
| Status | Whether it worked. |
| Trigger | What set it off, including a test run. |
| Duration | How long it took. |
Click a row to see the output and anything it returned.
Turning one off
Untick Enabled and save. The script stays with its history, and stops running.
Delete removes the script and its runs.
Next steps
- Webhooks to send events to another service without writing anything
- Schedules and triggers for what a customer can automate themselves
- Incidents for the incidents a script can react to
