https://github.com/ghostdevv/webhook
https://github.com/ghostdevv/webhook
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/ghostdevv/webhook
- Owner: ghostdevv
- License: mit
- Created: 2024-08-21T22:00:35.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-22T00:25:07.000Z (about 1 year ago)
- Last Synced: 2025-02-08T03:44:34.346Z (about 1 year ago)
- Language: TypeScript
- Size: 88.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# webhook
A simple proxy that sends webhooks it recieves to Discord. It takes in a plain `Record` 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.
```bash
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`
```bash
curl -X POST -d '{"$colour": "#f96743"}' https://your-instance
```

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

### `$description`
```bash
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`](https://pnpm.io/) and [`node`](https://nodejs.org/) installed, and then clone the repo.
1. Add your account to the [`wrangler.toml`](./wrangler.toml) file. You can find this in the URL of the Cloudflare dashboard.

2. Next you need to add your `HOOK_URL` secret you got from Discord, this can be done by running:
```bash
pnpm wrangler secret put HOOK_URL
```
3. Now you can deploy the worker:
```bash
pnpm run deploy
```
4. Finally, you can view the worker and add a custom domain on the [Cloudflare dashboard](https://dash.cloudflare.com?to=/:account/workers/services/view/webhook).