Back to APIs

Subscribe to issues and manage your teams projects.

Using our official Linear integration

Easily subscribe to Linear webhooks to trigger your jobs.

Create any tasks possible with the Linear API.

Use io.runTask() and the official SDK or fetch.

Linear integration docs

Example code using Linear

Below are some working code examples of how you can use Linear with Trigger.dev. These samples are open source and maintained by the community, you can copy and paste them into your own projects.

1
import { TriggerClient } from "@trigger.dev/sdk";
2
import { Github, events } from "@trigger.dev/github";
3
import { Linear } from "@trigger.dev/linear";
4
import { Slack } from "@trigger.dev/slack";
5
6
const linear = new Linear({
7
id: "linear",
8
apiKey: process.env.LINEAR_API_KEY!,
9
});
10
const slack = new Slack({ id: "slack" });
11
12
const github = new Github({ id: "github" });
13
14
client.defineJob({
15
id: "linear-create-issue-on-github-pr",
16
name: "Create a Linear issue when a pull request is opened on a GitHub repo",
17
version: "1.0.0",
18
trigger: github.triggers.repo({
19
event: events.onPullRequest,
20
owner: "<your-org-name>",
21
repo: "<your-repo-name>",
22
}),
23
integrations: {
24
linear,
25
github,
26
slack,
27
},
28
run: async (payload, io, ctx) => {
29
const pullRequestTitle = payload.pull_request.title;
30
const pullRequestURL = payload.pull_request.issue_url;
31
const pullRequestAuthorURL = payload.sender.html_url;
32
const pullRequestDescription = payload.pull_request.body;
33
34
const issue = await io.linear.createIssue("create issue", {
35
title: pullRequestTitle,
36
description: pullRequestDescription,
37
// To get your Team id from within Linear, hit CMD+K and "Copy model UUID"
38
teamId: "<your-team-uuid>",
39
});
40
41
await io.slack.postMessage("post message", {
42
// Set the Slack channel ID (not name) in your environment variables
43
channel: process.env.SLACK_CHANNEL_ID!,
44
text: `⚡️ New pull request, "${pullRequestTitle}", ${pullRequestURL},
45
\n created by 👨‍💻 "${pullRequestAuthorURL}"
46
\n New issue has been created in Linear: ${issue?.url}.`,
47
});
48
},
49
});