ghostdevv / webhook

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

webhook

A simple proxy that sends webhooks it recieves to Discord. It takes in a plain Record<string, string | number | boolean> like record to make sending simple.

Send an embed

You can send your plain object (or an array of objects for multiple embeds), and it'll send it as an embed. All keys are stringified so you can't send nested objects.

curl -X POST -d '{"hello": "world"}' https://your-instance

Special Fields

Keys that start wth $ might have a special behaviour, and are all reserved for potential future use so won't show up in your embed.

$colour

curl -X POST -d '{"$colour": "#f96743"}' https://your-instance

$title

curl -X POST -d '{"$title": "Hello World"}' https://your-instance

$description

curl -X POST -d '{"$description": "Hello World"}' https://your-instance

Hosting

This is designed to run on Cloudflare workers. To self-host it make sure you have pnpm and node installed, and then clone the repo.

  1. Add your account to the wrangler.toml file. You can find this in the URL of the Cloudflare dashboard.

account id in the cloudflare dash url

  1. Next you need to add your HOOK_URL secret you got from Discord, this can be done by running:
pnpm wrangler secret put HOOK_URL
  1. Now you can deploy the worker:
pnpm run deploy
  1. Finally, you can view the worker and add a custom domain on the Cloudflare dashboard.

About

License:MIT License


Languages

Language:TypeScript 100.0%