NEW 📢 Limited launch offer: up to 70% off your first month on every game!See plans

How to get Discord alerts from your server with webhooks

Game servers & panelUpdated Oct 27, 20266 min read

A webhook posts a short message in a Discord channel when something happens on your server: it starts, stops or crashes, a player joins or leaves, or a backup finishes. Everyone in the channel sees it without opening the panel. A webhook can also send to any other https address, for your own tools.

Only the owner of a server can set up its webhooks. People you invited to the server do not see the page.

1. Create a webhook in Discord

You need permission to manage webhooks in the Discord server. Its owner and admins normally have it.

  1. In Discord, open Server Settings and go to Integrations.
  2. Click Create Webhook, give it a name and choose the text channel it posts to, for example a #server-alerts channel.
  3. Click Copy Webhook URL.

Discord explains these steps with pictures in its guide Intro to Webhooks. Treat the webhook URL like a password: anyone who has it can post in that channel.

2. Add it to your server

  1. Open your server in the panel and click Webhooks in the left menu.
  2. Click Add one, or New webhook if the server already has one.
  3. Give it a Name if you like. It is only for you and labels the webhook in your list.
  4. Paste the address into URL. It must start with https://. When it is a Discord webhook, the panel shows Discord webhook recognised.
  5. Under Send it when, tick the events you want (see below). Server crashed is ticked to start with, and at least one must be ticked.
  6. Click Create webhook.

The events

EventWhen it is sent
Server startedWhen the server is up and ready for players, including after a restart.
Server stoppedA stop someone asked for: you, a team member or a schedule.
Server crashedThe server went down without being asked to. It is sent a minute or two later, once we are sure, and says whether the server came back by itself.
Player joinedWith the player's name, on games that report who is online. Games that only report a count say how many.
Player leftThe same, when someone leaves. Players are checked once a minute while the server is running.
Backup finishedWhether the backup succeeded, and how large it is.
Install finishedAfter the first install or a reinstall.
Transfer finishedWhen a move of your server has finished.

Project Zomboid servers have extra events read from the game's log: Player died, PvP kill, Admin action, Mod updated, Restart countdown started and Relay in-game chat. Chat is only sent if you tick it, and only general chat: whispers, faction and safehouse chat are never sent.

What arrives

  • In Discord, messages come from PlayNHost as short cards with the server name, what happened and when. Discord shows the time in each reader's own time zone.
  • Messages name your server but never include its address or its ID, so they can go in a public channel. To change the name they show, rename the server. See How to rename your server and change player slots.
  • A player cannot ping your channel with their name. A name such as @everyone arrives as plain text.
  • Any other address receives the events as JSON. See For your own tools below.

Turn a webhook off, change it or delete it

  • Use the switch on a webhook's row to turn it off and on again. It keeps its settings while it is off.
  • Open the row's menu and choose Edit to change the name, the address or the events, or Delete to remove it. Nothing else is affected: your server keeps running and the channel simply stops getting messages.

Good to know

  • A server can have up to 10 webhooks, for example one per channel.
  • To keep a channel readable, each webhook sends at most 4 messages a minute and 40 an hour. Messages over that are skipped rather than sent late, and the next message says how many earlier updates were skipped.
  • If the webhook is deleted in Discord, the panel switches it off by itself the next time it tries to send, and the row shows Off. Create a new webhook in Discord, choose Edit, paste the new address, then switch it back on.
  • There is no test button. To check a new webhook, tick Server started and restart your server. The message arrives shortly after the server is ready.
  • Webhooks are for a channel your group shares. For alerts to you alone, in the panel or by email, see How to manage notifications and preferences.

For your own tools

An address that is not a Discord webhook receives a POST with a JSON body:

  • source is PlayNHost.
  • events is a list. Each event has a type (such as server.crash or player.join), server (the server's name), at (when it happened), a readable title and text, and a data object with the details.
  • skipped is how many earlier messages were left out by the limit above.

The address must use https and point to a public address on the internet. Redirects are not followed. Messages are not signed, so keep the address itself secret.

OUR LATEST BLOGS