This package provides integration with Linear, allowing you to create issues and comments programmatically using the Linear API.
To install the package, use npm or yarn:
npm install @restackio/integrations-linear
To use the Linear integration, you need to set up the Linear service:
// services.ts
import Restack from "@restackio/ai";
import { linearService } from "@restackio/integrations-linear";
export async function services() {
const client = new Restack();
linearService({ client }).catch((err) => {
console.error("Error starting Linear service:", err);
});
}
services().catch((err) => {
console.error("Error running services:", err);
});
To create an issue in Linear:
// createIssueWorflow.ts
import { step } from "@restackio/ai/workflow";
import * as linearFunctions from "@restackio/integrations-linear/functions";
import { linearTaskQueue } from "@restackio/integrations-linear/taskQueue";
export async function createIssueWorkflow() {
const result = await step<typeof linearFunctions>({
taskQueue: linearTaskQueue,
}).linearCreateIssue({
issue: {
title: "New issue",
description: "This is a new issue created via the API",
teamId: "your-team-id",
},
apiKey: "your-linear-api-key",
});
}
The Linear client is configured using an API key. You can either pass the API key directly to the functions or set it as an environment variable:
LINEAR_API_KEY=your-linear-api-key