Skip to content

Webhooks - Endpoint Development Guide

WARNING

This tutorial is for advanced users who are writing discord bots and services in Python/NodeJS and would like a way to access the Webhook data to re-format and display in discord and do various other actions with the server.

In order to use the Webhook feature, you will need to create a Webhook Server that will receive the data from the game server and then you can do whatever you want with it. This guide will show you how to create a basic Webhook Server in Python/NodeJS.

The steps are as follows for Python/NodeJS Webhook Server:

Requirements

First you will need to install the following:

  1. Install Python 3.

  2. Run Following commands in command prompt:

sh
mkdir WebhookServerDemo
cd WebhookServerDemo
sh
pip install pipenv
pipenv install Flask
pipenv shell

Setup - Code

Once you have installed the requirements, you can now create the Webhook Server.

Create app.py in the WebhookServerDemo folder and paste the following code into it.

python
from flask import Flask, request
app = Flask(__name__)

@app.route('/pot/login', methods=['POST'])
def login():
    request_data = request.get_json()

    ServerName = request_data['ServerName']
    PlayerName = request_data['PlayerName']
    AlderonId = request_data['AlderonId']
    BattlEyeGUID = request_data['BattlEyeGUID']
    bServerAdmin = request_data['bServerAdmin']
    
if __name__ == '__main__':
    # run app in debug mode on port 80
    app.run(debug=True, port=80)

Run Webhook Server

Once you have created the application file, you can now run the Webhook Server.

sh
python app.py

Setup - Game Server

Once you have the Webhook Server running, you can now setup the Game Server to send data to it. This is done by editing the Game.ini file. You can find this file in the following location:

INFO

WindowsServer is the folder name for Windows servers. If you are using a different operating system, the folder name will be different but the other folders will be the same.

And adding the following lines for each Webhook you want to send data to:

ini
[ServerWebhooks]
bEnabled=true
Format="General"
; Replace the below IP with the final IP of your web service.
PlayerLogin="http://127.0.0.1:80/pot/login"

For further information on webhooks, you can read the Webhook Documentation.

Footer Image

7e4bd70