---
title: "Linear Connector"
description: "Komplet guide til Linear-integration til synkronisering af issues, projekter og team-aktivitetsdata med Brevo via Tajo."
url: https://tajo.io/dk/docs/connectors/custom/linear/
markdown: https://tajo.io/dk/docs/connectors/custom/linear.md
lang: da-DK
robots: noindex
---

Bed om tidlig adgang til Tajo

Indtast dit fornavn og din arbejds-e-mailadresse. Vi sender dig et link til at bekræfte din anmodning om adgang til Tajo.

# Linear Connector

Connectorstatus: Planlagt Ikke bygget endnu. Tajo kører ikke denne connector i dag.

| Kildefelt | Destinationsfelt | Eksempelværdi |
| --- | --- | --- |
| `record.id` | `source_id` | `record_1042` |
| `record.updated_at` | `updated_at` | `2026-10-18T08:00:00Z` |
| `record.value` | `value` | `sample_value` |

Forbind dit Linear-workspace med Brevo for kundevendt issue-sporing, produktopdateringsnotifikationer og kampagner om udviklingsmilepæle gennem Tajo.

## Oversigt

| Egenskab | Værdi |
| --- | --- |
| **Platform** | Linear |
| **Kategori** | Brugerdefineret |
| **Opsætningskompleksitet** | Let |
| **Officiel integration** | Nej |
| **Synkroniserede data** | Issues, projekter, brugere, hændelser |
| **API-type** | GraphQL API |
| **Autentifikation** | OAuth 2.0 / Personal API Key |
| **Base-URL** | `https://api.linear.app/graphql` |

## Funktioner

- **Synkronisering af issue-hændelser** - Videresend issue-oprettelses-, opdaterings- og afslutningshændelser til Brevo-kontakttidslinjer
- **Sporing af projektmilepæle** - Udløs Brevo-kampagner, når projekter når nøglemilepæle
- **Sammenkædning af kunde-issues** - Knyt Linear-issues til Brevo-kontakter for support-synlighed
- **Label-baseret segmentering** - Kortlæg Linear-labels til Brevo-kontaktattributter
- **Cyklusanalyse** - Synkronisér sprint-/cyklusafslutningsdata til team-præstationsrapportering
- **Webhook-drevet automatisering** - Videresendelse af hændelser i realtid via Linear-webhooks

## Forudsætninger

Før du begynder, skal du sikre dig, at du har:

1. Et Linear-workspace med admin-adgang
2. En Personal API-nøgle eller OAuth-app konfigureret
3. En Brevo-konto med API-adgang
4. En Tajo-konto med aktivt abonnement

## Autentifikation

Linear understøtter Personal API-nøgler og OAuth 2.0.

### Mulighed 1: Personal API-nøgle

1. Gå til **Linear** > **Settings** > **API** > **Personal API keys**
2. Klik på **Create key**
3. Navngiv den “Tajo Integration”
4. Kopiér den genererede nøgle (starter med `lin_api_`)

```bash
curl -X POST https://api.linear.app/graphql \
  -H "Authorization: $LINEAR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query": "{ viewer { id name email } }"}'
```

### Mulighed 2: OAuth 2.0

Til integrationer, der betjener flere workspaces:

