Skip to content

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

EventFires when
on_server_startA game server starts.
on_server_stopA game server stops.
on_player_joinA player joins a server.
on_player_leaveA player leaves a server.
on_console_matchA console line matches a trigger.
on_ticket_createdA customer opens a support ticket.
on_incident_openedAn incident is opened.

Writing one

  1. Click to add a script.
  2. Give it a Name, such as Welcome message.
  3. Pick a Language. Choose webhook to call an address you already have, or javascript to write the logic here.
  4. Pick the Event it waits for.
  5. Fill in the body, which is a URL for a webhook and code for JavaScript.
  6. Tick Enabled to let it run.
  7. 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.

ColumnShows
WhenThe time it ran.
StatusWhether it worked.
TriggerWhat set it off, including a test run.
DurationHow 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

BadgerPanel Documentation