@owlrelay/webhook
Version:
OwlRelay Webhook utilities
47 lines (34 loc) • 1.09 kB
Markdown
and verify webhooks when an email is received.
```bash
pnpm install @owlrelay/webhook
npm install @owlrelay/webhook
yarn add @owlrelay/webhook
```
To trigger a webhook, you can use the `triggerWebhook` function.
```ts
import { triggerWebhook } from '@owlrelay/webhook';
await triggerWebhook({
email: { /* ...*/},
webhookUrl: 'https://my-app.invalid/webhook',
webhookSecret: 'my-webhook-secret',
});
```
On the receiving end, you can verify the webhook by using the `verifySignature` function.
```ts
import { verifySignature } from '@owlrelay/webhook';
const isValid = verifySignature({
signature: 'my-signature',
bodyBuffer,
secret: 'my-webhook-secret',
});
```
This library is licensed under the AGPL-3.0 License. See the [LICENSE](./LICENSE) file for details.
This project is crafted with ❤️ by [Corentin Thomasset](https://corentin.tech).
If you find this project helpful, please consider [supporting my work](https://buymeacoffee.com/cthmsst).
This package contains the code to trigger