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";
5
const linear = new Linear({
7
apiKey: process.env.LINEAR_API_KEY!,
10
const slack = new Slack({ id: "slack" });
13
id: "linear-issues-daily-slack-alert",
14
name: "Daily Slack alert for Linear issues",
20
trigger: cronTrigger({
23
cron: "0 9 * * 1,2,3,4,5",
26
run: async (payload, io, ctx) => {
27
const inProgressIssues = await io.linear.issues("get-in-progress-issues", {
34
eq: "<your-team-uuid>",
39
eq: "<assignee-email-address>",
50
await io.slack.postMessage("post message", {
51
channel: process.env.SLACK_CHANNEL_ID!,
53
text: `You have ${inProgressIssues.nodes.length} 'In Progress' issues in Linear!`,
55
blocks: inProgressIssues.nodes.flatMap((issue) => [
60
text: `⏳ *${issue.title}*`,
69
value: "click_me_123",
71
action_id: "button-action",