1
import { TriggerClient, cronTrigger } from "@trigger.dev/sdk";
2
import { Linear } from "@trigger.dev/linear";
3
import { Slack } from "@trigger.dev/slack";
4
import { get } from "http";
6
const linear = new Linear({
8
apiKey: process.env.LINEAR_API_KEY!,
11
const slack = new Slack({ id: "slack" });
14
id: "linear-issues-daily-slack-alert",
15
name: "Daily Slack alert for Linear issues",
21
trigger: cronTrigger({
24
cron: "0 9 * * 1,2,3,4,5",
27
run: async (payload, io, ctx) => {
28
const inProgressIssues = await io.linear.issues("get-in-progress-issues", {
35
eq: "<your-team-uuid>",
40
eq: "<assignee-email-address>",
51
await io.slack.postMessage("post message", {
52
channel: process.env.SLACK_CHANNEL_ID!,
54
text: `You have ${inProgressIssues.nodes.length} 'In Progress' issues in Linear!`,
56
blocks: inProgressIssues.nodes.flatMap((issue) => [
61
text: `⏳ *${issue.title}*`,
70
value: "click_me_123",
72
action_id: "button-action",