Discordata is a simple bridge between incoming KYC provider webhook requests and outgoing Discord webhook requests. Each time a webhook request is received, Discordata formats a Discord and sends it via the Discord webhook URL.
Discord data can be run as a standalone application or as a docker container.
By default Discordata will listen on port 1276 for requests
to the webhook endpoint. Port 1276 must be opened and forwarded
to Discordata. The URL to the webhook endpoint must be provided to
the KYC provider. For example, http://XXX.XXX.XXX.XXX:1276/webhook/.
Clone the Discordata github repository:
git clone https://github.com/metanull-operator/discordata.gitChange directory into the Discordata repository:
cd discordataIf you want to use a self-signed certificate, generate the certificate and key.
Adjust -days to the appropriate length of time your certificate should be valid.
cd certs
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes
cd ..Two environment variables are required to be exported to Discordata in order to run:
WEBHOOK_SECRET- A shared secret for secure communication with the KYC provider. Provided by the KYC provider.DISCORD_WEBHOOK_URL- The URL for the Discord webhook to be used to send messages to Discord. This can be provided by the administrators of the Discord server.
Two additional environment variables may be set to modify default behaviors:
ALLOWED_IPS- Comma-delimited list of IP addresses or subnets from which requests will be accepted. Defaults to0.0.0.0.PORT- Port on which Discordata will listen. For Docker containers, this is the internal port on which Discordata is listening. The external port can be adjusted with the-pflag on the run command. Defaults to1276.
Copy .env.sample to .env and modify the values of the variables to
suit your environment.
cp .env.sample .envBoth examples of running the application below rely on
a .env environment variable file, but other methods of setting
the environment variables may be used.
docker build -t discordata .Run the following docker command, making the appropriate substitutions:
- Substitute
<PATH_TO_REPO>with the absolute path to your Discordata repository' - Change the external container port 1276 with another port, if necessary.
For example
-p 5000:1276.
docker run \
-p 1276:1276 \
--env-file .env \
--name discordata \
-v <PATH_TO_REPO>/certs/cert.pem:/certs/cert.pem \
-v <PATH_TO_REPO>/certs/key.pem:/certs/key.pem \
discordataOtherwise, place your organization's cert.pem and key.pem file in the certs/ directory.
pip3 install flask flask-talisman requests./discordata.shmock-webhook-request.py sends a fake webhook request to the
provided webhook URL.
To run:
python3 mock-webhook-request.py http://localhost:1276/webhookmock-webhook-request.py will send a single request to the Discordata webhook
URL and then exit.