1. Opret en OAuth-applikation på [linear.app/settings/api/applications](https://linear.app/settings/api/applications)
2. Konfigurér redirect-URI: `https://app.tajo.io/callbacks/linear`
3. Anmod om scopes: `read`, `write`, `issues:create`, `comments:create`

GraphQL API

Linear bruger udelukkende et GraphQL API. Alle forespørgsler og mutationer går gennem et enkelt endpoint: `https://api.linear.app/graphql`. Tajo håndterer automatisk al konstruktion af GraphQL-forespørgsler.

### Forbind til Tajo

```bash
# Using Personal API Key
tajo connectors install linear \
  --api-key $LINEAR_API_KEY

# Using OAuth
tajo connectors install linear \
  --client-id $LINEAR_CLIENT_ID \
  --client-secret $LINEAR_CLIENT_SECRET
```

## Konfiguration

### Grundlæggende opsætning

```yaml
connectors:
  linear:
    enabled: true

    sync:
      issues: true
      projects: true
      cycles: true
      users: true

    teams:
      - key: "ENG"
        sync_to_list: 38
      - key: "SUPPORT"
        sync_to_list: 39

    issue_states:
      - Backlog
      - Todo
      - "In Progress"
      - Done
      - Canceled
```

### Feltmapping

Kortlæg Linear-bruger- og issue-data til Brevo-attributter:

```yaml
field_mapping:
  # User fields
  id: LINEAR_USER_ID
  email: email
  name: FIRSTNAME

  # Issue metrics mapped to contact events
  last_issue_identifier: LAST_LINEAR_ISSUE
  last_issue_state: LAST_ISSUE_STATUS
  last_issue_priority: LAST_ISSUE_PRIORITY
  total_issues: LINEAR_ISSUE_COUNT

  # Project data
  current_project: ACTIVE_PROJECT
  team_key: LINEAR_TEAM
```

### Hændelsesmapping

```yaml
event_mapping:
  Issue.create: ISSUE_CREATED
  Issue.update: ISSUE_UPDATED
  Issue.remove: ISSUE_DELETED
  Comment.create: COMMENT_ADDED
  Project.update: PROJECT_UPDATED
  Cycle.update: CYCLE_UPDATED
```

## API-endpoints

Linear bruger et enkelt GraphQL-endpoint. Nøgleforespørgsler og mutationer brugt af Tajo:

| Operation | Type | Formål |
| --- | --- | --- |
| `issues` | Query | Vis og filtrér issues |
| `issue` | Query | Hent enkelt issue efter ID |
| `projects` | Query | Vis alle projekter |
| `cycles` | Query | Vis cyklusser (sprints) |
| `teams` | Query | Vis workspace-teams |
| `users` | Query | Vis workspace-medlemmer |
| `viewer` | Query | Hent info om autentificeret bruger |
| `issueCreate` | Mutation | Opret et nyt issue |
| `issueUpdate` | Mutation | Opdatér et eksisterende issue |
| `commentCreate` | Mutation | Tilføj en kommentar til et issue |
| `webhookCreate` | Mutation | Registrér en webhook |

### Eksempel på GraphQL-forespørgsel

```graphql
query GetIssues($filter: IssueFilter, $first: Int, $after: String) {
  issues(filter: $filter, first: $first, after: $after) {
    nodes {
      id
      identifier
      title
      state { name }
      priority
      assignee { email name }
      labels { nodes { name } }
      createdAt
      updatedAt
    }
    pageInfo {
      hasNextPage
      endCursor
    }
  }
}
```

## Kodeeksempler

### Initialisér connector

```javascript
import { TajoClient } from '@tajo/sdk';

const tajo = new TajoClient({
  apiKey: process.env.TAJO_API_KEY,
  brevoApiKey: process.env.BREVO_API_KEY
});

await tajo.connectors.connect('linear', {
  apiKey: process.env.LINEAR_API_KEY
});
```

### Synkronisér issues

```javascript
await tajo.connectors.sync('linear', {
  type: 'incremental',
  resources: ['issues'],
  teams: ['ENG', 'SUPPORT'],
  since: '2024-01-01'
});

const status = await tajo.connectors.status('linear');
console.log(status);
// {
//   connected: true,
//   lastSync: '2024-03-15T18:00:00Z',
//   issuesTracked: 3200,
//   projectsMonitored: 8,
//   usersLinked: 45
// }
```

### Håndtér Linear-webhooks

```javascript
app.post('/webhooks/linear', async (req, res) => {
  const event = req.body;

  // Verify webhook signature
  const signature = req.get('Linear-Signature');
  if (!verifyLinearSignature(req.body, signature)) {
    return res.status(401).send('Unauthorized');
  }

  await tajo.connectors.handleWebhook('linear', {
    type: event.type,
    action: event.action,
    payload: {
      issueId: event.data?.id,
      identifier: event.data?.identifier,
      title: event.data?.title,
      state: event.data?.state?.name,
      assigneeEmail: event.data?.assignee?.email
    }
  });

  res.status(200).send('OK');
});
```

### Opret issue fra Brevo-hændelse

```javascript
// Create a Linear issue when a Brevo contact submits a request
tajo.events.on('contact.event', async (event) => {
  if (event.name === 'FEATURE_REQUEST') {
    await tajo.connectors.create('linear', {
      teamId: 'ENG',
      title: `Feature Request: ${event.data.subject}`,
      description: event.data.description,
      priority: 3,
      labelIds: ['feature-request']
    });
  }
});
```

## Rate limits

Linear håndhæver rate limits på sit GraphQL API:

| Grænsetype | Værdi |
| --- | --- |
| **Anmodningsrate** | 1.500 anmodninger pr. time pr. API-nøgle |
| **Forespørgselskompleksitet** | 10.000 kompleksitetspoint pr. anmodning |
| **Paginering** | Maks. 250 noder pr. side (standard 50) |
| **Webhooks** | Ubegrænsede indgående hændelser |

Kompleksitetsbudget

Linear bruger et kompleksitetsbaseret rate limiting-system. Simple forespørgsler koster færre point. Tajo optimerer forespørgsler for at minimere kompleksiteten ved kun at anmode om nødvendige felter og bruge effektiv paginering.

Linear returnerer `429 Too Many Requests` med en `Retry-After`-header, når grænserne overskrides.

## Fejlfinding

### Almindelige problemer

| Problem | Årsag | Løsning |
| --- | --- | --- |
| 401 Unauthorized | Ugyldig eller tilbagekaldt API-nøgle | Generér en ny API-nøgle i Linear-indstillinger |
| Forespørgselsfejl | Ugyldig GraphQL-syntaks | Validér forespørgsler ved hjælp af Linears API-explorer |
| Manglende issues | Team-adgang begrænset | Sørg for, at API-nøgleejeren har adgang til mål-teams |
| Webhook udløser ikke | Forkert URL eller deaktiveret | Tjek webhook-status i Linear Settings > API > Webhooks |
| Paginering ufuldstændig | Manglende `after`-cursor | Sørg for, at pagineringsløkker kører, indtil `hasNextPage` er false |

### Debug-tilstand

```yaml
connectors:
  linear:
    debug: true
    log_level: verbose
    log_queries: true
```

### Testforbindelse

```bash
tajo connectors test linear
# ✓ GraphQL API connection successful
# ✓ Workspace access verified
# ✓ Team list readable
# ✓ Issue query operational
# ✓ Webhook registration available
```

## Bedste praksis

1. **Brug webhooks til realtid** - Registrér webhooks i stedet for at polle efter issue-ændringer
2. **Filtrér efter team** - Synkronisér kun issues fra relevante teams for at reducere API-forbrug
3. **Optimér GraphQL-forespørgsler** - Anmod kun om nødvendige felter for at holde dig inden for kompleksitetsgrænser
4. **Kortlæg labels til segmenter** - Brug Linear-labels til at drive Brevo-kontaktsegmentering
5. **Håndtér paginering** - Tjek altid `hasNextPage`, og brug `endCursor` for komplette data
6. **Verificér webhook-signaturer** - Validér altid `Linear-Signature`-headeren

## Sikkerhed

- **API-nøgleautentifikation** - Personlige nøgler scoped til workspace
- **OAuth 2.0** - Sikkert autorisationsflow til integrationer med flere workspaces
- **Kun HTTPS** - Al API-kommunikation krypteres via TLS 1.2+
- **Webhook-signaturer** - HMAC-baseret signaturverifikation
- **Krypteret opbevaring** - API-nøgler krypteres i hvile i Tajo
- **SOC 2-compliance** - Linear-platformen er SOC 2 Type II-certificeret

## Relaterede ressourcer

- [GitHub Connector](https://tajo.io/dk/docs/connectors/custom/github)
- [Jira Connector](https://tajo.io/dk/docs/connectors/custom/jira)
- [Notion Connector](https://tajo.io/dk/docs/connectors/custom/notion)
- [Brevo Contacts API](https://tajo.io/dk/docs/contact-management)
