A lightweight server to receive and validate Polymart webhooks, and forward the formatted information to a Discord channel.
- Receives webhooks from Polymart
- Validates webhook signatures
- Forwards formatted information to a Discord channel
These requirements is only applicable if you are running from outside Glitch.
- Python 3.x
-
Clone the repository:
git clone https://github.com/yourusername/polymart-webhook-server.git cd polymart-webhook-server
-
Install the dependencies:
pip install -r .requirements.txt
-
Copy the
.env.example
file to.env
and fill in your configuration:cp .env.example .env
-
Update the
.env
file with your Polymart webhook secrets and Discord webhook URL:WEBHOOK_SECRET_SPLITTER=YOUR_SPLITTER WEBHOOK_SECRETS=YOUR_SECRETS DISCORD_WEBHOOK_URL=YOUR_DISCORD_WEBHOOK_URL DISCORD_PURCHASE_WEBHOOK_CONTENT=YOUR_DISCORD_WEBHOOK_CONTENT DISCORD_REFUND_WEBHOOK_CONTENT=YOUR_DISCORD_WEBHOOK_CONTENT
To set up the server on Glitch, follow these steps:
-
Create a new Glitch project by going to glitch.com and clicking on "New Project".
-
Choose "Import from GitHub" and paste the URL (
https://github.com/yourusername/polymart-webhook-server.git
). -
Wait for the project to import and click on "Show" to open the project editor.
-
Open the
.env
file and add the following configuration:WEBHOOK_SECRET_SPLITTER=YOUR_SPLITTER WEBHOOK_SECRETS=YOUR_SECRETS DISCORD_WEBHOOK_URL=YOUR_DISCORD_WEBHOOK_URL DISCORD_PURCHASE_WEBHOOK_CONTENT=YOUR_DISCORD_WEBHOOK_CONTENT DISCORD_REFUND_WEBHOOK_CONTENT=YOUR_DISCORD_WEBHOOK_CONTENT
-
Finally, click on "Tools" again and select "Logs" to see the server logs. Your server should now be running on Glitch.
Do not share your .env
file or webhook secrets publicly.
Start the server using the following command:
python server.py
The server will run on http://0.0.0.0:5000
by default.
The server exposes a single endpoint /
to receive POST requests from Polymart webhooks. It validates the webhook signature and forwards the formatted information to the specified Discord channel.
WEBHOOK_SECRET_SPLITTER
: The webhook secret splitter.WEBHOOK_SECRETS
: Your Polymart webhook secrets.DISCORD_WEBHOOK_URL
: The URL of your Discord webhook.DISCORD_PURCHASE_WEBHOOK_CONTENT
: The JSON payload template for purchase events.DISCORD_REFUND_WEBHOOK_CONTENT
: The JSON payload template for refund events.
Polymart Webhook Server is released under the MIT License. See the LICENSE file for more details.