An open API service indexing awesome lists of open source software.

https://github.com/korosuke613/linear-webhook

Webhook handler for Linear.app
https://github.com/korosuke613/linear-webhook

linear-app npm-package

Last synced: 4 months ago
JSON representation

Webhook handler for Linear.app

Awesome Lists containing this project

README

          

# linear-webhook

Webhook handler for Linear.

[![npm version](https://badge.fury.io/js/linear-webhook.svg)](https://badge.fury.io/js/linear-webhook) ![CI](https://github.com/korosuke613/linear-webhook/workflows/CI/badge.svg) [![codecov](https://codecov.io/gh/korosuke613/linear-webhook/branch/main/graph/badge.svg?token=DCE4MXG035)](https://codecov.io/gh/korosuke613/linear-webhook)

## Getting started

Use the package manager [npm](https://docs.npmjs.com/about-npm/) to install linear-webhook.

### Install linear-webhook

```bash
npm i linear-webhook
```

### Example code

[handlerExample.ts](./src/__tests__/examples/handlerExample.ts)

```ts
import { WebhookHandler, CreateIssueWebhook } from "linear-webhook";

const handler = new WebhookHandler();
handler.addCallback("CreateIssueWebhook", (webhook) => {
console.log("This event is CreateIssueWebhook.");
console.log(`Action: ${webhook.action}, Type: ${webhook.type}`);
});

(async () => {
await handler.execCallback(webhook);
})();
```

output

```planetext
This event is CreateIssueWebhook.
Action: create, Type: Issue
```